Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
00001 // Copyright 2006-2011 by Kat'Oun 00002 00003 #ifndef _UTILS_H_ 00004 #define _UTILS_H_ 00005 00006 #include <EngineConfig.h> 00007 #include <core/Types.h> 00008 00009 #include <string> 00010 #include <vector> 00011 00012 namespace core 00013 { 00014 00015 inline ENGINE_PUBLIC_EXPORT void stringTrim(std::string& str, const std::string& whitespace = " \t\n", bool left = true, bool right = true); 00016 inline ENGINE_PUBLIC_EXPORT void stringToLower(std::string& str); 00017 inline ENGINE_PUBLIC_EXPORT void stringToUpper(std::string& str); 00018 00019 inline ENGINE_PUBLIC_EXPORT s32 stringToInt(std::string& str); 00020 inline ENGINE_PUBLIC_EXPORT f32 stringToFloat(std::string& str); 00021 00022 inline ENGINE_PUBLIC_EXPORT std::string intToString(u32 i); 00023 inline ENGINE_PUBLIC_EXPORT std::string intToString(s32 i); 00024 inline ENGINE_PUBLIC_EXPORT std::string floatToString(f32 f); 00025 00026 inline ENGINE_PUBLIC_EXPORT std::vector<std::string> splitString(const std::string& str, const std::string& delims = "\t\n ", u32 maxSplits = 0); 00027 00028 inline ENGINE_PUBLIC_EXPORT bool powerOfTwo(u32 num); 00029 inline ENGINE_PUBLIC_EXPORT bool powerOfTwo(u64 num); 00030 00032 inline ENGINE_PUBLIC_EXPORT u32 fixedToFixed(u32 value, u32 n, u32 p); 00034 inline ENGINE_PUBLIC_EXPORT u32 floatToFixed(const f32 value, const u32 bits); 00036 inline ENGINE_PUBLIC_EXPORT f32 fixedToFloat(u32 value, u32 bits); 00038 inline ENGINE_PUBLIC_EXPORT u16 floatToHalf(f32 i); 00040 inline ENGINE_PUBLIC_EXPORT f32 halfToFloat(u16 y); 00041 00042 static const std::string STRING_BLANK = ""; 00043 00044 } // end namespace core 00045 00046 #endif
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by
Doxygen
(1.7.4)
|