icedb  version 0.5.1
Snow particle scattering database API
splitSet.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "defs.h"
3 
4 #include <string>
5 #include <map>
6 #include <set>
7 #include <vector>
8 
9 namespace icedb {
10  namespace splitSet {
13  template <class T>
14  void splitSet(
15  const std::string &instr,
16  std::set<T> &expanded,
17  const std::map<std::string, std::string> *aliases = nullptr);
18 
21  template <> void splitSet<std::string>(
22  const std::string &instr,
23  std::set<std::string> &expanded,
24  const std::map<std::string, std::string> *aliases);
25 
27  template <class T>
28  void splitSet(
29  const T &start, const T &end, const T &interval,
30  const std::string &specializer,
31  std::set<T> &expanded);
32 
34  template <class T>
35  void extractInterval(
36  const std::string &instr,
37  T &start, T &end, T &interval, size_t &num,
38  std::string &specializer);
39 
44  void splitVector(
45  const std::string &instr, std::vector<std::string> &out, char delim = '\0');
46  inline void splitNullVector(
47  const std::string &instr, std::vector<std::string> &out) { splitVector(instr, out); }
48 
53  void splitNullMap(
54  const std::string &instr, std::map<std::string, std::string> &out);
55 
56 
66  template <class T>
67  class intervals
68  {
69  public:
70  std::vector<std::pair<T, T> > ranges;
71  intervals(const std::string &s = "");
72  intervals(const std::vector<std::string> &s);
73  ~intervals();
74  void append(const std::string &instr,
75  const std::map<std::string, std::string> *aliases = nullptr);
76  void append(const std::vector<std::string> &s,
77  const std::map<std::string, std::string> *aliases = nullptr);
78  void append(const intervals<T>& src);
79  bool inRange(const T& val) const;
80  bool isNear(const T& val, const T& linSep, const T& factorSep) const;
81  };
82  }
83 }
84 
85 //#if defined _MSC_FULL_VER
86 //#pragma warning(pop)
87 //#endif
bool isNear(const T &val, const T &linSep, const T &factorSep) const
Definition: splitSet.cpp:502
void extractInterval(const std::string &instr, T &start, T &end, T &interval, size_t &num, std::string &specializer)
Extracts ICEDB_LOG_INFOrmation from interval notation.
Definition: splitSet.cpp:180
Class to define and search on intervals.
Definition: splitSet.hpp:67
intervals(const std::string &s="")
Definition: splitSet.cpp:429
void splitNullMap(const std::string &instr, std::map< std::string, std::string > &out)
Convenience function to split a null-separated string list into a map of strings. ...
Definition: splitSet.cpp:390
void splitNullVector(const std::string &instr, std::vector< std::string > &out)
Definition: splitSet.hpp:46
void append(const std::string &instr, const std::map< std::string, std::string > *aliases=nullptr)
Definition: splitSet.cpp:438
void splitVector(const std::string &instr, std::vector< std::string > &out, char delim)
Convenience function to split a null-separated string list into a vector of strings.
Definition: splitSet.cpp:365
void splitSet(const T &Tstart, const T &Tend, const T &Tinterval, const std::string &Tspecializer, std::set< T > &expanded)
Shortcut that already passes parsed ICEDB_LOG_INFOrmation.
Definition: splitSet.cpp:37
bool inRange(const T &val) const
Definition: splitSet.cpp:490
std::vector< std::pair< T, T > > ranges
Definition: splitSet.hpp:70