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-2006 Torus Knot Software Ltd
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 
00024 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 
00030 #ifndef __StringConverter_H__
00031 #define __StringConverter_H__
00032 
00033 #include "OgrePrerequisites.h"
00034 #include "OgreMath.h"
00035 #include "OgreString.h"
00036 #include "OgreStringVector.h"
00037 
00038 namespace Ogre {
00039 
00057     class _OgreExport StringConverter
00058     {
00059     public:
00060 
00062         static String toString(Real val, unsigned short precision = 6, 
00063             unsigned short width = 0, char fill = ' ', 
00064             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00066         static String toString(Radian val, unsigned short precision = 6, 
00067             unsigned short width = 0, char fill = ' ', 
00068             std::ios::fmtflags flags = std::ios::fmtflags(0) )
00069         {
00070             return toString(val.valueAngleUnits(), precision, width, fill, flags);
00071         }
00073         static String toString(Degree val, unsigned short precision = 6, 
00074             unsigned short width = 0, char fill = ' ', 
00075             std::ios::fmtflags flags = std::ios::fmtflags(0) )
00076         {
00077             return toString(val.valueAngleUnits(), precision, width, fill, flags);
00078         }
00080         static String toString(int val, unsigned short width = 0, 
00081             char fill = ' ', 
00082             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00083 #if OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
00084 
00085         static String toString(unsigned int val, 
00086             unsigned short width = 0, char fill = ' ', 
00087             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00089         static String toString(size_t val, 
00090             unsigned short width = 0, char fill = ' ', 
00091             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00092         #if OGRE_COMPILER == OGRE_COMPILER_MSVC
00093 
00094                 static String toString(unsigned long val, 
00095                     unsigned short width = 0, char fill = ' ', 
00096                     std::ios::fmtflags flags = std::ios::fmtflags(0) );
00097 
00098         #endif
00099 #else
00100 
00101         static String toString(size_t val, 
00102             unsigned short width = 0, char fill = ' ', 
00103             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00105         static String toString(unsigned long val, 
00106             unsigned short width = 0, char fill = ' ', 
00107             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00108 #endif
00109 
00110         static String toString(long val, 
00111             unsigned short width = 0, char fill = ' ', 
00112             std::ios::fmtflags flags = std::ios::fmtflags(0) );
00116         static String toString(bool val, bool yesNo = false);
00121         static String toString(const Vector2& val);
00126         static String toString(const Vector3& val);
00131         static String toString(const Vector4& val);
00136         static String toString(const Matrix3& val);
00142         static String toString(const Matrix4& val);
00147         static String toString(const Quaternion& val);
00152         static String toString(const ColourValue& val);
00158         static String toString(const StringVector& val);
00159 
00164         static Real parseReal(const String& val);
00169         static inline Radian parseAngle(const String& val) {
00170             return Angle(parseReal(val));
00171         }
00176         static int parseInt(const String& val);
00181         static unsigned int parseUnsignedInt(const String& val);
00186         static long parseLong(const String& val);
00191         static unsigned long parseUnsignedLong(const String& val);
00197         static bool parseBool(const String& val);
00203         static Vector2 parseVector2(const String& val);
00209         static Vector3 parseVector3(const String& val);
00215         static Vector4 parseVector4(const String& val);
00221         static Matrix3 parseMatrix3(const String& val);
00227         static Matrix4 parseMatrix4(const String& val);
00234         static Quaternion parseQuaternion(const String& val);
00240         static ColourValue parseColourValue(const String& val);
00241 
00247         static StringVector parseStringVector(const String& val);
00249         static bool isNumber(const String& val);
00250     };
00251 
00252 
00253 }
00254 
00255 
00256 
00257 #endif
00258 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:26 2009