concordia-library/concordia/common/text_utils.hpp
rjawor e99eb77b28 anonymizing sentences
Former-commit-id: 5d8bd7e16258fda7c02a7cc0e1da589d73418f0d
2014-04-29 14:46:04 +02:00

48 lines
1.3 KiB
C++

#ifndef TEXT_UTILS_HDR
#define TEXT_UTILS_HDR
#include <string>
#include <boost/shared_ptr.hpp>
#include "utf8case/simple_convert.hpp"
#include "utf8case/case_converter_factory.hpp"
#include "utf8case/string_case_converter_manager.hpp"
using namespace std;
/*! Utility class for performing simple string operations.
*/
class TextUtils {
public:
TextUtils();
static TextUtils & getInstance() {
static TextUtils instance; // Guaranteed to be destroyed.
// Instantiated on first use.
return instance;
}
/*! A method for converting all string letters to lower case.
\param text input string
\returns lower case version of the input string.
*/
string toLowerCase(const string & text);
/*! A method for converting all string letters to upper case.
\param text input string
\returns upper case version of the input string.
*/
string toUpperCase(const string & text);
private:
explicit TextUtils(TextUtils const&); // Don't Implement
void operator=(TextUtils const&); // Don't implement
boost::shared_ptr<StringGeneralCaseConverter> _lowerConverter;
boost::shared_ptr<StringGeneralCaseConverter> _upperConverter;
};
#endif