UConversion.h
Go to the documentation of this file.
1 /*
2 * utilite is a cross-platform library with
3 * useful utilities for fast and small developing.
4 * Copyright (C) 2010 Mathieu Labbe
5 *
6 * utilite is free library: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * utilite is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef UCONVERSION_H
21 #define UCONVERSION_H
22 
23 #include "rtabmap/utilite/utilite_export.h" // DLL export/import defines
24 
25 #include <string>
26 #include <vector>
27 #include <stdarg.h>
28 
51 std::string UTILITE_EXPORT uReplaceChar(const std::string & str, char before, char after);
52 
67 std::string UTILITE_EXPORT uReplaceChar(const std::string & str, char before, const std::string & after);
68 
80 std::string UTILITE_EXPORT uToUpperCase(const std::string & str);
81 
93 std::string UTILITE_EXPORT uToLowerCase(const std::string & str);
94 
100 std::string UTILITE_EXPORT uNumber2Str(unsigned int number);
106 std::string UTILITE_EXPORT uNumber2Str(int number);
112 std::string UTILITE_EXPORT uNumber2Str(float number, int precision=6, bool fixed = false);
118 std::string UTILITE_EXPORT uNumber2Str(double number, int precision=6, bool fixed = false);
119 
125 int UTILITE_EXPORT uStr2Int(const std::string & str);
126 
132 float UTILITE_EXPORT uStr2Float(const std::string & str);
133 
139 double UTILITE_EXPORT uStr2Double(const std::string & str);
140 
141 
148 std::string UTILITE_EXPORT uBool2Str(bool boolean);
156 bool UTILITE_EXPORT uStr2Bool(const char * str);
157 bool UTILITE_EXPORT uStr2Bool(const std::string & str);
158 
164 std::vector<unsigned char> UTILITE_EXPORT uStr2Bytes(const std::string & str);
165 
171 std::string UTILITE_EXPORT uBytes2Str(const std::vector<unsigned char> & bytes);
172 
188 std::string UTILITE_EXPORT uBytes2Hex(const char * bytes, unsigned int bytesLen);
203 std::vector<char> UTILITE_EXPORT uHex2Bytes(const std::string & hex);
218 std::vector<char> UTILITE_EXPORT uHex2Bytes(const char * hex, int hexLen);
219 
236 std::string UTILITE_EXPORT uHex2Str(const std::string & hex);
237 
250 unsigned char UTILITE_EXPORT uHex2Ascii(const unsigned char & c, bool rightPart);
251 
264 unsigned char UTILITE_EXPORT uAscii2Hex(const unsigned char & c);
265 
269 std::string UTILITE_EXPORT uFormatv (const char *fmt, va_list ap);
270 
274 std::string UTILITE_EXPORT uFormat (const char *fmt, ...);
275 
276 #ifdef _WIN32
277 
281 UTILITE_EXPORT wchar_t * createWCharFromChar(const char * text);
282 
287 UTILITE_EXPORT char * createCharFromWChar(const wchar_t * wText);
288 #endif
289 
290 #endif /* UCONVERSION_H */
uHex2Ascii
unsigned char UTILITE_EXPORT uHex2Ascii(const unsigned char &c, bool rightPart)
Definition: UConversion.cpp:276
bytes
uToLowerCase
std::string UTILITE_EXPORT uToLowerCase(const std::string &str)
Definition: UConversion.cpp:77
uFormatv
std::string UTILITE_EXPORT uFormatv(const char *fmt, va_list ap)
Definition: UConversion.cpp:322
uStr2Bool
bool UTILITE_EXPORT uStr2Bool(const char *str)
Definition: UConversion.cpp:170
uStr2Bytes
std::vector< unsigned char > UTILITE_EXPORT uStr2Bytes(const std::string &str)
Definition: UConversion.cpp:180
uStr2Double
double UTILITE_EXPORT uStr2Double(const std::string &str)
Definition: UConversion.cpp:147
uAscii2Hex
unsigned char UTILITE_EXPORT uAscii2Hex(const unsigned char &c)
Definition: UConversion.cpp:288
uHex2Str
std::string UTILITE_EXPORT uHex2Str(const std::string &hex)
Definition: UConversion.cpp:250
uNumber2Str
std::string UTILITE_EXPORT uNumber2Str(unsigned int number)
Definition: UConversion.cpp:91
glm::precision
precision
Definition: precision.hpp:33
str
uFormat
std::string UTILITE_EXPORT uFormat(const char *fmt,...)
Definition: UConversion.cpp:365
uBytes2Str
std::string UTILITE_EXPORT uBytes2Str(const std::vector< unsigned char > &bytes)
Definition: UConversion.cpp:188
uReplaceChar
std::string UTILITE_EXPORT uReplaceChar(const std::string &str, char before, char after)
Definition: UConversion.cpp:33
uStr2Int
int UTILITE_EXPORT uStr2Int(const std::string &str)
Definition: UConversion.cpp:125
uBytes2Hex
std::string UTILITE_EXPORT uBytes2Hex(const char *bytes, unsigned int bytesLen)
Definition: UConversion.cpp:203
uToUpperCase
std::string UTILITE_EXPORT uToUpperCase(const std::string &str)
Definition: UConversion.cpp:63
uStr2Float
float UTILITE_EXPORT uStr2Float(const std::string &str)
Definition: UConversion.cpp:138
uHex2Bytes
std::vector< char > UTILITE_EXPORT uHex2Bytes(const std::string &hex)
Definition: UConversion.cpp:223
uBool2Str
std::string UTILITE_EXPORT uBool2Str(bool boolean)
Definition: UConversion.cpp:156


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:23