Update of /cvsroot/boost/boost/boost/xpressive/detail/core
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16356/detail/core
Modified Files:
access.hpp regex_impl.hpp state.hpp
Log Message:
support for format_perl
Index: access.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/access.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- access.hpp 12 Mar 2007 22:11:29 -0000 1.5
+++ access.hpp 18 Mar 2007 00:29:11 -0000 1.6
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
-// accesss.hpp
+// access.hpp
//
// Copyright 2004 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -26,6 +26,8 @@
template<typename BidiIter>
struct core_access
{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
static std::size_t get_hidden_mark_count(basic_regex<BidiIter> const &rex)
{
return proto::arg(rex)->hidden_mark_count_;
@@ -72,11 +74,12 @@
(
match_results<BidiIter> &what
, regex_id_type regex_id
+ , intrusive_ptr<traits<char_type> const> const &traits
, sub_match_impl<BidiIter> *sub_matches
, std::size_t size
)
{
- what.init_(regex_id, sub_matches, size);
+ what.init_(regex_id, traits, sub_matches, size);
}
static sub_match_vector<BidiIter>
&get_sub_match_vector(match_results<BidiIter> &what)
Index: regex_impl.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/regex_impl.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- regex_impl.hpp 18 Apr 2006 20:54:15 -0000 1.7
+++ regex_impl.hpp 18 Mar 2007 00:29:11 -0000 1.8
@@ -34,18 +34,25 @@
///////////////////////////////////////////////////////////////////////////////
// traits
+template<typename Char>
struct traits
- : counted_base<traits>
+ : counted_base<traits<Char> >
{
virtual ~traits() {}
+ virtual Char tolower(Char ch) const = 0;
+ virtual Char toupper(Char ch) const = 0;
+ virtual bool in_range(Char from, Char to, Char ch) const = 0;
+ virtual int value(Char ch, int radix) const = 0;
};
///////////////////////////////////////////////////////////////////////////////
// traits_holder
template<typename Traits>
struct traits_holder
- : traits
+ : traits<typename Traits::char_type>
{
+ typedef typename Traits::char_type char_type;
+
explicit traits_holder(Traits const &traits)
: traits_(traits)
{
@@ -55,7 +62,48 @@
{
return this->traits_;
}
+
+ char_type tolower(char_type ch) const
+ {
+ return this->tolower_(ch, typename Traits::version_tag());
+ }
+
+ char_type toupper(char_type ch) const
+ {
+ return this->toupper_(ch, typename Traits::version_tag());
+ }
+
+ int value(char_type ch, int radix) const
+ {
+ return this->traits_.value(ch, radix);
+ }
+
+ bool in_range(char_type from, char_type to, char_type ch) const
+ {
+ return this->traits_.in_range(from, to, ch);
+ }
+
private:
+ char_type tolower_(char_type ch, regex_traits_version_1_tag) const
+ {
+ return ch;
+ }
+
+ char_type toupper_(char_type ch, regex_traits_version_1_tag) const
+ {
+ return ch;
+ }
+
+ char_type tolower_(char_type ch, regex_traits_version_2_tag) const
+ {
+ return this->traits_.tolower(ch);
+ }
+
+ char_type toupper_(char_type ch, regex_traits_version_2_tag) const
+ {
+ return this->traits_.toupper(ch);
+ }
+
Traits traits_;
};
@@ -112,7 +160,7 @@
}
intrusive_ptr<matchable_ex<BidiIter> const> xpr_;
- intrusive_ptr<traits const> traits_;
+ intrusive_ptr<traits<char_type> const> traits_;
intrusive_ptr<finder<BidiIter> > finder_;
std::size_t mark_count_;
std::size_t hidden_mark_count_;
Index: state.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/state.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- state.hpp 4 Mar 2007 18:07:03 -0000 1.9
+++ state.hpp 18 Mar 2007 00:29:11 -0000 1.10
@@ -31,6 +31,8 @@
template<typename BidiIter>
struct match_context
{
+ typedef typename iterator_value<BidiIter>::type char_type;
+
match_context()
: results_ptr_(0)
, prev_context_(0)
@@ -49,7 +51,7 @@
matchable<BidiIter> const *next_ptr_;
// A pointer to the current traits object
- detail::traits const *traits_;
+ detail::traits<char_type> const *traits_;
};
///////////////////////////////////////////////////////////////////////////////
@@ -265,7 +267,7 @@
this->sub_matches_ += impl.hidden_mark_count_;
// initialize the match_results struct
- access::init_match_results(what, id, this->sub_matches_,
this->mark_count_);
+ access::init_match_results(what, id, impl.traits_, this->sub_matches_,
this->mark_count_);
}
void uninit_(regex_impl const &impl, match_results &)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs