2014-04-13 12:21:30 +02:00
|
|
|
#ifndef REGEX_REPLACEMENT_HDR
|
|
|
|
#define REGEX_REPLACEMENT_HDR
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "concordia/common/config.hpp"
|
|
|
|
#include "concordia/concordia_exception.hpp"
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <boost/regex.hpp>
|
2014-04-24 08:36:48 +02:00
|
|
|
#include <boost/regex/icu.hpp>
|
2014-04-13 12:21:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Class for replacing string occurences.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2014-04-29 14:46:04 +02:00
|
|
|
typedef boost::error_info<struct my_tag, std::string> my_tag_error_info;
|
2014-04-13 12:21:30 +02:00
|
|
|
|
|
|
|
class RegexReplacement {
|
|
|
|
public:
|
2015-04-15 14:14:10 +02:00
|
|
|
RegexReplacement(std::string patternString, std::string replacement,
|
|
|
|
bool caseSensitive = true)
|
|
|
|
throw(ConcordiaException);
|
2014-04-13 12:21:30 +02:00
|
|
|
|
|
|
|
/*! Destructor.
|
|
|
|
*/
|
|
|
|
virtual ~RegexReplacement();
|
2014-04-29 14:46:04 +02:00
|
|
|
|
2015-04-15 14:14:10 +02:00
|
|
|
std::string apply(const std::string & text);
|
2014-04-13 12:21:30 +02:00
|
|
|
|
|
|
|
private:
|
2014-04-24 08:36:48 +02:00
|
|
|
boost::u32regex _pattern;
|
2014-04-29 14:46:04 +02:00
|
|
|
|
2015-04-15 14:14:10 +02:00
|
|
|
std::string _replacement;
|
2014-04-13 12:21:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|