[Positioning] PosUtil: add string functions
Add PosUtil::to_upper(string) and PosUtil::assert_uppercase(string).
This commit is contained in:
parent
05859da49b
commit
e9e8308a9c
|
@ -4,6 +4,7 @@
|
||||||
class Measurement ;
|
class Measurement ;
|
||||||
|
|
||||||
#include <boost/tr1/unordered_map.hpp>
|
#include <boost/tr1/unordered_map.hpp>
|
||||||
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
|
|
||||||
/// Utilitary class
|
/// Utilitary class
|
||||||
class PosUtil
|
class PosUtil
|
||||||
|
@ -29,6 +30,34 @@ public:
|
||||||
/// Converts a Wi-Fi channel to the corresponding frequency in Hz
|
/// Converts a Wi-Fi channel to the corresponding frequency in Hz
|
||||||
static unsigned long wifi_channel_to_hz(const unsigned long &channel) ;
|
static unsigned long wifi_channel_to_hz(const unsigned long &channel) ;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
/** @name Strings */
|
||||||
|
//@{
|
||||||
|
static void to_upper(std::string &str) ;
|
||||||
|
static void assert_uppercase(const std::string &str) ;
|
||||||
|
//@}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* *** Strings *** */
|
||||||
|
|
||||||
|
|
||||||
|
inline void PosUtil::to_upper(std::string &str)
|
||||||
|
{
|
||||||
|
boost::to_upper(str) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void PosUtil::assert_uppercase(const std::string &str)
|
||||||
|
{
|
||||||
|
#ifndef NDEBUG
|
||||||
|
std::string str_up(str) ;
|
||||||
|
to_upper(str_up) ;
|
||||||
|
assert(str_up == str) ;
|
||||||
|
#endif // NDEBUG
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _OWLPS_POSITIONING_POSUTIL_HH_
|
#endif // _OWLPS_POSITIONING_POSUTIL_HH_
|
||||||
|
|
Loading…
Reference in New Issue