diff --git a/demo/regress/regex_test.cpp b/demo/regress/regex_test.cpp index fab770b8..328fc707 100644 --- a/demo/regress/regex_test.cpp +++ b/demo/regress/regex_test.cpp @@ -33,9 +33,14 @@ // namespace boost{ +#if defined(__GNUC__) && defined(__BEOS__) +#define ra_it const char* +#define test_char_type char +#else typedef const char* ra_it; -typedef char char_type; -typedef std::basic_string test_string_type; +typedef char test_char_type; +#endif +typedef std::basic_string test_string_type; bool pred1(const match_results&) { return true; } @@ -50,57 +55,57 @@ regbase::flag_type f = regbase::escape_in_lists | regbase::char_classes | regbas | regbase::failbit | regbase::literal | regbase::icase | regbase::nocollate | regbase::basic | regbase::extended | regbase::normal | regbase::emacs | regbase::awk | regbase::grep | regbase::egrep | regbase::sed; -template class reg_expression; +template class reg_expression; template class sub_match; template class match_results; template bool regex_match(ra_it, ra_it, match_results& m, - const reg_expression& e, + const reg_expression& e, unsigned flags); template bool regex_match(ra_it, ra_it, - const reg_expression& e, + const reg_expression& e, unsigned flags); template bool regex_search(ra_it, ra_it, match_results& m, - const reg_expression& e, + const reg_expression& e, unsigned flags); template unsigned int regex_grep(pred1_type, ra_it, ra_it, - const reg_expression& e, + const reg_expression& e, unsigned flags); -template char_type* regex_format(char_type*, +template test_char_type* regex_format(test_char_type*, const match_results& m, - const char_type* fmt, + const test_char_type* fmt, unsigned flags); -template char_type* regex_format(char_type*, +template test_char_type* regex_format(test_char_type*, const match_results& m, const test_string_type& fmt, unsigned flags); -template char_type* regex_merge(char_type*, +template test_char_type* regex_merge(test_char_type*, ra_it, ra_it, - const reg_expression&, - const char_type*, + const reg_expression&, + const test_char_type*, unsigned int flags); -template char_type* regex_merge(char_type*, +template test_char_type* regex_merge(test_char_type*, ra_it, ra_it, - const reg_expression& e, + const reg_expression& e, const test_string_type&, unsigned int flags); template std::size_t regex_split(test_string_type*, test_string_type&, - const reg_expression&, + const reg_expression&, unsigned flags, std::size_t); template std::size_t regex_split(test_string_type*, test_string_type& s, - const reg_expression& e, + const reg_expression& e, unsigned flags); template std::size_t regex_split(test_string_type*, test_string_type&); @@ -110,50 +115,50 @@ template std::size_t regex_split(test_string_type*, test_string_type&); // the following prototypes are only available if partial ordering // of template functions is supported: // -template bool regex_match(const char_type*, - match_results& m, - const reg_expression& e, +template bool regex_match(const test_char_type*, + match_results& m, + const reg_expression& e, unsigned flags); template bool regex_match(const test_string_type&, match_results&, - const reg_expression&, + const reg_expression&, unsigned flags); -template bool regex_match(const char_type*, - const reg_expression&, +template bool regex_match(const test_char_type*, + const reg_expression&, unsigned flags); template bool regex_match(const test_string_type&, - const reg_expression&, + const reg_expression&, unsigned flags); -template bool regex_search(const char_type*, - match_results&, - const reg_expression&, +template bool regex_search(const test_char_type*, + match_results&, + const reg_expression&, unsigned flags); template bool regex_search(const test_string_type&, match_results&, - const reg_expression&, + const reg_expression&, unsigned flags); template unsigned int regex_grep(pred1_type, - const char_type*, - const reg_expression&, + const test_char_type*, + const reg_expression&, unsigned flags); template unsigned int regex_grep(pred2_type, const test_string_type&, - const reg_expression&, + const reg_expression&, unsigned flags); template test_string_type regex_format (const match_results& m, - const char_type*, + const test_char_type*, unsigned flags); template test_string_type regex_format (const match_results&, const test_string_type&, unsigned flags); template test_string_type regex_merge(const test_string_type&, - const reg_expression&, - const char_type*, + const reg_expression&, + const test_char_type*, unsigned int flags); template test_string_type regex_merge(const test_string_type&, - const reg_expression&, + const reg_expression&, const test_string_type&, unsigned int flags); diff --git a/demo/regress/regress.h b/demo/regress/regress.h index 145aa9c4..806905ae 100644 --- a/demo/regress/regress.h +++ b/demo/regress/regress.h @@ -287,6 +287,11 @@ struct debug_iterator : public BOOST_RE_RA_ITERATOR(T, std::ptrdiff_t) bool operator<(const self& x) const { return (cur < x.cur); } + friend self operator+(difference_type n, const self& i) + { + self tmp = i; + return tmp += n; + } }; #if defined(__SGI_STL_PORT) && (__SGI_STL_PORT >= 0x400) diff --git a/include/boost/re_detail/fileiter.hpp b/include/boost/re_detail/fileiter.hpp index 6e2e7418..2c6ec4ce 100644 --- a/include/boost/re_detail/fileiter.hpp +++ b/include/boost/re_detail/fileiter.hpp @@ -250,6 +250,12 @@ public: assert(node < file->_last); return file ? *(*node + sizeof(int) + offset) : char(0); } + char operator[] (long off)const + { + mapfile_iterator tmp(*this); + tmp += off; + return *tmp; + } mapfile_iterator& operator++ (); mapfile_iterator operator++ (int); mapfile_iterator& operator-- (); @@ -280,8 +286,25 @@ public: { return i.position() < j.position(); } + friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() > j.position(); + } + friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() <= j.position(); + } + friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j) + { + return i.position() >= j.position(); + } friend mapfile_iterator operator + (const mapfile_iterator& i, long off); + friend mapfile_iterator operator + (long off, const mapfile_iterator& i) + { + mapfile_iterator tmp(i); + return tmp += off; + } friend mapfile_iterator operator - (const mapfile_iterator& i, long off); friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j) {