]> git.lyx.org Git - features.git/blobdiff - boost/boost/regex/concepts.hpp
update boost to 1.44
[features.git] / boost / boost / regex / concepts.hpp
index fa2ea48c92886b3d4b4ade9ab278dff8b57676a6..6ef8864274332ea81f2a36d19f213f64f5262d66 100644 (file)
@@ -76,6 +76,49 @@ namespace std{
       typedef boost::char_architype char_type;
    };
 }
+//
+// Allocator architype:
+//
+template <class T>
+class allocator_architype
+{
+public:
+   typedef T* pointer;
+   typedef const T* const_pointer;
+   typedef T& reference;
+   typedef const T& const_reference;
+   typedef T value_type;
+   typedef unsigned size_type;
+   typedef int difference_type;
+
+   template <class U>
+   struct rebind
+   {
+      typedef allocator_architype<U> other;
+   };
+
+   pointer address(reference r);
+   const_pointer address(const_reference r);
+   pointer allocate(size_type);
+   pointer allocate(size_type, pointer);
+   void deallocate(pointer, size_type);
+   size_type max_size()const;
+
+   allocator_architype();
+   allocator_architype(const allocator_architype&);
+
+   template <class Other>
+   allocator_architype(const allocator_architype<Other>&);
+
+   void construct(pointer, const_reference);
+   void destroy(pointer);
+};
+
+template <class T>
+bool operator == (const allocator_architype<T>&, const allocator_architype<T>&);
+template <class T>
+bool operator != (const allocator_architype<T>&, const allocator_architype<T>&);
+
 namespace boost{
 //
 // regex_traits_architype:
@@ -244,7 +287,8 @@ struct BaseRegexConcept
    typedef const value_type* pointer_type;
    typedef bidirectional_iterator_archetype<value_type> BidiIterator;
    typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
-   typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
+   typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
+   typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
    typedef output_iterator_archetype<value_type> OutIterator;
    typedef typename regex_traits_computer<Regex>::type traits_type;
    typedef global_regex_namespace::regex_iterator<BidiIterator, value_type, traits_type> regex_iterator_type;
@@ -318,7 +362,7 @@ struct BaseRegexConcept
       const global_regex_namespace::regex_error except(e1);
       e1 = except.code();
 
-      typedef typename Regex::value_type value_type;
+      typedef typename Regex::value_type regex_value_type;
       function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
       function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
    }
@@ -484,10 +528,10 @@ struct BaseRegexConcept
       typedef typename regex_iterator_type::reference rit_reference;
       typedef typename regex_iterator_type::iterator_category rit_iterator_category;
       BOOST_STATIC_ASSERT((::boost::is_same<rit_regex_type, Regex>::value));
-      BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_type>::value));
+      BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_default_type>::value));
       BOOST_STATIC_ASSERT((::boost::is_same<rit_difference_type, std::ptrdiff_t>::value));
-      BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_type*>::value));
-      BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_type&>::value));
+      BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_default_type*>::value));
+      BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_default_type&>::value));
       BOOST_STATIC_ASSERT((::boost::is_convertible<rit_iterator_category*, std::forward_iterator_tag*>::value));
       // this takes care of most of the checks needed:
       function_requires<ForwardIteratorConcept<regex_iterator_type> >();
@@ -540,7 +584,10 @@ struct BaseRegexConcept
    OutIterator m_out;
    BidiIterator m_in;
    global_regex_namespace::regex_constants::match_flag_type m_mft;
-   global_regex_namespace::match_results<pointer_type> m_pmatch;
+   global_regex_namespace::match_results<
+      pointer_type, 
+      allocator_architype<global_regex_namespace::sub_match<pointer_type> > > 
+      m_pmatch;
 
    BaseRegexConcept();
    BaseRegexConcept(const BaseRegexConcept&);
@@ -564,7 +611,7 @@ struct RegexConcept
    typedef std::basic_string<value_type> string_type;
    typedef boost::bidirectional_iterator_archetype<value_type> BidiIterator;
    typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
-   typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
+   typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
    typedef output_iterator_archetype<value_type> OutIterator;
 
 
@@ -739,7 +786,7 @@ struct RegexConcept
    OutIterator m_out;
    BidiIterator m_in;
    global_regex_namespace::regex_constants::match_flag_type m_mft;
-   global_regex_namespace::match_results<typename string_type::const_iterator> m_smatch;
+   global_regex_namespace::match_results<typename string_type::const_iterator, allocator_architype<global_regex_namespace::sub_match<typename string_type::const_iterator> > > m_smatch;
 
    RegexConcept();
    RegexConcept(const RegexConcept&);
