00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00017 #ifndef _FCU_STRING_CONVERSION_
00018 #define _FCU_STRING_CONVERSION_
00019
00020 class FUDateTime;
00021
00034 class FCOLLADA_EXPORT FUStringConversion
00035 {
00036 private: FUStringConversion() {}
00037 public:
00041 static fstring ToFString(const char* value);
00042 inline static fstring ToFString(const string& value) { return ToFString(value.c_str()); }
00047 static string ToString(const fchar* value);
00048 inline static string ToString(const fstring& value) { return ToString(value.c_str()); }
00053 static bool ToBoolean(const char* value);
00054 inline static bool ToBoolean(const string& value) { return ToBoolean(value.c_str()); }
00055 #ifdef UNICODE
00056 static bool ToBoolean(const fchar* value);
00057 inline static bool ToBoolean(const fstring& value) { return ToBoolean(value.c_str()); }
00058 #endif
00059
00064 static float ToFloat(const char** value);
00065 inline static float ToFloat(const char* value) { return ToFloat(&value); }
00066 inline static float ToFloat(const string& value) { return ToFloat(value.c_str()); }
00067 #ifdef UNICODE
00068 static float ToFloat(const fchar** value);
00069 inline static float ToFloat(const fstring& value) { return ToFloat(value.c_str()); }
00070 inline static float ToFloat(const fchar* value) { return ToFloat(&value); }
00071 #endif
00072
00077 static int32 ToInt32(const char** value);
00078 inline static int32 ToInt32(const char* value) { return ToInt32(&value); }
00079 inline static int32 ToInt32(const string& value) { return ToInt32(value.c_str()); }
00080 #ifdef UNICODE
00081 static int32 ToInt32(const fchar** value);
00082 inline static int32 ToInt32(const fchar* value) { return ToInt32(&value); }
00083 inline static int32 ToInt32(const fstring& value) { return ToInt32(value.c_str()); }
00084 #endif
00085
00090 static uint32 ToUInt32(const char** value);
00091 inline static uint32 ToUInt32(const char* value) { return ToUInt32(&value); }
00092 inline static uint32 ToUInt32(const string& value) { return ToUInt32(value.c_str()); }
00093 #ifdef UNICODE
00094 static uint32 ToUInt32(const fchar** value);
00095 inline static uint32 ToUInt32(const fchar* value) { return ToUInt32(&value); }
00096 inline static uint32 ToUInt32(const fstring& value) { return ToUInt32(value.c_str()); }
00097 #endif
00098
00106 static uint32 HexToUInt32(const char** value, uint32 count=UINT_MAX);
00107 inline static uint32 HexToUInt32(const char* value, uint32 count=UINT_MAX) { return HexToUInt32(&value, count); }
00108 inline static uint32 HexToUInt32(const string& value, uint32 count=UINT_MAX) { return HexToUInt32(value.c_str(), count); }
00109 #ifdef UNICODE
00110 static uint32 HexToUInt32(const fchar** value, uint32 count=UINT_MAX);
00111 inline static uint32 HexToUInt32(const fchar* value, uint32 count=UINT_MAX) { return HexToUInt32(&value, count); }
00112 inline static uint32 HexToUInt32(const fstring& value, uint32 count=UINT_MAX) { return HexToUInt32(value.c_str(), count); }
00113 #endif
00114
00120 static FMVector3 ToPoint(const char** value, float lengthFactor=1.0f);
00121 inline static FMVector3 ToPoint(const char* value, float lengthFactor=1.0f) { return ToPoint(&value, lengthFactor); }
00122 inline static FMVector3 ToPoint(const string& value, float lengthFactor=1.0f) { return ToPoint(value.c_str(), lengthFactor); }
00123 #ifdef UNICODE
00124 static FMVector3 ToPoint(const fchar** value, float lengthFactor=1.0f);
00125 inline static FMVector3 ToPoint(const fchar* value, float lengthFactor=1.0f) { return ToPoint(&value, lengthFactor); }
00126 inline static FMVector3 ToPoint(const fstring& value, float lengthFactor=1.0f) { return ToPoint(value.c_str(), lengthFactor); }
00127 #endif
00128
00135 static void ToMatrix(const char** value, FMMatrix44& mx, float lengthFactor=1.0f);
00136 inline static void ToMatrix(const char* value, FMMatrix44& mx, float lengthFactor=1.0f) { return ToMatrix(&value, mx, lengthFactor); }
00137 inline static void ToMatrix(const string& value, FMMatrix44& mx, float lengthFactor=1.0f) { return ToMatrix(value.c_str(), mx, lengthFactor); }
00138 #ifdef UNICODE
00139 static void ToMatrix(const fchar** value, FMMatrix44& mx, float lengthFactor=1.0f);
00140 inline static void ToMatrix(const fchar* value, FMMatrix44& mx, float lengthFactor=1.0f) { return ToMatrix(&value, mx, lengthFactor); }
00141 inline static void ToMatrix(const fstring& value, FMMatrix44& mx, float lengthFactor=1.0f) { return ToMatrix(value.c_str(), mx, lengthFactor); }
00142 #endif
00143
00147 static void ToDateTime(const char* value, FUDateTime& dateTime);
00148 inline static void ToDateTime(const string& value, FUDateTime& dateTime) { return ToDateTime(value.c_str(), dateTime); }
00149 #ifdef UNICODE
00150 static void ToDateTime(const fchar* value, FUDateTime& dateTime);
00151 inline static void ToDateTime(const fstring& value, FUDateTime& dateTime) { return ToDateTime(value.c_str(), dateTime); }
00152 #endif
00153
00154 #ifdef HAS_VECTORTYPES
00155
00160 static void ToFStringList(const fstring& value, FStringList& array);
00161 static void ToStringList(const string& value, StringList& array);
00162 #ifdef UNICODE
00163 static void ToStringList(const fchar* value, StringList& array);
00164 inline static void ToStringList(const fstring& value, StringList& array) { return ToStringList(value.c_str(), array); }
00165 #endif
00166
00170 static void ToFloatList(const char* value, FloatList& array);
00171 inline static void ToFloatList(const string& value, FloatList& array) { return ToFloatList(value.c_str(), array); }
00172 #ifdef UNICODE
00173 static void ToFloatList(const fchar* value, FloatList& array);
00174 inline static void ToFloatList(const fstring& value, FloatList& array) { return ToFloatList(value.c_str(), array); }
00175 #endif
00176
00180 static void ToInt32List(const char* value, Int32List& array);
00181 inline static void ToInt32List(const string& value, Int32List& array) { return ToInt32List(value.c_str(), array); }
00182 #ifdef UNICODE
00183 static void ToInt32List(const fchar* value, Int32List& array);
00184 inline static void ToInt32List(const fstring& value, Int32List& array) { return ToInt32List(value.c_str(), array); }
00185 #endif
00186
00190 static void ToUInt32List(const char* value, UInt32List& array);
00191 inline static void ToUInt32List(const string& value, UInt32List& array) { return ToUInt32List(value.c_str(), array); }
00192 #ifdef UNICODE
00193 static void ToUInt32List(const fchar* value, UInt32List& array);
00194 inline static void ToUInt32List(const fstring& value, UInt32List& array) { return ToUInt32List(value.c_str(), array); }
00195 #endif
00196
00201 static void ToInterleavedFloatList(const char* value, const vector<FloatList*>& arrays);
00202 inline static void ToInterleavedFloatList(const string& value, const vector<FloatList*>& arrays) { return ToInterleavedFloatList(value.c_str(), arrays); }
00203 #ifdef UNICODE
00204 static void ToInterleavedFloatList(const fchar* value, const vector<FloatList*>& arrays);
00205 inline static void ToInterleavedFloatList(const fstring& value, const vector<FloatList*>& arrays) { return ToInterleavedFloatList(value.c_str(), arrays); }
00206 #endif
00207
00213 static void ToMatrixList(const char* value, FMMatrix44List& array, float lengthFactor=1.0f);
00214 inline static void ToMatrixList(const string& value, FMMatrix44List& array, float lengthFactor=1.0f) { return ToMatrixList(value.c_str(), array, lengthFactor); }
00215 #ifdef UNICODE
00216 static void ToMatrixList(const fchar* value, FMMatrix44List& array, float lengthFactor=1.0f);
00217 inline static void ToMatrixList(const fstring& value, FMMatrix44List& array, float lengthFactor=1.0f) { return ToMatrixList(value.c_str(), array, lengthFactor); }
00218 #endif
00219
00224 static void ToPointList(const char* value, FMVector3List& array, float lengthFactor=1.0f);
00225 inline static void ToPointList(const string& value, FMVector3List& array, float lengthFactor=1.0f) { return ToPointList(value.c_str(), array, lengthFactor); }
00226 #ifdef UNICODE
00227 static void ToPointList(const fchar* value, FMVector3List& array, float lengthFactor=1.0f);
00228 inline static void ToPointList(const fstring& value, FMVector3List& array, float lengthFactor=1.0f) { return ToPointList(value.c_str(), array, lengthFactor); }
00229 #endif
00230
00238 static void ToString(FUSStringBuilder& builder, const FloatList& values, float lengthFactor=1.0f);
00239
00245 static void ToString(FUSStringBuilder& builder, const Int32List& values);
00246
00252 static void ToString(FUSStringBuilder& builder, const UInt32List& values);
00253
00254 #endif // HAS_VECTORTYPES
00255
00260 static string ToString(const FMVector4& p, float lengthFactor=1.0f);
00261
00267 static string ToString(const FMMatrix44& value, float lengthFactor=1.0f);
00268 static fstring ToFString(const FMMatrix44& value, float lengthFactor=1.0f);
00274 static string ToString(const FMVector3& value, float lengthFactor=1.0f);
00275 static fstring ToFString(const FMVector3& value, float lengthFactor=1.0f);
00280 static string ToString(const FUDateTime& dateTime);
00281 static fstring ToFString(const FUDateTime& dateTime);
00290 template <typename T> static string ToString(const T& value) { globalSBuilder.set(value); return globalSBuilder.ToString(); }
00291 template <typename T> static fstring ToFString(const T& value) { globalBuilder.set(value); return globalBuilder.ToString(); }
00299 static void ToString(FUSStringBuilder& builder, const FMMatrix44& value, float lengthFactor=1.0f);
00300 static void ToFString(FUStringBuilder& builder, const FMMatrix44& value, float lengthFactor=1.0f);
00307 static void ToString(FUSStringBuilder& builder, const FMVector3& value, float lengthFactor=1.0f);
00308 static void ToFString(FUStringBuilder& builder, const FMVector3& value, float lengthFactor=1.0f);
00315 static void ToString(FUSStringBuilder& builder, const FMVector4& p, float lengthFactor=1.0f);
00316 };
00317
00318 #endif // _FCU_STRING_CONVERSION_