Compare commits

...

4 Commits

Author SHA1 Message Date
2f5daee45b Release 1.46.0
[SVN r69125]
2011-02-21 18:42:22 +00:00
01492a93c6 trunk changes merged
[SVN r67922]
2011-01-10 19:36:38 +00:00
50703b8c97 Merge documentation fixes to release.
[SVN r66285]
2010-10-30 17:34:45 +00:00
0f8d556130 Merge r65004 from trunk
Fix #4551,#4553,#4575 by removing unused parameter.



[SVN r65168]
2010-09-01 16:18:07 +00:00
6 changed files with 79 additions and 51 deletions

View File

@ -74,17 +74,17 @@ namespace boost {
const InputT& Input, const InputT& Input,
FormatterT Formatter, FormatterT Formatter,
const FindResultT& FindResult ) const FindResultT& FindResult )
{ {
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) { if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
return ::boost::algorithm::detail::find_format_copy_impl2( return ::boost::algorithm::detail::find_format_copy_impl2(
Output, Output,
Input, Input,
Formatter, Formatter,
FindResult, FindResult,
Formatter(FindResult) ); Formatter(FindResult) );
} else { } else {
return std::copy( ::boost::begin(Input), ::boost::end(Input), Output ); return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
} }
} }
@ -137,14 +137,14 @@ namespace boost {
const FindResultT& FindResult) const FindResultT& FindResult)
{ {
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) { if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
return ::boost::algorithm::detail::find_format_copy_impl2( return ::boost::algorithm::detail::find_format_copy_impl2(
Input, Input,
Formatter, Formatter,
FindResult, FindResult,
Formatter(FindResult) ); Formatter(FindResult) );
} else { } else {
return Input; return Input;
} }
} }
// replace implementation ----------------------------------------------------// // replace implementation ----------------------------------------------------//
@ -189,12 +189,12 @@ namespace boost {
const FindResultT& FindResult) const FindResultT& FindResult)
{ {
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) { if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
::boost::algorithm::detail::find_format_impl2( ::boost::algorithm::detail::find_format_impl2(
Input, Input,
Formatter, Formatter,
FindResult, FindResult,
Formatter(FindResult) ); Formatter(FindResult) );
} }
} }
} // namespace detail } // namespace detail

View File

@ -84,18 +84,18 @@ namespace boost {
FinderT Finder, FinderT Finder,
FormatterT Formatter, FormatterT Formatter,
const FindResultT& FindResult ) const FindResultT& FindResult )
{ {
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) { if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
return ::boost::algorithm::detail::find_format_all_copy_impl2( return ::boost::algorithm::detail::find_format_all_copy_impl2(
Output, Output,
Input, Input,
Finder, Finder,
Formatter, Formatter,
FindResult, FindResult,
Formatter(FindResult) ); Formatter(FindResult) );
} else { } else {
return std::copy( ::boost::begin(Input), ::boost::end(Input), Output ); return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
} }
} }
// find_format_all_copy implementation ----------------------------------------------// // find_format_all_copy implementation ----------------------------------------------//
@ -161,15 +161,15 @@ namespace boost {
const FindResultT& FindResult) const FindResultT& FindResult)
{ {
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) { if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
return ::boost::algorithm::detail::find_format_all_copy_impl2( return ::boost::algorithm::detail::find_format_all_copy_impl2(
Input, Input,
Finder, Finder,
Formatter, Formatter,
FindResult, FindResult,
Formatter(FindResult) ); Formatter(FindResult) );
} else { } else {
return Input; return Input;
} }
} }
// find_format_all implementation ------------------------------------------------// // find_format_all implementation ------------------------------------------------//
@ -257,13 +257,13 @@ namespace boost {
FindResultT FindResult) FindResultT FindResult)
{ {
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) { if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
::boost::algorithm::detail::find_format_all_impl2( ::boost::algorithm::detail::find_format_all_impl2(
Input, Input,
Finder, Finder,
Formatter, Formatter,
FindResult, FindResult,
Formatter(FindResult) ); Formatter(FindResult) );
} }
} }
} // namespace detail } // namespace detail

View File

