RTAB-Map 0.25.2
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
UConversion.h
Go to the documentation of this file.
1/*
2Copyright (c) 2010, Mathieu Labbe
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the copyright holders nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef UCONVERSION_H
29#define UCONVERSION_H
30
31#include "rtabmap/utilite/utilite_export.h" // DLL export/import defines
32
33#include <string>
34#include <vector>
35#include <stdarg.h>
36
59std::string UTILITE_EXPORT uReplaceChar(const std::string & str, char before, char after);
60
75std::string UTILITE_EXPORT uReplaceChar(const std::string & str, char before, const std::string & after);
76
88std::string UTILITE_EXPORT uToUpperCase(const std::string & str);
89
101std::string UTILITE_EXPORT uToLowerCase(const std::string & str);
102
118std::string UTILITE_EXPORT uNumber2Str(unsigned int number);
119
135std::string UTILITE_EXPORT uNumber2Str(int number);
136
157std::string UTILITE_EXPORT uNumber2Str(float number, int precision=6, bool fixed = false);
158
179std::string UTILITE_EXPORT uNumber2Str(double number, int precision=6, bool fixed = false);
180
186int UTILITE_EXPORT uStr2Int(const std::string & str);
187
193float UTILITE_EXPORT uStr2Float(const std::string & str);
194
200double UTILITE_EXPORT uStr2Double(const std::string & str);
201
202
209std::string UTILITE_EXPORT uBool2Str(bool boolean);
217bool UTILITE_EXPORT uStr2Bool(const char * str);
218bool UTILITE_EXPORT uStr2Bool(const std::string & str);
219
225std::vector<unsigned char> UTILITE_EXPORT uStr2Bytes(const std::string & str);
226
232std::string UTILITE_EXPORT uBytes2Str(const std::vector<unsigned char> & bytes);
233
249std::string UTILITE_EXPORT uBytes2Hex(const char * bytes, unsigned int bytesLen);
264std::vector<char> UTILITE_EXPORT uHex2Bytes(const std::string & hex);
279std::vector<char> UTILITE_EXPORT uHex2Bytes(const char * hex, int hexLen);
280
297std::string UTILITE_EXPORT uHex2Str(const std::string & hex);
298
311unsigned char UTILITE_EXPORT uHex2Ascii(const unsigned char & c, bool rightPart);
312
325unsigned char UTILITE_EXPORT uAscii2Hex(const unsigned char & c);
326
330std::string UTILITE_EXPORT uFormatv (const char *fmt, va_list ap);
331
335std::string UTILITE_EXPORT uFormat (const char *fmt, ...)
336#if defined(__GNUC__) || defined(__clang__)
337 // Compiler-checked format string (see the note on ULogger::write).
338 __attribute__((format(printf, 1, 2)))
339#endif
340 ;
341
342#ifdef _WIN32
347UTILITE_EXPORT wchar_t * createWCharFromChar(const char * text);
348
353UTILITE_EXPORT char * createCharFromWChar(const wchar_t * wText);
354#endif
355
356#endif /* UCONVERSION_H */
std::string UTILITE_EXPORT uBytes2Str(const std::vector< unsigned char > &bytes)
unsigned char UTILITE_EXPORT uHex2Ascii(const unsigned char &c, bool rightPart)
int UTILITE_EXPORT uStr2Int(const std::string &str)
std::string UTILITE_EXPORT uToLowerCase(const std::string &str)
std::string UTILITE_EXPORT uBytes2Hex(const char *bytes, unsigned int bytesLen)
std::string UTILITE_EXPORT uFormat(const char *fmt,...)
unsigned char UTILITE_EXPORT uAscii2Hex(const unsigned char &c)
std::string UTILITE_EXPORT uHex2Str(const std::string &hex)
std::string UTILITE_EXPORT uFormatv(const char *fmt, va_list ap)
double UTILITE_EXPORT uStr2Double(const std::string &str)
std::string UTILITE_EXPORT uNumber2Str(unsigned int number)
std::vector< unsigned char > UTILITE_EXPORT uStr2Bytes(const std::string &str)
float UTILITE_EXPORT uStr2Float(const std::string &str)
std::vector< char > UTILITE_EXPORT uHex2Bytes(const std::string &hex)
bool UTILITE_EXPORT uStr2Bool(const char *str)
std::string UTILITE_EXPORT uReplaceChar(const std::string &str, char before, char after)
std::string UTILITE_EXPORT uBool2Str(bool boolean)
std::string UTILITE_EXPORT uToUpperCase(const std::string &str)