From 8286ac511144e4f17d34eac9affb97e50646344a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:25:44 +0200 Subject: Imported Upstream version 4.0.0 --- libbackend-elements/backend-elements/regex.hxx | 208 ------------------------- 1 file changed, 208 deletions(-) delete mode 100644 libbackend-elements/backend-elements/regex.hxx (limited to 'libbackend-elements/backend-elements/regex.hxx') diff --git a/libbackend-elements/backend-elements/regex.hxx b/libbackend-elements/backend-elements/regex.hxx deleted file mode 100644 index 9dc6024..0000000 --- a/libbackend-elements/backend-elements/regex.hxx +++ /dev/null @@ -1,208 +0,0 @@ -// file : backend-elements/regex.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef BACKEND_ELEMENTS_REGEX_HXX -#define BACKEND_ELEMENTS_REGEX_HXX - -#include - -#include - -#include - -namespace BackendElements -{ - namespace Regex - { - template - struct Format - { - Format (StringTemplate const& expression, - StringTemplate const& description) - : expression_ (expression), description_ (description) - { - } - - StringTemplate const& - expression () const - { - return expression_; - } - - StringTemplate const& - description () const - { - return description_; - } - - private: - StringTemplate expression_; - StringTemplate description_; - }; - - // Regex pattern. - // - template - struct Pattern - { - Pattern () - { - } - - Pattern (Char const* p) - { - init (StringTemplate (p)); - } - - Pattern (StringTemplate const& p) - { - init (p); - } - - Pattern& - operator= (Char const* p) - { - init (StringTemplate (p)); - return *this; - } - - Pattern& - operator= (StringTemplate const& p) - { - init (p); - return *this; - } - - public: - Boolean - match (StringTemplate const& s) const - { - return regex_match (s, pat_, boost::format_all); - } - - StringTemplate - merge (StringTemplate const& sub, - StringTemplate const& s, - Boolean first_only = false) const - { - if (first_only) - return regex_merge ( - s, pat_, sub, boost::format_all | boost::format_first_only); - else - return regex_merge ( s, pat_, sub, boost::format_all); - } - - public: - Boolean - empty () const - { - return pat_.empty (); - } - - public: - boost::basic_regex const& - impl_pattern () const - { - return pat_; - } - - private: - Void - init (StringTemplate const& r); - - private: - boost::basic_regex pat_; - }; - - template - inline std::basic_ostream& - operator<< (std::basic_ostream& os, Pattern const& p) - { - return os << p.impl_pattern ().str ().c_str (); - } - - // Regex expression: '/pattern/substitution/'. - // - template - struct Expression - { - Expression () - { - } - - // Expression is of the form /regex/format/ where '/' can be - // replaced with any delimiter. - // - Expression (Char const* e) - { - init (StringTemplate (e)); - } - - Expression (StringTemplate const& e) - { - init (e); - } - - Expression& - operator= (Char const* e) - { - init (StringTemplate (e)); - return *this; - } - - Expression& - operator= (StringTemplate const& e) - { - init (e); - return *this; - } - - public: - Boolean - match (StringTemplate const& s) const - { - return pat_.match (s); - } - - StringTemplate - merge (StringTemplate const& s, Boolean first_only = false) const - { - return pat_.merge (sub_, s, first_only); - } - - public: - const Pattern& - pattern () const - { - return pat_; - } - - const StringTemplate& - substitution () const - { - return sub_; - } - - public: - Boolean - empty () const - { - return pat_.empty () && sub_.empty (); - } - - private: - Void - init (StringTemplate const& r); - - private: - Pattern pat_; - StringTemplate sub_; - }; - } -} - -#include - -#endif // BACKEND_ELEMENTS_REGEX_HXX -- cgit v1.2.3