TCString.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _TCSTRING_H_
00036 #define _TCSTRING_H_
00037
00038 #include "TCTypes.h"
00039
00040 #include <string>
00041 #include <vector>
00042 #include <cstdarg>
00043
00044 namespace TC
00045 {
00061 namespace String
00062 {
00063 TCBASE_API std::string ToString(const char* val);
00064 TCBASE_API std::string ToString(char val);
00065 TCBASE_API std::string ToString(bool val);
00066 TCBASE_API std::string ToString(uint64 val);
00067 TCBASE_API std::string ToString(uint32 val);
00068 TCBASE_API std::string ToString(uint16 val);
00069 TCBASE_API std::string ToString(uint8 val);
00070 TCBASE_API std::string ToString(sint64 val);
00071 TCBASE_API std::string ToString(sint32 val);
00072 TCBASE_API std::string ToString(sint16 val);
00073 TCBASE_API std::string ToString(sint8 val);
00074 TCBASE_API std::string ToString(float val);
00075 TCBASE_API std::string ToString(double val);
00076
00077 TCBASE_API bool IsIntValue(const std::string& text);
00078 TCBASE_API bool IsFltValue(const std::string& text);
00079 TCBASE_API bool IsValue(const std::string& text);
00080
00081 TCBASE_API bool ToBool(const std::string& text);
00082
00083 TCBASE_API uint64 ToUint64(const std::string& text);
00084 TCBASE_API uint32 ToUint32(const std::string& text);
00085 TCBASE_API uint16 ToUint16(const std::string& text);
00086 TCBASE_API uint8 ToUint8(const std::string& text);
00087
00088 TCBASE_API sint64 ToSint64(const std::string& text);
00089 TCBASE_API sint32 ToSint32(const std::string& text);
00090 TCBASE_API sint16 ToSint16(const std::string& text);
00091 TCBASE_API sint8 ToSint8(const std::string& text);
00092
00093 TCBASE_API double ToFlt64(const std::string& text);
00094 TCBASE_API float ToFlt32(const std::string& text);
00095
00096 TCBASE_API bool Split(const std::string& text, const std::string& split,
00097 std::string& text1, std::string& text2);
00098 TCBASE_API bool Split(const std::string& text, uint32 pos,
00099 std::string& text1, std::string& text2);
00100 TCBASE_API bool Split(const std::string& text, const std::string& split,
00101 std::vector<std::string>& texts);
00102 TCBASE_API void Join(const std::vector<std::string>& texts, const std::string& split,
00103 std::string& text);
00104
00105 TCBASE_API std::string Replace(const std::string& text, char c1, char c2);
00106 TCBASE_API std::string Replace(const std::string& text, const std::string& text1, const std::string& text2);
00107 TCBASE_API std::string ToLower(const std::string& text);
00108 TCBASE_API std::string ToUpper(const std::string& text);
00109
00110 TCBASE_API std::string DeleteBlanksAndTabs(const std::string& text);
00111 TCBASE_API std::string TrimmSpaces(const std::string& text);
00113 TCBASE_API std::string TrimmLeadingSpaces(const std::string& text);
00115 TCBASE_API std::string TrimmTrailingSpaces(const std::string& text);
00116
00123 TCBASE_API sint32 StringICompare(const char* s1, const char* s2);
00131 TCBASE_API sint32 StringICompare(const char* s1, const char* s2, uint32 len_to_compare);
00132
00133 TCBASE_API sint32 Snprintf(char* buf, uint32 size_of_buf, const char *fmt, ...);
00134 TCBASE_API sint32 VSnprintf(char* buf, uint32 size_of_buf, const char *fmt, va_list arguments);
00135 TCBASE_API std::string Print(const char* format, ...);
00136 TCBASE_API std::string VPrint(const char* format, va_list arguments);
00137
00138 }
00139
00144 }
00145
00146 #endif // _TCSTRING_H_