[Positioning] PosUtil: add string functions

Add PosUtil::to_upper(string) and PosUtil::assert_uppercase(string).
This commit is contained in:
Matteo Cypriani 2011-06-29 11:32:13 +02:00
parent 05859da49b
commit e9e8308a9c
1 changed files with 29 additions and 0 deletions

View File

@ -4,6 +4,7 @@
class Measurement ;
#include <boost/tr1/unordered_map.hpp>
#include <boost/algorithm/string/case_conv.hpp>
/// Utilitary class
class PosUtil
@ -29,6 +30,34 @@ public:
/// Converts a Wi-Fi channel to the corresponding frequency in Hz
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_