OgreStringConverter.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2009 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 
00029 #ifndef __StringConverter_H__
00030 #define __StringConverter_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 #include "OgreMath.h"
00034 #include "OgreString.h"
00035 #include "OgreStringVector.h"
00036 
00037 namespace Ogre {
00038 
00062     class _OgreExport StringConverter
00063     {
00064     public:
00065 
00067         static String toString(Real val, unsigned short precision = 6, 
00068             unsigned short width = 0, char fill = ' ', 
00069             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00071         static String toString(Radian val, unsigned short precision = 6, 
00072             unsigned short width = 0, char fill = ' ', 
00073             std::ios::fmtflags flags = std::ios::fmtflags(0) )
00074         {
00075             return toString(val.valueAngleUnits(), precision, width, fill, flags);
00076         }
00078         static String toString(Degree val, unsigned short precision = 6, 
00079             unsigned short width = 0, char fill = ' ', 
00080             std::ios::fmtflags flags = std::ios::fmtflags(0) )
00081         {
00082             return toString(val.valueAngleUnits(), precision, width, fill, flags);
00083         }
00085         static String toString(int val, unsigned short width = 0, 
00086             char fill = ' ', 
00087             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00088 #if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
00089 
00090         static String toString(unsigned int val, 
00091             unsigned short width = 0, char fill = ' ', 
00092             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00094         static String toString(size_t val, 
00095             unsigned short width = 0, char fill = ' ', 
00096             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00097         #if OGRE_COMPILER == OGRE_COMPILER_MSVC
00098 
00099                 static String toString(unsigned long val, 
00100                     unsigned short width = 0, char fill = ' ', 
00101                     std::ios::fmtflags flags = std::ios::fmtflags(0) );
00102 
00103         #endif
00104 #else
00105 
00106         static String toString(size_t val, 
00107             unsigned short width = 0, char fill = ' ', 
00108             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00110         static String toString(unsigned long val, 
00111             unsigned short width = 0, char fill = ' ', 
00112             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00113 #endif
00114 
00115         static String toString(long val, 
00116             unsigned short width = 0, char fill = ' ', 
00117             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00121         static String toString(bool val, bool yesNo = false);
00126         static String toString(const Vector2& val);
00131         static String toString(const Vector3& val);
00136         static String toString(const Vector4& val);
00141         static String toString(const Matrix3& val);
00147         static String toString(const Matrix4& val);
00152         static String toString(const Quaternion& val);
00157         static String toString(const ColourValue& val);
00163         static String toString(const StringVector& val);
00164 
00169         static Real parseReal(const String& val);
00174         static inline Radian parseAngle(const String& val) {
00175             return Angle(parseReal(val));
00176         }
00181         static int parseInt(const String& val);
00186         static unsigned int parseUnsignedInt(const String& val);
00191         static long parseLong(const String& val);
00196         static unsigned long parseUnsignedLong(const String& val);
00202         static bool parseBool(const String& val);
00208         static Vector2 parseVector2(const String& val);
00214         static Vector3 parseVector3(const String& val);
00220         static Vector4 parseVector4(const String& val);
00226         static Matrix3 parseMatrix3(const String& val);
00232         static Matrix4 parseMatrix4(const String& val);
00239         static Quaternion parseQuaternion(const String& val);
00245         static ColourValue parseColourValue(const String& val);
00246 
00252         static StringVector parseStringVector(const String& val);
00254         static bool isNumber(const String& val);
00255     };
00256 
00260 }
00261 
00262 
00263 
00264 #endif
00265 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 24 18:00:39 2010