OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / design / Vector3Converter.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/design/Vector3Converter.cpp b/SlimDXc_Jun2010(VC++2008)/source/design/Vector3Converter.cpp
deleted file mode 100644 (file)
index fc18067..0000000
+++ /dev/null
@@ -1,156 +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
-\r
-#include "../InternalHelpers.h"\r
-#include "../math/Vector3.h"\r
-\r
-#include "Vector3Converter.h"\r
-#include "FieldPropertyDescriptor.h"\r
-\r
-using namespace System;\r
-using namespace System::Collections;\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
-       Vector3Converter::Vector3Converter()\r
-       {\r
-               Type^ type = Vector3::typeid;\r
-               array<PropertyDescriptor^>^ propArray =\r
-               {\r
-                       gcnew FieldPropertyDescriptor(type->GetField("X")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("Y")),\r
-                       gcnew FieldPropertyDescriptor(type->GetField("Z")),\r
-               };\r
-\r
-               m_Properties = gcnew PropertyDescriptorCollection(propArray);\r
-       }\r
-\r
-       bool Vector3Converter::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 Vector3Converter::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^ Vector3Converter::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
-               Vector3^ vector = dynamic_cast<Vector3^>( value );\r
-\r
-               if( destinationType == String::typeid && vector != nullptr )\r
-               {\r
-                       String^ separator = culture->TextInfo->ListSeparator + " ";\r
-                       TypeConverter^ converter = TypeDescriptor::GetConverter(float::typeid);\r
-                       array<String^>^ stringArray = gcnew array<String^>( 3 );\r
-\r
-                       stringArray[0] = converter->ConvertToString( context, culture, vector->X );\r
-                       stringArray[1] = converter->ConvertToString( context, culture, vector->Y );\r
-                       stringArray[2] = converter->ConvertToString( context, culture, vector->Z );\r
-\r
-                       return String::Join( separator, stringArray );\r
-               }\r
-               else if( destinationType == InstanceDescriptor::typeid && vector != nullptr )\r
-               {\r
-                       ConstructorInfo^ info = (Vector3::typeid)->GetConstructor( gcnew array<Type^> { float::typeid, float::typeid, float::typeid } );\r
-                       if( info != nullptr )\r
-                               return gcnew InstanceDescriptor( info, gcnew array<Object^> { vector->X, vector->Y, vector->Z } );\r
-               }\r
-\r
-               return ExpandableObjectConverter::ConvertTo(context, culture, value, destinationType);\r
-       }\r
-\r
-       Object^ Vector3Converter::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 != 3 )\r
-                               throw gcnew ArgumentException("Invalid vector format.");\r
-\r
-                       float X = safe_cast<float>( converter->ConvertFromString( context, culture, stringArray[0] ) );\r
-                       float Y = safe_cast<float>( converter->ConvertFromString( context, culture, stringArray[1] ) );\r
-                       float Z = safe_cast<float>( converter->ConvertFromString( context, culture, stringArray[2] ) );\r
-\r
-                       return gcnew Vector3(X, Y, Z);\r
-               }\r
-\r
-               return ExpandableObjectConverter::ConvertFrom(context, culture, value);\r
-       }\r
-\r
-       bool Vector3Converter::GetCreateInstanceSupported(ITypeDescriptorContext^ context)\r
-       {\r
-               SLIMDX_UNREFERENCED_PARAMETER(context);\r
-\r
-               return true;\r
-       }\r
-\r
-       Object^ Vector3Converter::CreateInstance(ITypeDescriptorContext^ context, IDictionary^ propertyValues)\r
-       {\r
-               SLIMDX_UNREFERENCED_PARAMETER(context);\r
-\r
-               if( propertyValues == nullptr )\r
-                       throw gcnew ArgumentNullException( "propertyValues" );\r
-\r
-               return gcnew Vector3( safe_cast<float>( propertyValues["X"] ), safe_cast<float>( propertyValues["Y"] ),\r
-                       safe_cast<float>( propertyValues["Z"] ) );\r
-       }\r
-\r
-       bool Vector3Converter::GetPropertiesSupported(ITypeDescriptorContext^)\r
-       {\r
-               return true;\r
-       }\r
-\r
-       PropertyDescriptorCollection^ Vector3Converter::GetProperties(ITypeDescriptorContext^, Object^, array<Attribute^>^)\r
-       {\r
-               return m_Properties;\r
-       }\r
-}\r
-}
\ No newline at end of file