libzypp  17.25.6
StringV.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_BASE_STRINGV_H
13 #define ZYPP_BASE_STRINGV_H
14 #include <string_view>
15 #ifdef __cpp_lib_string_view
16 
17 #include <zypp/base/String.h>
18 #include <zypp/base/Flags.h>
19 
21 namespace zypp
22 {
23  namespace strv
24  {
26  enum class Trim {
27  notrim = 0,
28  right = 1<<0,
29  left = 1<<1,
30  trim = (left|right),
31  };
32 
34 
35 
85  unsigned split( std::string_view line_r, std::string_view sep_r, Trim trim_r,
86  std::function<void(std::string_view)> fnc_r );
87 
89  inline unsigned split( std::string_view line_r, std::string_view sep_r,
90  std::function<void(std::string_view)> fnc_r )
91  { return split( line_r, sep_r, Trim::notrim, fnc_r ); }
92 
94  inline unsigned split( std::string_view line_r,
95  std::function<void(std::string_view)> fnc_r )
96  { return split( line_r, std::string_view(), Trim::notrim, fnc_r ); }
97 
98  } // namespace strv
99 } // namespace zypp
101 #endif // __cpp_lib_string_view
102 #endif // ZYPP_BASE_STRINGV_H
#define ZYPP_DECLARE_FLAGS_AND_OPERATORS(Name, Enum)
Definition: Flags.h:189
Trim
To define how to trim.
Definition: String.h:493
std::string trim(const std::string &s, const Trim trim_r)
Definition: String.cc:223
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
unsigned split(std::string_view line_r, std::string_view sep_r, Trim trim_r, std::function< void(std::string_view)> fnc_r)
Definition: StringV.cc:20