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 00120 00126 float UTILITE_EXP uStr2Float(const std::string & str); 00127 00133 double UTILITE_EXP uStr2Double(const std::string & str); 00134 00135 00142 std::string UTILITE_EXP uBool2Str(bool boolean); 00150 bool UTILITE_EXP uStr2Bool(const char * str); 00151 00157 std::vector<unsigned char> UTILITE_EXP uStr2Bytes(const std::string & str); 00158 00164 std::string UTILITE_EXP uBytes2Str(const std::vector<unsigned char> & bytes); 00165 00181 std::string UTILITE_EXP uBytes2Hex(const char * bytes, unsigned int bytesLen); 00196 std::vector<char> UTILITE_EXP uHex2Bytes(const std::string & hex); 00211 std::vector<char> UTILITE_EXP uHex2Bytes(const char * hex, int hexLen); 00212 00229 std::string UTILITE_EXP uHex2Str(const std::string & hex); 00230 00243 unsigned char UTILITE_EXP uHex2Ascii(const unsigned char & c, bool rightPart); 00244 00257 unsigned char UTILITE_EXP uAscii2Hex(const unsigned char & c); 00258 00262 std::string UTILITE_EXP uFormatv (const char *fmt, va_list ap); 00263 00267 std::string UTILITE_EXP uFormat (const char *fmt, ...); 00268 00269 #ifdef _WIN32 00270 00274 UTILITE_EXP wchar_t * createWCharFromChar(const char * text); 00275 00280 UTILITE_EXP char * createCharFromWChar(const wchar_t * wText); 00281 #endif 00282 00283 #endif /* UCONVERSION_H */