OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / design / HalfConverter.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/design/HalfConverter.cpp b/SlimDXc_Jun2010(VC++2008)/source/design/HalfConverter.cpp
deleted file mode 100644 (file)
index d96eabd..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "stdafx.h"\r
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-#include <d3dx9.h>\r
-\r
-#include "../InternalHelpers.h"\r
-#include "../math/Half.h"\r
-\r
-#include "HalfConverter.h"\r
-\r
-using namespace System;\r
-using namespace System::Collections;\r
-using namespace System::Drawing;\r
-using namespace System::ComponentModel;\r
-using namespace System::ComponentModel::Design::Serialization;\r
-using namespace System::Globalization;\r
-using namespace System::Reflection;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Design\r
-{\r
-       bool HalfConverter::CanConvertTo(ITypeDescriptorContext^ context, Type^ destinationType)\r
-       {\r
-               if( destinationType == String::typeid || destinationType == InstanceDescriptor::typeid )\r
-                       return true;\r
-               else\r
-                       return ExpandableObjectConverter::CanConvertTo(context, destinationType);\r
-       }\r
-\r
-       bool HalfConverter::CanConvertFrom(ITypeDescriptorContext^ context, Type^ sourceType)\r
-       {\r
-               if( sourceType == String::typeid )\r
-                       return true;\r
-               else\r
-                       return ExpandableObjectConverter::CanConvertFrom(context, sourceType);\r
-       }\r
-\r
-       Object^ HalfConverter::ConvertTo(ITypeDescriptorContext^ context, CultureInfo^ culture, Object^ value, Type^ destinationType)\r
-       {\r
-               if( destinationType == nullptr )\r
-                       throw gcnew ArgumentNullException( "destinationType" );\r
-\r
-               if( culture == nullptr )\r
-                       culture = CultureInfo::CurrentCulture;\r
-\r
-               Half^ half = dynamic_cast<Half^>( value );\r
-\r
-               if( destinationType == String::typeid && half != nullptr )\r
-               {\r
-                       String^ separator = culture->TextInfo->ListSeparator + " ";\r
-                       TypeConverter^ converter = TypeDescriptor::GetConverter(float::typeid);\r
-                       array<String^>^ stringArray = gcnew array<String^>( 1 );\r
-\r
-                       stringArray[0] = converter->ConvertToString( context, culture, safe_cast<float>( *half ) );\r
-\r
-                       return String::Join( separator, stringArray );\r
-               }\r
-               else if( destinationType == InstanceDescriptor::typeid && half != nullptr )\r
-               {\r
-                       ConstructorInfo^ info = (Half::typeid)->GetConstructor( gcnew array<Type^> { float::typeid } );\r
-                       if( info != nullptr )\r
-                               return gcnew InstanceDescriptor( info, gcnew array<Object^> { safe_cast<float>( *half ) } );\r
-               }\r
-\r
-               return ExpandableObjectConverter::ConvertTo(context, culture, value, destinationType);\r
-       }\r
-\r
-       Object^ HalfConverter::ConvertFrom(ITypeDescriptorContext^ context, CultureInfo^ culture, Object^ value)\r
-       {\r
-               if( culture == nullptr )\r
-                       culture = CultureInfo::CurrentCulture;\r
-\r
-               String^ string = dynamic_cast<String^>( value );\r
-\r
-               if( string != nullptr )\r
-               {\r
-                       string = string->Trim();\r
-                       TypeConverter^ converter = TypeDescriptor::GetConverter(float::typeid);\r
-                       array<String^>^ stringArray = string->Split( culture->TextInfo->ListSeparator[0] );\r
-\r
-                       if( stringArray->Length != 1 )\r
-                               throw gcnew ArgumentException("Invalid half format.");\r
-\r
-                       float H = safe_cast<float>( converter->ConvertFromString( context, culture, stringArray[0] ) );\r
-\r
-                       return gcnew Half(H);\r
-               }\r
-\r
-               return ExpandableObjectConverter::ConvertFrom(context, culture, value);\r
-       }\r
-}\r
-}
\ No newline at end of file