3
// This file is part of Bombono DVD project.
5
// Copyright (c) 2010 Ilya Murav'jov
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program; if not, write to the Free Software
19
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
#include <boost/regex.hpp>
32
struct pattern::impl: public boost::regex
34
typedef boost::regex base_t;
36
explicit impl(const char* p, flag_type f): base_t(p, f) {}
39
pattern::pattern(const char* p, flag_type f): pimpl_(new impl(p, f)) {}
41
pattern::~pattern() {}
46
struct match_results::impl: public boost::smatch
48
typedef boost::smatch base_t;
51
match_results::match_results(): pimpl_(new impl) {}
53
match_results::~match_results() {}
55
match_results::size_type match_results::size() const
57
return pimpl_->size();
60
sub_match match_results::operator[](int sub) const
62
boost::smatch::const_reference pimpl_res = (*pimpl_)[sub];
65
res.matched = pimpl_res.matched;
66
res.first = pimpl_res.first;
67
res.second = pimpl_res.second;
73
// ~ boost::regex_match()
75
bool match(const std::string& s,
78
match_flag_type flags)
80
return boost::regex_match(s, *m.pimpl_, *e.pimpl_, flags);
84
// ~ boost::regex_search()
86
bool search(const_iterator beg, const_iterator end,
89
match_flag_type flags)
91
return boost::regex_search(beg, end, *m.pimpl_, *e.pimpl_, flags);