os/ossrv/ossrv_pub/boost_apis/boost/tokenizer.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/tokenizer.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,98 @@
     1.4 +// Boost tokenizer.hpp  -----------------------------------------------------//
     1.5 +
     1.6 +// © Copyright Jeremy Siek and John R. Bandela 2001. 
     1.7 +
     1.8 +// Distributed under the Boost Software License, Version 1.0. (See
     1.9 +// accompanying file LICENSE_1_0.txt or copy at
    1.10 +// http://www.boost.org/LICENSE_1_0.txt)
    1.11 +
    1.12 +// See http://www.boost.org/libs/tokenizer for documenation
    1.13 +
    1.14 +// Revision History:
    1.15 +// 03 Jul 2003   John Bandela
    1.16 +//      Converted to new iterator adapter
    1.17 +// 02 Feb 2002   Jeremy Siek
    1.18 +//      Removed tabs and a little cleanup.
    1.19 +
    1.20 +#ifndef BOOST_TOKENIZER_JRB070303_HPP_
    1.21 +#define BOOST_TOKENIZER_JRB070303_HPP_
    1.22 +
    1.23 +#include <boost/token_iterator.hpp>
    1.24 +
    1.25 +namespace boost {
    1.26 +
    1.27 +  
    1.28 +  //===========================================================================
    1.29 +  // A container-view of a tokenized "sequence"
    1.30 +  template <
    1.31 +    typename TokenizerFunc = char_delimiters_separator<char>, 
    1.32 +    typename Iterator = std::string::const_iterator,
    1.33 +    typename Type = std::string
    1.34 +  >
    1.35 +  class tokenizer {
    1.36 +  private:
    1.37 +    typedef token_iterator_generator<TokenizerFunc,Iterator,Type> TGen;
    1.38 +        
    1.39 +    // It seems that MSVC does not like the unqualified use of iterator,
    1.40 +    // Thus we use iter internally when it is used unqualified and
    1.41 +    // the users of this class will always qualify iterator.     
    1.42 +    typedef typename TGen::type iter;
    1.43 +    
    1.44 +  public:
    1.45 +    
    1.46 +    typedef iter iterator;
    1.47 +    typedef iter const_iterator;
    1.48 +    typedef Type value_type;
    1.49 +    typedef value_type& reference;
    1.50 +    typedef const value_type& const_reference;
    1.51 +    typedef value_type* pointer;
    1.52 +    typedef const pointer const_pointer;
    1.53 +    typedef void size_type;
    1.54 +    typedef void difference_type;
    1.55 +
    1.56 +    tokenizer(Iterator first, Iterator last,
    1.57 +              const TokenizerFunc& f = TokenizerFunc()) 
    1.58 +      : first_(first), last_(last), f_(f) { }
    1.59 +        
    1.60 +    template <typename Container>
    1.61 +    tokenizer(const Container& c)
    1.62 +      : first_(c.begin()), last_(c.end()), f_() { }
    1.63 +    
    1.64 +    template <typename Container>
    1.65 +    tokenizer(const Container& c,const TokenizerFunc& f)
    1.66 +      : first_(c.begin()), last_(c.end()), f_(f) { }
    1.67 +    
    1.68 +    void assign(Iterator first, Iterator last){
    1.69 +      first_ = first;
    1.70 +      last_ = last;
    1.71 +    }
    1.72 +    
    1.73 +    void assign(Iterator first, Iterator last, const TokenizerFunc& f){
    1.74 +      assign(first,last);
    1.75 +      f_ = f;
    1.76 +    }
    1.77 +    
    1.78 +    template <typename Container>
    1.79 +    void assign(const Container& c){
    1.80 +      assign(c.begin(),c.end());
    1.81 +    }
    1.82 +    
    1.83 +    
    1.84 +    template <typename Container>
    1.85 +    void assign(const Container& c, const TokenizerFunc& f){
    1.86 +      assign(c.begin(),c.end(),f);
    1.87 +    }
    1.88 +    
    1.89 +    iter begin() const { return iter(f_,first_,last_); }
    1.90 +    iter end() const { return iter(f_,last_,last_); }
    1.91 +        
    1.92 +  private:
    1.93 +    Iterator first_;
    1.94 +    Iterator last_;
    1.95 +    TokenizerFunc f_;
    1.96 +  };
    1.97 +
    1.98 +
    1.99 +} // namespace boost
   1.100 +
   1.101 +#endif