UtiLite
0.3.1
A lite utilities library
|
00001 /* 00002 * utilite is a cross-platform library with 00003 * useful utilities for fast and small developing. 00004 * Copyright (C) 2010 Mathieu Labbe 00005 * 00006 * utilite is free library: you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * utilite is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #ifndef UCONVERSION_H 00021 #define UCONVERSION_H 00022 00023 #include "utilite/UtiLiteExp.h" // DLL export/import defines 00024 00025 #include <string> 00026 #include <vector> 00027 #include <stdarg.h> 00028 00051 std::string UTILITE_EXP uReplaceChar(const std::string & str, char before, char after); 00052 00067 std::string UTILITE_EXP uReplaceChar(const std::string & str, char before, const std::string & after); 00068 00080 std::string UTILITE_EXP uToUpperCase(const std::string & str); 00081 00093 std::string UTILITE_EXP uToLowerCase(const std::string & str); 00094 00100 std::string UTILITE_EXP uNumber2Str(unsigned int number); 00106 std::string UTILITE_EXP uNumber2Str(int number); 00112 std::string UTILITE_EXP uNumber2Str(float number); 00118 std::string UTILITE_EXP uNumber2Str(double number); 00119 00126 std::string UTILITE_EXP uBool2Str(bool boolean); 00134 bool UTILITE_EXP uStr2Bool(const char * str); 00135 00151 std::string UTILITE_EXP uBytes2Hex(const char * bytes, unsigned int bytesLen); 00166 std::vector<char> UTILITE_EXP uHex2Bytes(const std::string & hex); 00181 std::vector<char> UTILITE_EXP uHex2Bytes(const char * hex, int hexLen); 00182 00199 std::string UTILITE_EXP uHex2Str(const std::string & hex); 00200 00213 unsigned char UTILITE_EXP uHex2Ascii(const unsigned char & c, bool rightPart); 00214 00227 unsigned char UTILITE_EXP uAscii2Hex(const unsigned char & c); 00228 00232 std::string UTILITE_EXP uFormatv (const char *fmt, va_list ap); 00233 00237 std::string UTILITE_EXP uFormat (const char *fmt, ...); 00238 00239 #ifdef WIN32 00240 00244 UTILITE_EXP wchar_t * createWCharFromChar(const char * text); 00245 00250 UTILITE_EXP char * createCharFromWChar(const wchar_t * wText); 00251 #endif 00252 00253 #endif /* UCONVERSION_H */