@ -53,7 +53,7 @@ namespace boost {
{ {
iterator_range<ForwardIteratorT>::operator=(FindResult); iterator_range<ForwardIteratorT>::operator=(FindResult);
if( !this->empty() ) { if( !this->empty() ) {
m_FormatResult=m_Formatter(FindResult); m_FormatResult=m_Formatter(FindResult);
} }
return *this; return *this;
@ -71,7 +71,7 @@ namespace boost {
}; };
template<typename InputT, typename FindResultT> template<typename InputT, typename FindResultT>
bool check_find_result(InputT& Input, FindResultT& FindResult) bool check_find_result(InputT&, FindResultT& FindResult)
{ {
typedef BOOST_STRING_TYPENAME typedef BOOST_STRING_TYPENAME
range_const_iterator<InputT>::type input_iterator_type; range_const_iterator<InputT>::type input_iterator_type;

View File

@ -259,7 +259,11 @@ namespace boost {
m_End(End), m_End(End),
m_bEof(false) m_bEof(false)
{ {
increment(); // force the correct behavior for empty sequences and yield at least one token
if(Begin!=End)
{
increment();
}
} }
//! Constructor //! Constructor
/*! /*!
@ -278,7 +282,11 @@ namespace boost {
m_Next=::boost::begin(lit_col); m_Next=::boost::begin(lit_col);
m_End=::boost::end(lit_col); m_End=::boost::end(lit_col);
increment(); // force the correct behavior for empty sequences and yield at least one token
if(m_Next!=m_End)
{
increment();
}
} }

View File

@ -57,7 +57,7 @@
The magic of <ulink url="../../libs/range/index.html">Boost.Range</ulink> The magic of <ulink url="../../libs/range/index.html">Boost.Range</ulink>
provides a uniform way of handling different string types. provides a uniform way of handling different string types.
If there is a need to pass a pair of iterators, If there is a need to pass a pair of iterators,
<ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink> <ulink url="../../libs/range/doc/html/range/reference/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>
can be used to package iterators into a structure with a compatible interface. can be used to package iterators into a structure with a compatible interface.
</para> </para>
</listitem> </listitem>
@ -208,7 +208,7 @@
</programlisting> </programlisting>
<para> <para>
We have used <functionname>find_last()</functionname> to search the <code>text</code> for "ll". We have used <functionname>find_last()</functionname> to search the <code>text</code> for "ll".
The result is given in the <ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>. The result is given in the <ulink url="../../libs/range/doc/html/range/reference/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>.
This range delimits the This range delimits the
part of the input which satisfies the find criteria. In our example it is the last occurrence of "ll". part of the input which satisfies the find criteria. In our example it is the last occurrence of "ll".
@ -217,7 +217,7 @@
<ulink url="../../libs/range/index.html">Boost.Range</ulink>. <ulink url="../../libs/range/index.html">Boost.Range</ulink>.
The following lines transform the result. Notice that The following lines transform the result. Notice that
<ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink> has familiar <ulink url="../../libs/range/doc/html/range/reference/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink> has familiar
<code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container. <code>begin()</code> and <code>end()</code> methods, so it can be used like any other STL container.
Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking. Also it is convertible to bool therefore it is easy to use find algorithms for a simple containment checking.
</para> </para>
@ -264,7 +264,7 @@
the find iterator allows us to iterate over the substrings matching the specified criteria. the find iterator allows us to iterate over the substrings matching the specified criteria.
This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally This facility is using the <link linkend="string_algo.finder_concept">Finder</link> to incrementally
search the string. search the string.
Dereferencing a find iterator yields an <ulink url="../../libs/range/doc/html/range/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink> Dereferencing a find iterator yields an <ulink url="../../libs/range/doc/html/range/reference/utilities/iterator_range.html"><code>boost::iterator_range</code></ulink>
object, that delimits the current match. object, that delimits the current match.
</para> </para>
<para> <para>

View File

@ -40,6 +40,7 @@ void iterator_test()
string str1("xx-abc--xx-abb"); string str1("xx-abc--xx-abb");
string str2("Xx-abc--xX-abb-xx"); string str2("Xx-abc--xX-abb-xx");
string str3("xx"); string str3("xx");
string strempty("");
const char* pch1="xx-abc--xx-abb"; const char* pch1="xx-abc--xx-abb";
vector<string> tokens; vector<string> tokens;
vector< vector<int> > vtokens; vector< vector<int> > vtokens;
@ -123,6 +124,25 @@ void iterator_test()
BOOST_CHECK( tokens[3]==string("xx") ); BOOST_CHECK( tokens[3]==string("xx") );
BOOST_CHECK( tokens[4]==string("abb") ); BOOST_CHECK( tokens[4]==string("abb") );
split(
tokens,
str3,
is_any_of(","),
token_compress_off);
BOOST_REQUIRE( tokens.size()==1 );
BOOST_CHECK( tokens[0]==string("xx") );
split(
tokens,
strempty,
is_punct(),
token_compress_off);
BOOST_REQUIRE( tokens.size()==1 );
BOOST_CHECK( tokens[0]==string("") );
find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx")); find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
BOOST_CHECK(equals(*fiter, "xx")); BOOST_CHECK(equals(*fiter, "xx"));
++fiter; ++fiter;