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 "rtabmap/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 00125 int UTILITE_EXP uStr2Int(const std::string & str); 00126 00132 float UTILITE_EXP uStr2Float(const std::string & str); 00133 00139 double UTILITE_EXP uStr2Double(const std::string & str); 00140 00141 00148 std::string UTILITE_EXP uBool2Str(bool boolean); 00156 bool UTILITE_EXP uStr2Bool(const char * str); 00157 bool UTILITE_EXP uStr2Bool(const std::string & str); 00158 00164 std::vector<unsigned char> UTILITE_EXP uStr2Bytes(const std::string & str); 00165 00171 std::string UTILITE_EXP uBytes2Str(const std::vector<unsigned char> & bytes); 00172 00188 std::string UTILITE_EXP uBytes2Hex(const char * bytes, unsigned int bytesLen); 00203 std::vector<char> UTILITE_EXP uHex2Bytes(const std::string & hex); 00218 std::vector<char> UTILITE_EXP uHex2Bytes(const char * hex, int hexLen); 00219 00236 std::string UTILITE_EXP uHex2Str(const std::string & hex); 00237 00250 unsigned char UTILITE_EXP uHex2Ascii(const unsigned char & c, bool rightPart); 00251 00264 unsigned char UTILITE_EXP uAscii2Hex(const unsigned char & c); 00265 00269 std::string UTILITE_EXP uFormatv (const char *fmt, va_list ap); 00270 00274 std::string UTILITE_EXP uFormat (const char *fmt, ...); 00275 00276 #ifdef _WIN32 00277 00281 UTILITE_EXP wchar_t * createWCharFromChar(const char * text); 00282 00287 UTILITE_EXP char * createCharFromWChar(const wchar_t * wText); 00288 #endif 00289 00290 #endif /* UCONVERSION_H */