LCOV - code coverage report
Current view: top level - usr/include/boost/algorithm/string - split.hpp (source / functions) Hit Total Coverage
Test: ROSE Lines: 0 3 0.0 %
Date: 2022-12-08 13:48:47 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //  Boost string_algo library split.hpp header file  ---------------------------//
       2             : 
       3             : //  Copyright Pavol Droba 2002-2006.
       4             : //
       5             : // Distributed under the Boost Software License, Version 1.0.
       6             : //    (See accompanying file LICENSE_1_0.txt or copy at
       7             : //          http://www.boost.org/LICENSE_1_0.txt)
       8             : 
       9             : //  See http://www.boost.org/ for updates, documentation, and revision history.
      10             : 
      11             : #ifndef BOOST_STRING_SPLIT_HPP
      12             : #define BOOST_STRING_SPLIT_HPP
      13             : 
      14             : #include <boost/algorithm/string/config.hpp>
      15             : 
      16             : #include <boost/algorithm/string/iter_find.hpp>
      17             : #include <boost/algorithm/string/finder.hpp>
      18             : #include <boost/algorithm/string/compare.hpp>
      19             : 
      20             : /*! \file
      21             :     Defines basic split algorithms. 
      22             :     Split algorithms can be used to divide a string
      23             :     into several parts according to given criteria.
      24             :     
      25             :     Each part is copied and added as a new element to the
      26             :     output container.
      27             :     Thus the result container must be able to hold copies
      28             :     of the matches (in a compatible structure like std::string) or
      29             :     a reference to it (e.g. using the iterator range class).
      30             :     Examples of such a container are \c std::vector<std::string>
      31             :     or \c std::list<boost::iterator_range<std::string::iterator>>
      32             : */
      33             : 
      34             : namespace boost {
      35             :     namespace algorithm {
      36             : 
      37             : //  find_all  ------------------------------------------------------------//
      38             : 
      39             :         //! Find all algorithm
      40             :         /*!
      41             :             This algorithm finds all occurrences of the search string
      42             :             in the input.
      43             :             
      44             :             Each part is copied and added as a new element to the
      45             :             output container.
      46             :             Thus the result container must be able to hold copies
      47             :             of the matches (in a compatible structure like std::string) or
      48             :             a reference to it (e.g. using the iterator range class).
      49             :             Examples of such a container are \c std::vector<std::string>
      50             :             or \c std::list<boost::iterator_range<std::string::iterator>>
      51             : 
      52             :             \param Result A container that can hold copies of references to the substrings
      53             :             \param Input A container which will be searched.
      54             :             \param Search A substring to be searched for.
      55             :             \return A reference the result
      56             : 
      57             :             \note Prior content of the result will be overwritten.
      58             : 
      59             :             \note This function provides the strong exception-safety guarantee
      60             :         */
      61             :         template< typename SequenceSequenceT, typename Range1T, typename Range2T >
      62             :         inline SequenceSequenceT& find_all(
      63             :             SequenceSequenceT& Result,
      64             : #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
      65             :             Range1T&& Input,
      66             : #else
      67             :             Range1T& Input,
      68             : #endif
      69             :             const Range2T& Search)
      70             :         {
      71             :             return ::boost::algorithm::iter_find(
      72             :                 Result,
      73             :                 Input,
      74             :                 ::boost::algorithm::first_finder(Search) );        
      75             :         }
      76             : 
      77             :         //! Find all algorithm ( case insensitive ) 
      78             :         /*!
      79             :             This algorithm finds all occurrences of the search string
      80             :             in the input. 
      81             :             Each part is copied and added as a new element to the
      82             :             output container. Thus the result container must be able to hold copies
      83             :             of the matches (in a compatible structure like std::string) or
      84             :             a reference to it (e.g. using the iterator range class).
      85             :             Examples of such a container are \c std::vector<std::string>
      86             :             or \c std::list<boost::iterator_range<std::string::iterator>>
      87             : 
      88             :             Searching is case insensitive.
      89             : 
      90             :             \param Result A container that can hold copies of references to the substrings
      91             :             \param Input A container which will be searched.
      92             :             \param Search A substring to be searched for.
      93             :             \param Loc A locale used for case insensitive comparison
      94             :             \return A reference the result
      95             : 
      96             :             \note Prior content of the result will be overwritten.
      97             : 
      98             :             \note This function provides the strong exception-safety guarantee
      99             :         */
     100             :         template< typename SequenceSequenceT, typename Range1T, typename Range2T >
     101             :         inline SequenceSequenceT& ifind_all(
     102             :             SequenceSequenceT& Result,
     103             : #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
     104             :             Range1T&& Input,
     105             : #else
     106             :             Range1T& Input,
     107             : #endif
     108             :             const Range2T& Search,
     109             :             const std::locale& Loc=std::locale() )
     110             :         {
     111             :             return ::boost::algorithm::iter_find(
     112             :                 Result,
     113             :                 Input,
     114             :                 ::boost::algorithm::first_finder(Search, is_iequal(Loc) ) );        
     115             :         }
     116             : 
     117             : 
     118             : //  tokenize  -------------------------------------------------------------//
     119             : 
     120             :         //! Split algorithm
     121             :         /*! 
     122             :             Tokenize expression. This function is equivalent to C strtok. Input
     123             :             sequence is split into tokens, separated by separators. Separators 
     124             :             are given by means of the predicate.
     125             : 
     126             :             Each part is copied and added as a new element to the
     127             :             output container.
     128             :             Thus the result container must be able to hold copies
     129             :             of the matches (in a compatible structure like std::string) or
     130             :             a reference to it (e.g. using the iterator range class).
     131             :             Examples of such a container are \c std::vector<std::string>
     132             :             or \c std::list<boost::iterator_range<std::string::iterator>>
     133             :     
     134             :             \param Result A container that can hold copies of references to the substrings          
     135             :             \param Input A container which will be searched.
     136             :             \param Pred A predicate to identify separators. This predicate is 
     137             :                 supposed to return true if a given element is a separator.
     138             :             \param eCompress If eCompress argument is set to token_compress_on, adjacent 
     139             :                 separators are merged together. Otherwise, every two separators
     140             :                 delimit a token.
     141             :             \return A reference the result
     142             : 
     143             :             \note Prior content of the result will be overwritten.
     144             : 
     145             :             \note This function provides the strong exception-safety guarantee
     146             :         */
     147             :         template< typename SequenceSequenceT, typename RangeT, typename PredicateT >
     148           0 :         inline SequenceSequenceT& split(
     149             :             SequenceSequenceT& Result,
     150             : #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
     151             :             RangeT&& Input,
     152             : #else
     153             :             RangeT& Input,
     154             : #endif
     155             :             PredicateT Pred,
     156             :             token_compress_mode_type eCompress=token_compress_off )
     157             :         {
     158           0 :             return ::boost::algorithm::iter_split(
     159             :                 Result,
     160             :                 Input,
     161           0 :                 ::boost::algorithm::token_finder( Pred, eCompress ) );         
     162             :         }
     163             : 
     164             :     } // namespace algorithm
     165             : 
     166             :     // pull names to the boost namespace
     167             :     using algorithm::find_all;
     168             :     using algorithm::ifind_all;
     169             :     using algorithm::split;    
     170             : 
     171             : } // namespace boost
     172             : 
     173             : 
     174             : #endif  // BOOST_STRING_SPLIT_HPP
     175             : 

Generated by: LCOV version 1.14