diff options
Diffstat (limited to '3rdParty/Boost/src/boost/token_functions.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/token_functions.hpp | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/3rdParty/Boost/src/boost/token_functions.hpp b/3rdParty/Boost/src/boost/token_functions.hpp index 4d1a1df..33b37cd 100644 --- a/3rdParty/Boost/src/boost/token_functions.hpp +++ b/3rdParty/Boost/src/boost/token_functions.hpp @@ -1,12 +1,12 @@ // Boost token_functions.hpp ------------------------------------------------// -// Copyright John R. Bandela 2001. +// Copyright John R. Bandela 2001. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/tokenizer/ for documentation. // Revision History: // 01 Oct 2004 Joaquin M Lopez Munoz @@ -71,24 +71,24 @@ namespace std{ using ::iswpunct; using ::iswspace; #endif } #endif namespace boost{ //=========================================================================== // The escaped_list_separator class. Which is a model of TokenizerFunction - // An escaped list is a super-set of what is commonly known as a comma - // separated value (csv) list.It is separated into fields by a comma or + // An escaped list is a super-set of what is commonly known as a comma + // separated value (csv) list.It is separated into fields by a comma or // other character. If the delimiting character is inside quotes, then it is // counted as a regular character.To allow for embedded quotes in a field, - // there can be escape sequences using the \ much like C. - // The role of the comma, the quotation mark, and the escape + // there can be escape sequences using the \ much like C. + // The role of the comma, the quotation mark, and the escape // character (backslash \), can be assigned to other characters. struct escaped_list_error : public std::runtime_error{ escaped_list_error(const std::string& what_arg):std::runtime_error(what_arg) { } }; // The out of the box GCC 2.95 on cygwin does not have a char_traits class. // MSVC does not like the following typename @@ -175,19 +175,19 @@ namespace boost{ if (is_escape(*next)) { do_escape(next,end,tok); } else if (is_c(*next)) { if (!bInQuote) { // If we are not in quote, then we are done ++next; // The last character was a c, that means there is // 1 more blank field - last_ = true; + last_ = true; return true; } else tok+=*next; } else if (is_quote(*next)) { bInQuote=!bInQuote; } else { tok += *next; @@ -203,19 +203,19 @@ namespace boost{ namespace tokenizer_detail { //=========================================================================== // Tokenizer was broken for wide character separators, at least on Windows, since // CRT functions isspace etc only expect values in [0, 0xFF]. Debug build asserts // if higher values are passed in. The traits extension class should take care of this. // Assuming that the conditional will always get optimized out in the function // implementations, argument types are not a problem since both forms of character classifiers // expect an int. - + #if !defined(BOOST_NO_CWCTYPE) template<typename traits, int N> struct traits_extension_details : public traits { typedef typename traits::char_type char_type; static bool isspace(char_type c) { return std::iswspace(c) != 0; } static bool ispunct(char_type c) @@ -232,19 +232,19 @@ namespace boost{ return std::isspace(c) != 0; } static bool ispunct(char_type c) { return std::ispunct(c) != 0; } }; #endif - + // In case there is no cwctype header, we implement the checks manually. // We make use of the fact that the tested categories should fit in ASCII. template<typename traits> struct traits_extension : public traits { typedef typename traits::char_type char_type; static bool isspace(char_type c) { #if !defined(BOOST_NO_CWCTYPE) return traits_extension_details<traits, sizeof(char_type)>::isspace(c); @@ -272,51 +272,36 @@ namespace boost{ // The assign method does nothing, plus_equal invokes operator +=, // and the clearing method sets the supplied token to the default // token constructor's result. // template<class IteratorTag> struct assign_or_plus_equal { template<class Iterator, class Token> static void assign(Iterator b, Iterator e, Token &t) { - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) &&\ - BOOST_WORKAROUND(__SGI_STL_PORT, < 0x500) &&\ - defined(_STLP_DEBUG) &&\ - (defined(_STLP_USE_DYNAMIC_LIB) || defined(_DLL)) - // Problem with string::assign for msvc-stlport in debug mode: the - // linker tries to import the templatized version of this memfun, - // which is obviously not exported. - // See http://www.stlport.com/dcforum/DCForumID6/1763.html for details. - - t = Token(); - while(b != e) t += *b++; -#else t.assign(b, e); -#endif - } template<class Token, class Value> static void plus_equal(Token &, const Value &) { } // If we are doing an assign, there is no need for the // the clear. // template<class Token> static void clear(Token &) { } }; template <> struct assign_or_plus_equal<std::input_iterator_tag> { template<class Iterator, class Token> - static void assign(Iterator b, Iterator e, Token &t) { } - template<class Token, class Value> + static void assign(Iterator , Iterator , Token &) { } + template<class Token, class Value> static void plus_equal(Token &t, const Value &v) { t += v; } template<class Token> static void clear(Token &t) { t = Token(); } }; @@ -438,19 +423,19 @@ namespace boost{ // The out of the box GCC 2.95 on cygwin does not have a char_traits class. template <typename Char, typename Tr = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type > class char_separator { typedef tokenizer_detail::traits_extension<Tr> Traits; typedef std::basic_string<Char,Tr> string_type; public: - explicit + explicit char_separator(const Char* dropped_delims, const Char* kept_delims = 0, empty_token_policy empty_tokens = drop_empty_tokens) : m_dropped_delims(dropped_delims), m_use_ispunct(false), m_use_isspace(false), m_empty_tokens(empty_tokens), m_output_done(false) { @@ -505,35 +490,35 @@ namespace boost{ // Handle empty token at the end if (next == end) { if (m_output_done == false) { m_output_done = true; assigner::assign(start,next,tok); return true; - } + } else return false; } if (is_kept(*next)) { if (m_output_done == false) m_output_done = true; else { assigner::plus_equal(tok,*next); ++next; m_output_done = false; } - } + } else if (m_output_done == false && is_dropped(*next)) { m_output_done = true; - } + } else { if (is_dropped(*next)) start=++next; for (; next != end && !is_dropped(*next) && !is_kept(*next); ++next) assigner::plus_equal(tok,*next); m_output_done = true; } } assigner::assign(start,next,tok); @@ -612,37 +597,37 @@ namespace boost{ if (no_isspace_) {return false;} else{ int r = Traits::isspace(E); return r != 0; } } } public: - explicit char_delimiters_separator(bool return_delims = false, + explicit char_delimiters_separator(bool return_delims = false, const Char* returnable = 0, const Char* nonreturnable = 0) : returnable_(returnable ? returnable : string_type().c_str()), nonreturnable_(nonreturnable ? nonreturnable:string_type().c_str()), return_delims_(return_delims), no_ispunct_(returnable!=0), no_isspace_(nonreturnable!=0) { } void reset() { } public: template <typename InputIterator, typename Token> bool operator()(InputIterator& next, InputIterator end,Token& tok) { tok = Token(); // skip past all nonreturnable delims // skip past the returnable only if we are not returning delims - for (;next!=end && ( is_nonret(*next) || (is_ret(*next) + for (;next!=end && ( is_nonret(*next) || (is_ret(*next) && !return_delims_ ) );++next) { } if (next == end) { return false; } // if we are to return delims and we are one a returnable one // move past it and stop if (is_ret(*next) && return_delims_) { |