00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00020 #ifndef _FCU_STRING_CONVERSION_
00021 #define _FCU_STRING_CONVERSION_
00022
00023 #ifndef UINT_MAX
00024 #define UINT_MAX ~(uint32)0
00025 #endif // UINT_MAX
00026
00027 class FUDateTime;
00028
00045 class FCOLLADA_EXPORT FUStringConversion
00046 {
00047 private: FUStringConversion() {}
00048 public:
00049
00053 static fstring ToFString(const char* value);
00054 inline static fstring ToFString(const fm::string& value) { return ToFString(value.c_str()); }
00059 static fm::string ToString(const fchar* value);
00060 inline static fm::string ToString(const fstring& value) { return ToString(value.c_str()); }
00065 template <class CH>
00066 static FCOLLADA_EXPORT bool ToBoolean(const CH* value);
00067 template <class CH>
00068 inline static bool ToBoolean(const fm::stringT<CH>& value) { return ToBoolean(value.c_str()); }
00074 template <class CH>
00075 static FCOLLADA_EXPORT float ToFloat(const CH** value);
00076 template <class CH>
00077 inline static float ToFloat(const CH* value) { return ToFloat(&value); }
00078 template <class CH>
00079 inline static float ToFloat(const fm::stringT<CH>& value) { return ToFloat(value.c_str()); }
00085 template <class CH>
00086 static FCOLLADA_EXPORT int32 ToInt32(const CH** value);
00087 template <class CH>
00088 inline static int32 ToInt32(const CH* value) { return ToInt32(&value); }
00089 template <class CH>
00090 inline static int32 ToInt32(const fm::stringT<CH>& value) { return ToInt32(value.c_str()); }
00096 template <class CH>
00097 static FCOLLADA_EXPORT uint32 ToUInt32(const CH** value);
00098 template <class CH>
00099 inline static uint32 ToUInt32(const CH* value) { return ToUInt32(&value); }
00100 template <class CH>
00101 inline static uint32 ToUInt32(const fm::stringT<CH>& value) { return ToUInt32(value.c_str()); }
00110 template <class CH>
00111 static FCOLLADA_EXPORT uint32 HexToUInt32(const CH** value, uint32 count=UINT_MAX);
00112 template <class CH>
00113 inline static uint32 HexToUInt32(const CH* value, uint32 count=UINT_MAX) { return HexToUInt32(&value, count); }
00114 template <class CH>
00115 inline static uint32 HexToUInt32(const fm::stringT<CH>& value, uint32 count=UINT_MAX) { return HexToUInt32(value.c_str(), count); }
00121 template <class CH>
00122 static FCOLLADA_EXPORT FMVector2 ToVector2(const CH** value);
00123 template <class CH>
00124 inline static FMVector2 ToVector2(const CH* value) { return ToVector2(&value); }
00125 template <class CH>
00126 inline static FMVector2 ToVector2(const fm::stringT<CH>& value) { return ToVector2(value.c_str()); }
00127 template <class CH>
00128 static FCOLLADA_EXPORT FMVector3 ToVector3(const CH** value);
00129 template <class CH>
00130 inline static FMVector3 ToVector3(const CH* value) { return ToVector3(&value); }
00131 template <class CH>
00132 inline static FMVector3 ToVector3(const fm::stringT<CH>& value) { return ToVector3(value.c_str()); }
00133 template <class CH>
00134 static FCOLLADA_EXPORT FMVector4 ToVector4(const CH** value);
00135 template <class CH>
00136 inline static FMVector4 ToVector4(const CH* value) { return ToVector4(&value); }
00137 template <class CH>
00138 inline static FMVector4 ToVector4(const fm::stringT<CH>& value) { return ToVector4(value.c_str()); }
00144 template <class CH>
00145 static FCOLLADA_EXPORT void ToMatrix(const CH** value, FMMatrix44& mx);
00146 template <class CH>
00147 inline static void ToMatrix(const CH* value, FMMatrix44& mx) { ToMatrix(&value, mx); }
00148 template <class CH>
00149 inline static void ToMatrix(const fm::stringT<CH>& value, FMMatrix44& mx) { ToMatrix(value.c_str(), mx); }
00150 template <class CH>
00151 inline static FMMatrix44 ToMatrix(const CH* value) { FMMatrix44 mx; ToMatrix(&value, mx); return mx; }
00152 template <class CH>
00153 inline static FMMatrix44 ToMatrix(const fm::stringT<CH>& value) { FMMatrix44 mx; ToMatrix(value.c_str(), mx); return mx; }
00158 template <class CH>
00159 static FCOLLADA_EXPORT void ToDateTime(const CH* value, FUDateTime& dateTime);
00160 template <class CH>
00161 inline static void ToDateTime(const fm::stringT<CH>& value, FUDateTime& dateTime) { return ToDateTime(value.c_str(), dateTime); }
00163 #ifdef HAS_VECTORTYPES
00164
00169 static void ToFStringList(const fstring& value, FStringList& array);
00170 static void ToStringList(const char* value, StringList& array);
00171 #ifdef UNICODE
00172 static void ToStringList(const fchar* value, StringList& array);
00173 #endif // UNICODE
00174 template <class CH>
00175 inline static void ToStringList(const fm::stringT<CH>& value, StringList& array) { return ToStringList(value.c_str(), array); }
00180 template <class CH>
00181 static FCOLLADA_EXPORT void ToBooleanList(const CH* value, BooleanList& array);
00182 template <class CH>
00183 inline static void ToBooleanList(const fm::stringT<CH>& value, BooleanList& array) { return ToBooleanList(value.c_str(), array); }
00188 template <class CH>
00189 static FCOLLADA_EXPORT void ToFloatList(const CH* value, FloatList& array);
00190 template <class CH>
00191 inline static void ToFloatList(const fm::stringT<CH>& value, FloatList& array) { return ToFloatList(value.c_str(), array); }
00196 template <class CH>
00197 static FCOLLADA_EXPORT void ToInt32List(const CH* value, Int32List& array);
00198 template <class CH>
00199 inline static void ToInt32List(const fm::stringT<CH>& value, Int32List& array) { return ToInt32List(value.c_str(), array); }
00204 template <class CH>
00205 static FCOLLADA_EXPORT void ToUInt32List(const CH* value, UInt32List& array);
00206 template <class CH>
00207 inline static void ToUInt32List(const fm::stringT<CH>& value, UInt32List& array) { return ToUInt32List(value.c_str(), array); }
00213 template <class CH>
00214 static FCOLLADA_EXPORT void ToInterleavedFloatList(const CH* value, fm::pvector<FloatList>& arrays);
00215 template <class CH>
00216 inline static void ToInterleavedFloatList(const fm::stringT<CH>& value, fm::pvector<FloatList>& arrays) { return ToInterleavedFloatList(value.c_str(), arrays); }
00222 template <class CH>
00223 static FCOLLADA_EXPORT void ToInterleavedUInt32List(const CH* value, fm::pvector<UInt32List>& arrays);
00224 template <class CH>
00225 inline static void ToInterleavedUInt32List(const fm::stringT<CH>& value, fm::pvector<UInt32List>& arrays) { return ToInterleavedFloatList(value.c_str(), arrays); }
00230 template <class CH>
00231 static FCOLLADA_EXPORT void ToMatrixList(const CH* value, FMMatrix44List& array);
00232 template <class CH>
00233 inline static void ToMatrixList(const fm::stringT<CH>& value, FMMatrix44List& array) { return ToMatrixList(value.c_str(), array); }
00238 template <class CH>
00239 static FCOLLADA_EXPORT void ToVector2List(const CH* value, FMVector2List& array);
00240 template <class CH>
00241 inline static void ToVector2List(const fm::stringT<CH>& value, FMVector2List& array) { return ToVector2List(value.c_str(), array); }
00246 template <class CH>
00247 static FCOLLADA_EXPORT void ToVector3List(const CH* value, FMVector3List& array);
00248 template <class CH>
00249 inline static void ToVector3List(const fm::stringT<CH>& value, FMVector3List& array) { return ToVector3List(value.c_str(), array); }
00254 template <class CH>
00255 inline static void ToPointList(const CH* value, FMVector3List& array) { return ToVector3List(value, array); }
00256 template <class CH>
00257 inline static void ToPointList(const fm::stringT<CH>& value, FMVector3List& array) { return ToVector3List(value.c_str(), array); }
00262 template <class CH>
00263 static FCOLLADA_EXPORT void ToVector4List(const CH* value, FMVector4List& array);
00264 template <class CH>
00265 inline static void ToVector4List(const fm::stringT<CH>& value, FMVector4List& array) { return ToVector4List(value.c_str(), array); }
00272 template <class CH>
00273 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const FloatList& values);
00274
00280 template <class CH>
00281 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const Int32List& values);
00282
00288 template <class CH>
00289 inline FCOLLADA_EXPORT static void ToString(FUStringBuilderT<CH>& builder, const UInt32List& values) { return ToString(builder, values.begin(), values.size()); }
00290
00297 template <class CH>
00298 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const uint32* values, size_t count);
00299
00300 #endif // HAS_VECTORTYPES
00301
00305 static fm::string ToString(const FMVector4& p);
00306 static fstring ToFString(const FMVector4& p);
00311 static fm::string ToString(const FMMatrix44& value);
00312 static fstring ToFString(const FMMatrix44& value);
00317 static fm::string ToString(const FMVector2& value);
00318 static fstring ToFString(const FMVector2& value);
00323 static fm::string ToString(const FMVector3& value);
00324 static fstring ToFString(const FMVector3& value);
00329 static fm::string ToString(const FUDateTime& dateTime);
00330 static fstring ToFString(const FUDateTime& dateTime);
00339 template <class T> static fm::string ToString(const T& value) { FUSStringBuilder builder; builder.set(value); return builder.ToString(); }
00340 template <class T> static fstring ToFString(const T& value) { FUStringBuilder builder; builder.set(value); return builder.ToString(); }
00346 template <class CH>
00347 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const FMMatrix44& value);
00348
00353 template <class CH>
00354 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const FMVector2& value);
00355
00360 template <class CH>
00361 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const FMVector3& value);
00362
00367 template <class CH>
00368 static FCOLLADA_EXPORT void ToString(FUStringBuilderT<CH>& builder, const FMVector4& p);
00369
00372 static void SplitTarget(const fm::string& target, fm::string& pointer, fm::string& qualifier);
00373
00378 static int32 ParseQualifier(const char* string);
00379 static inline int32 ParseQualifier(const fm::string& string) { return ParseQualifier(string.c_str()); }
00380
00386 template <class CH>
00387 static FCOLLADA_EXPORT size_t CountValues(const CH* sz);
00388 };
00389
00390 #ifdef __APPLE__
00391 #include "FUtils/FUStringConversion.hpp"
00392 #endif // __APPLE__
00393
00394 #endif // _FCU_STRING_CONVERSION_