@@ -752,7 +799,7 @@ template <class M>
 struct functor1
 {
    typedef typename M::char_type char_type;
-   const char_type* operator()(const M&)
+   const char_type* operator()(const M&)const
    {
       static const char_type c = static_cast<char_type>(0);
       return &c;
@@ -762,7 +809,7 @@ template <class M>
 struct functor1b
 {
    typedef typename M::char_type char_type;
-   std::vector<char_type> operator()(const M&)
+   std::vector<char_type> operator()(const M&)const
    {
       static const std::vector<char_type> c;
       return c;
@@ -772,7 +819,7 @@ template <class M>
 struct functor2
 {
    template <class O>
-   O operator()(const M& /*m*/, O i)
+   O operator()(const M& /*m*/, O i)const
    {
       return i;
    }
@@ -781,7 +828,7 @@ template <class M>
 struct functor3
 {
    template <class O>
-   O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)
+   O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)const
    {
       return i;
    }
@@ -806,7 +853,8 @@ struct BoostRegexConcept
    typedef bidirectional_iterator_archetype<value_type> BidiIterator;
    typedef output_iterator_archetype<value_type> OutputIterator;
    typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
-   typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
+   typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
+   typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
 
    void constraints() 
    {
@@ -930,36 +978,90 @@ struct BoostRegexConcept
       //
       regex_constants::match_flag_type f = regex_constants::match_default;
       OutputIterator out = static_object<OutputIterator>::get();
-      functor3<match_results_type> func3;
-      out = regex_format(out, m_cresults, func3, f);
-      out = regex_format(out, m_cresults, func3);
-      functor2<match_results_type> func2;
-      out = regex_format(out, m_cresults, func2, f);
-      out = regex_format(out, m_cresults, func2);
-      functor1<match_results_type> func1;
-      out = regex_format(out, m_cresults, func1, f);
-      out = regex_format(out, m_cresults, func1);
-
-      m_string += regex_format(m_cresults, func3, f);
-      m_string += regex_format(m_cresults, func3);
-      m_string += regex_format(m_cresults, func2, f);
-      m_string += regex_format(m_cresults, func2);
-      m_string += regex_format(m_cresults, func1, f);
-      m_string += regex_format(m_cresults, func1);
-
-      out = m_cresults.format(out, func3, f);
-      out = m_cresults.format(out, func3);
-      out = m_cresults.format(out, func2, f);
-      out = m_cresults.format(out, func2);
-      out = m_cresults.format(out, func1, f);
-      out = m_cresults.format(out, func1);
-
-      m_string += m_cresults.format(func3, f);
-      m_string += m_cresults.format(func3);
-      m_string += m_cresults.format(func2, f);
-      m_string += m_cresults.format(func2);
-      m_string += m_cresults.format(func1, f);
-      m_string += m_cresults.format(func1);
+      
+      functor3<match_results_default_type> func3;
+      functor2<match_results_default_type> func2;
+      functor1<match_results_default_type> func1;
+      
+      functor3<match_results_type> func3b;
+      functor2<match_results_type> func2b;
+      functor1<match_results_type> func1b;
+
+      out = regex_format(out, m_cresults, func3b, f);
+      out = regex_format(out, m_cresults, func3b);
+      out = regex_format(out, m_cresults, func2b, f);
+      out = regex_format(out, m_cresults, func2b);
+      out = regex_format(out, m_cresults, func1b, f);
+      out = regex_format(out, m_cresults, func1b);
+      out = regex_format(out, m_cresults, boost::ref(func3b), f);
+      out = regex_format(out, m_cresults, boost::ref(func3b));
+      out = regex_format(out, m_cresults, boost::ref(func2b), f);
+      out = regex_format(out, m_cresults, boost::ref(func2b));
+      out = regex_format(out, m_cresults, boost::ref(func1b), f);
+      out = regex_format(out, m_cresults, boost::ref(func1b));
+      out = regex_format(out, m_cresults, boost::cref(func3b), f);
+      out = regex_format(out, m_cresults, boost::cref(func3b));
+      out = regex_format(out, m_cresults, boost::cref(func2b), f);
+      out = regex_format(out, m_cresults, boost::cref(func2b));
+      out = regex_format(out, m_cresults, boost::cref(func1b), f);
+      out = regex_format(out, m_cresults, boost::cref(func1b));
+
+      m_string += regex_format(m_cresults, func3b, f);
+      m_string += regex_format(m_cresults, func3b);
+      m_string += regex_format(m_cresults, func2b, f);
+      m_string += regex_format(m_cresults, func2b);
+      m_string += regex_format(m_cresults, func1b, f);
+      m_string += regex_format(m_cresults, func1b);
+      m_string += regex_format(m_cresults, boost::ref(func3b), f);
+      m_string += regex_format(m_cresults, boost::ref(func3b));
+      m_string += regex_format(m_cresults, boost::ref(func2b), f);
+      m_string += regex_format(m_cresults, boost::ref(func2b));
+      m_string += regex_format(m_cresults, boost::ref(func1b), f);
+      m_string += regex_format(m_cresults, boost::ref(func1b));
+      m_string += regex_format(m_cresults, boost::cref(func3b), f);
+      m_string += regex_format(m_cresults, boost::cref(func3b));
+      m_string += regex_format(m_cresults, boost::cref(func2b), f);
+      m_string += regex_format(m_cresults, boost::cref(func2b));
+      m_string += regex_format(m_cresults, boost::cref(func1b), f);
+      m_string += regex_format(m_cresults, boost::cref(func1b));
+
+      out = m_cresults.format(out, func3b, f);
+      out = m_cresults.format(out, func3b);
+      out = m_cresults.format(out, func2b, f);
+      out = m_cresults.format(out, func2b);
+      out = m_cresults.format(out, func1b, f);
+      out = m_cresults.format(out, func1b);
+      out = m_cresults.format(out, boost::ref(func3b), f);
+      out = m_cresults.format(out, boost::ref(func3b));
+      out = m_cresults.format(out, boost::ref(func2b), f);
+      out = m_cresults.format(out, boost::ref(func2b));
+      out = m_cresults.format(out, boost::ref(func1b), f);
+      out = m_cresults.format(out, boost::ref(func1b));
+      out = m_cresults.format(out, boost::cref(func3b), f);
+      out = m_cresults.format(out, boost::cref(func3b));
+      out = m_cresults.format(out, boost::cref(func2b), f);
+      out = m_cresults.format(out, boost::cref(func2b));
+      out = m_cresults.format(out, boost::cref(func1b), f);
+      out = m_cresults.format(out, boost::cref(func1b));
+
+      m_string += m_cresults.format(func3b, f);
+      m_string += m_cresults.format(func3b);
+      m_string += m_cresults.format(func2b, f);
+      m_string += m_cresults.format(func2b);
+      m_string += m_cresults.format(func1b, f);
+      m_string += m_cresults.format(func1b);
+      m_string += m_cresults.format(boost::ref(func3b), f);
+      m_string += m_cresults.format(boost::ref(func3b));
+      m_string += m_cresults.format(boost::ref(func2b), f);
+      m_string += m_cresults.format(boost::ref(func2b));
+      m_string += m_cresults.format(boost::ref(func1b), f);
+      m_string += m_cresults.format(boost::ref(func1b));
+      m_string += m_cresults.format(boost::cref(func3b), f);
+      m_string += m_cresults.format(boost::cref(func3b));
+      m_string += m_cresults.format(boost::cref(func2b), f);
+      m_string += m_cresults.format(boost::cref(func2b));
+      m_string += m_cresults.format(boost::cref(func1b), f);
+      m_string += m_cresults.format(boost::cref(func1b));
 
       out = regex_replace(out, m_in, m_in, ce, func3, f);
       out = regex_replace(out, m_in, m_in, ce, func3);
@@ -967,6 +1069,18 @@ struct BoostRegexConcept
       out = regex_replace(out, m_in, m_in, ce, func2);
       out = regex_replace(out, m_in, m_in, ce, func1, f);
       out = regex_replace(out, m_in, m_in, ce, func1);
+      out = regex_replace(out, m_in, m_in, ce, boost::ref(func3), f);
+      out = regex_replace(out, m_in, m_in, ce, boost::ref(func3));
+      out = regex_replace(out, m_in, m_in, ce, boost::ref(func2), f);
+      out = regex_replace(out, m_in, m_in, ce, boost::ref(func2));
+      out = regex_replace(out, m_in, m_in, ce, boost::ref(func1), f);
+      out = regex_replace(out, m_in, m_in, ce, boost::ref(func1));
+      out = regex_replace(out, m_in, m_in, ce, boost::cref(func3), f);
+      out = regex_replace(out, m_in, m_in, ce, boost::cref(func3));
+      out = regex_replace(out, m_in, m_in, ce, boost::cref(func2), f);
+      out = regex_replace(out, m_in, m_in, ce, boost::cref(func2));
+      out = regex_replace(out, m_in, m_in, ce, boost::cref(func1), f);
+      out = regex_replace(out, m_in, m_in, ce, boost::cref(func1));
 
       functor3<match_results<typename string_type::const_iterator> > func3s;
       functor2<match_results<typename string_type::const_iterator> > func2s;
@@ -977,6 +1091,18 @@ struct BoostRegexConcept
       m_string += regex_replace(m_string, ce, func2s);
       m_string += regex_replace(m_string, ce, func1s, f);
       m_string += regex_replace(m_string, ce, func1s);
+      m_string += regex_replace(m_string, ce, boost::ref(func3s), f);
+      m_string += regex_replace(m_string, ce, boost::ref(func3s));
+      m_string += regex_replace(m_string, ce, boost::ref(func2s), f);
+      m_string += regex_replace(m_string, ce, boost::ref(func2s));
+      m_string += regex_replace(m_string, ce, boost::ref(func1s), f);
+      m_string += regex_replace(m_string, ce, boost::ref(func1s));
+      m_string += regex_replace(m_string, ce, boost::cref(func3s), f);
+      m_string += regex_replace(m_string, ce, boost::cref(func3s));
+      m_string += regex_replace(m_string, ce, boost::cref(func2s), f);
+      m_string += regex_replace(m_string, ce, boost::cref(func2s));
+      m_string += regex_replace(m_string, ce, boost::cref(func1s), f);
+      m_string += regex_replace(m_string, ce, boost::cref(func1s));
    }
 
    std::basic_ostream<value_type> m_stream;