SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
PropertiesParser.cc
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 #include "swcdb/core/Exception.h"
9 #include <sstream>
10 #include <fstream>
11 #include <iomanip>
12 
13 
14 namespace SWC {
15 
16 
17 /* cfg methods for types
18 * @param v The default Value and a Type
19 */
21 Config::boo(const bool& v) {
22  return new Config::Property::Value_bool(v);
23 }
25 Config::i8(const uint8_t& v) {
26  return new Config::Property::Value_uint8(v);
27 }
29 Config::i16(const uint16_t& v) {
30  return new Config::Property::Value_uint16(v);
31 }
33 Config::i32(const int32_t& v) {
34  return new Config::Property::Value_int32(v);
35 }
37 Config::i64(const int64_t& v) {
38  return new Config::Property::Value_int64(v);
39 }
41 Config::f64(const double& v) {
42  return new Config::Property::Value_double(v);
43 }
45 Config::str(std::string&& v) {
46  return new Config::Property::Value_string(std::move(v));
47 }
50  return new Config::Property::Value_strings(std::move(v));
51 }
54  return new Config::Property::Value_int64s(std::move(v));
55 }
58  return new Config::Property::Value_doubles(std::move(v));
59 }
60 
61 /* cfg methods for guarded types
62 * @param v The default Value and a Type
63 */
65 Config::g_boo(const bool& v) {
66  return new Config::Property::Value_bool_g(v, nullptr);
67 }
69 Config::g_i8(const uint8_t& v) {
70  return new Config::Property::Value_uint8_g(v, nullptr);
71 }
73 Config::g_i16(const uint16_t& v) {
74  return new Config::Property::Value_uint16_g(v, nullptr);
75 }
77 Config::g_i32(const int32_t& v) {
78  return new Config::Property::Value_int32_g(v, nullptr);
79 }
81 Config::g_i64(const uint64_t& v) {
82  return new Config::Property::Value_uint64_g(v, nullptr);
83 }
86  return new Config::Property::Value_strings_g(std::move(v), nullptr);
87 }
89 Config::g_enum(const int32_t& v,
94  v, std::move(cb), std::move(from_string), std::move(repr));
95 }
96 
97 /* cfg methods for types, a skippable option
98 * if no option parsed it is skipped
99 */
101  return new Config::Property::Value_bool(
103 }
107 }
111 }
115 }
119 }
123 }
126  std::string(), Config::Property::Value::SKIPPABLE);
127 }
131 }
135 }
139 }
140 
141 
142 
143 namespace Config {
144 
145 
146 ParserConfig::ParserConfig(bool a_own) noexcept
147  : usage(), positions(),
148  options(), own(a_own) {
149 }
150 
152  free();
153 }
154 
155 void ParserConfig::free() noexcept {
156  if(own) {
157  for(auto& opt : options)
158  delete opt.second.value;
159  options.clear();
160  }
161 }
162 
164  usage = u;
165  return *this;
166 }
167 
169  usage = std::move(u);
170  return *this;
171 }
172 
173 /* populate from other Parser Config */
174 SWC_SHOULD_NOT_INLINE
176  usage.append(other_cfg.usage);
177 
178  for (auto& pos : other_cfg.positions)
179  add_pos(pos.second.c_str(), pos.first);
180 
181  for(const auto& kv : other_cfg.options)
182  options.emplace(kv.first, kv.second);
183  //auto r= if(r.second && !kv.second.aliases.empty()) { } // ?merge alias
184  return *this;
185 }
186 
187 /* Method to add option */
188 SWC_SHOULD_NOT_INLINE
189 ParserConfig& ParserConfig::add(const char* names,
191  const char* description) {
192  Strings aliases;
193  {
194  std::string s;
195  for(; *names; ++names) {
196  if(std::isspace(*names))
197  continue;
198  if(*names == ',') {
199  if(!s.empty())
200  aliases.emplace_back(std::move(s));
201  } else {
202  s += *names;
203  }
204  }
205  if(aliases.empty() || !s.empty())
206  aliases.emplace_back(std::move(s));
207  }
208  ParserOpt& opt = options[aliases.front()];
209  opt.value = vptr;
210  opt.desc = description;
211  opt.aliases.resize(aliases.size() - 1);
212  for(size_t n=0; n<opt.aliases.size(); ++n)
213  opt.aliases[n] = std::move(aliases[n + 1]);
214  return *this;
215 }
216 
219  const char* description) {
220  return add(name, vptr, description);
221 }
222 
224  return *this;
225 }
226 
229  const char* description) {
230  return add(name, vptr, description);
231 }
232 
233 ParserConfig& ParserConfig::add(const char* name, const char* description) {
234  return add(name, boo()->zero_token(), description);
235 }
236 
238  const char* description) {
239  return add(name, description);
240 }
241 
242 /* Method to add_pos option */
243 ParserConfig& ParserConfig::add_pos(const char* s, int pos) {
244  positions.emplace_back(pos, s);
245  return *this;
246 }
247 
248 ParserConfig& ParserConfig::operator()(const char* s, int pos) {
249  return add_pos(s, pos);
250 }
251 
252 std::string ParserConfig::position_name(int n) {
253  for (auto& pos : positions) {
254  if(pos.first == n)
255  return pos.second;
256  }
257  return "";
258 }
259 
260 SWC_SHOULD_NOT_INLINE
261 bool ParserConfig::has(const std::string& name) const noexcept {
262  for(const auto& info : options) {
263  if(Condition::str_eq(name, info.first))
264  return true;
265  for(const std::string& alias : info.second.aliases) {
266  if(Condition::str_eq(name, alias))
267  return true;
268  }
269  }
270  return false;
271 }
272 
273 SWC_SHOULD_NOT_INLINE
274 bool ParserConfig::has(const std::string& name,
275  std::string& alias_to) const noexcept {
276  for(const auto& info : options) {
277  if(Condition::str_eq(name, info.first))
278  return true;
279  for(const std::string& alias : info.second.aliases) {
280  if(Condition::str_eq(name, alias)) {
281  alias_to = info.first;
282  return true;
283  }
284  }
285  }
286  return false;
287 }
288 
289 SWC_SHOULD_NOT_INLINE
291  for(const auto& info : options) {
292  if(Condition::str_eq(name, info.first))
293  return info.second.value;
294  for(const std::string& alias : info.second.aliases) {
295  if(Condition::str_eq(name, alias))
296  return info.second.value;
297  }
298  }
299  SWC_THROWF(Error::CONFIG_GET_ERROR, "ParserConfig, getting value of '%s'",
300  name.c_str());
301 }
302 
303 void ParserConfig::remove(const std::string& name) {
304  auto it = options.find(name);
305  if(it != options.cend()) {
306  if(own)
307  delete it->second.value;
308  options.erase(it);
309  }
310 }
311 
312 void ParserConfig::print(std::ostream& os) const {
313  os << usage << '\n';
314 
315  size_t offset_name = 5;
316  size_t offset_desc = 5;
317  for (const auto& kv : options) {
318  size_t tmp = (!kv.second.aliases.empty()?
319  format_list(kv.second.aliases).length()+2 : 0);
320  if(offset_name < (tmp += kv.first.length()))
321  offset_name = tmp;
322  if(offset_desc < kv.second.desc.length())
323  offset_desc = kv.second.desc.length();
324  }
325  offset_name += 2;
326 
327  for (const auto& kv : options) {
328  os << std::left << std::setw(2) << ' '
329  << std::left << std::setw(offset_name + 2) <<
330  format("--%s %s", kv.first.c_str(),
331  (!kv.second.aliases.empty()?
332  format("-%s",format_list(kv.second.aliases).c_str()).c_str()
333  : ""))
334  << std::left << std::setw(offset_desc+2) << kv.second.desc
335  << std::left << std::setw(2) << kv.second.value->to_string()
336  << '\n';
337  }
338 }
339 
340 
341 std::ostream& operator<<(std::ostream& os, const ParserConfig& cfg) {
342  cfg.print(os);
343  return os;
344 }
345 
346 
347 
348 
349 Strings Parser::args_to_strings(int argc, char *argv[]) {
350  Strings raw_strings;
351  raw_strings.resize(--argc);
352  for(int n=0; n<argc; ++n)
353  raw_strings[n].append(argv[n + 1]);
354  return raw_strings;
355 }
356 
357 Parser::Options::Options() noexcept : map() { }
358 
361  map = std::move(other.map);
362  return *this;
363 }
364 
366  for(const auto& kv : map)
367  delete kv.second;
368  map.clear();
369 }
370 
371 Parser::Parser(bool unregistered) noexcept
372  : config(false),
373  raw_opts(),
374  m_unregistered(unregistered),
375  m_opts() {
376 }
377 
378 Parser::~Parser() noexcept { }
379 
380 void Parser::free() noexcept {
381  config.free();
382 }
383 
384 SWC_SHOULD_NOT_INLINE
385 void Parser::parse_filedata(std::ifstream& in) {
386  {
387  std::string line;
388  for(std::string group; std::getline(in, line); ) {
389  if(line.find_first_of("[") == 0) {
390 
391  size_t at = line.find_first_of("]");
392  if(at != std::string::npos) {
393 
394  std::string g_tmp = line.substr(1, at-1);
395  if(!group.empty()){
396  group.pop_back(); // remove a dot
397  if(Condition::str_eq(g_tmp, group+"=end")) {
398  // an end of group "[groupname=end]"
399  group.clear();
400  line.clear();
401  continue;
402  }
403  }
404  group = g_tmp + ".";
405  // a start of group "[groupname]"
406  line.clear();
407  continue;
408  }
409  }
410  parse_line(group + line);
411  }
412  }
413  make_options();
414 }
415 
416 void Parser::parse_cmdline(int argc, char *argv[]) {
417  parse_cmdline(args_to_strings(argc, argv));
418 }
419 
420 SWC_SHOULD_NOT_INLINE
421 void Parser::parse_cmdline(const Strings& raw_strings) {
422 
423  if(raw_strings.empty()) {
424  make_options();
425  return;
426  }
427 
428  bool cfg_name;
429  bool fill = false;
430  std::string name, opt;
431  int len_o = raw_strings.size();
432 
433  int n = 0;
434  for(const std::string& raw_opt: raw_strings) {
435  ++n;
436 
437  // if arg is a --name / -name
438  if(!fill && raw_opt.find_first_of("-", 0, 1) != std::string::npos) {
439  name = raw_opt.substr(1);
440  if(name.find_first_of("-", 0, 1) != std::string::npos)
441  name = name.substr(1);
442  opt.append(name);
443 
444  // if not arg with name=Value
445  if(name.find_first_of("=") == std::string::npos){
446  opt += '=';
447 
448  if(!config.has(name) || !config.get_default(name)->is_zero_token()) {
449  if(len_o > n) {
450  fill = true;
451  continue;
452  }
453  }
454  opt += '1'; // zero-token true default
455  }
456  } else {
457  // position based name with position's value
458  name = config.position_name(n);
459  if(!name.empty()) {
460  set_pos_parse(name, raw_opt);
461  continue;
462  }
463  opt.append(raw_opt);
464  }
465 
466  // SWC_LOGF(LOG_INFO, "parsing: %s", opt.c_str());
467  cfg_name = parse_opt(opt); // << input need to be NAME=VALUE else false
468  if(!cfg_name) {
469  name = config.position_name(-1);
470  if(!name.empty())
471  set_pos_parse(name, raw_opt);
472  else if(!m_unregistered)
473  // if no pos -1 if(n) ignore app-file, unregistered arg-positions
475  "unknown cfg with %s", raw_opt.c_str());
476  }
477 
478  opt.clear();
479  fill = false;
480  }
481 
482  make_options();
483 }
484 
485 SWC_SHOULD_NOT_INLINE
486 void Parser::parse_line(const std::string& line) {
487  size_t at = line.find_first_of("="); // is a cfg type
488  if(at == std::string::npos)
489  return;
490 
491  std::string name = line.substr(0, at);
492  size_t cmt = name.find_first_of("#"); // is comment in name
493  if(cmt != std::string::npos)
494  return;
495 
496  name.erase(std::remove_if(name.begin(), name.end(),
497  [](unsigned char x){return std::isspace(x);}),
498  name.cend());
499 
500  std::string value = line.substr(at+1);
501  cmt = value.find_first_of("#"); // remove followup comment
502  if(cmt != std::string::npos)
503  value = value.substr(0, cmt);
504 
505  at = value.find_first_of("\"");
506  if(at != std::string::npos) {
507  // quoted value
508  value = value.substr(at+1);
509  at = value.find_first_of("\"");
510  if(at != std::string::npos)
511  value = value.substr(0, at);
512  } else {
513  // remove spaces
514  value.erase(std::remove_if(value.begin(), value.end(),
515  [](unsigned char x){return std::isspace(x);}),
516  value.cend());
517  }
518  parse_opt(name+"="+value); // << input must be NAME=VALUE !
519 
520  //cfg_name = parse_opt(line);
521  // if(!cfg_name)
522  // SWC_LOGF(LOG_WARN, "unknown cfg: %s", line.c_str());
523  // line.clear();
524 }
525 
526 void Parser::set_pos_parse(const std::string& name, const std::string& value) {
527  raw_opts[name].emplace_back(value);
528 }
529 
530 SWC_SHOULD_NOT_INLINE
531 bool Parser::parse_opt(const std::string& s){
532  size_t at = s.find_first_of("=");
533  if(at == std::string::npos)
534  return false;
535 
536  std::string name = s.substr(0, at);
537  std::string alias_to;
538  // SWC_LOGF(LOG_INFO, "looking: %s", name.c_str());
539  if(!config.has(name, alias_to) && !m_unregistered)
540  return false;
541 
542  auto& r = raw_opts[alias_to.length() ? alias_to : name];
543  if(s.size() > ++at)
544  r.emplace_back(s.c_str() + at, s.size() - at);
545  return true;
546 }
547 
548 SWC_SHOULD_NOT_INLINE
550  for(const auto& kv : raw_opts) {
551  if(!config.has(kv.first) && m_unregistered)
552  add_opt(kv.first, nullptr, kv.second); // unregistered cfg
553  else
554  add_opt(kv.first, config.get_default(kv.first), kv.second);
555  }
556  for (const auto& kv : config.options) {
557  if(raw_opts.count(kv.first) || kv.second.value->is_skippable())
558  continue;
559  // add default kv
560  add_opt(kv.first, kv.second.value, {});
561  }
562 }
563 
564 // convert, validate and add property to options
565 SWC_SHOULD_NOT_INLINE
566 void Parser::add_opt(const std::string& name, Property::Value::Ptr p,
567  const Strings& raw_opt) {
568  auto tmp = p ? p : str();
569  auto& p_set = m_opts.map.emplace(name, tmp->make_new(raw_opt)).first->second;
570  if(!p)
571  delete tmp;
572 
573  if(raw_opt.empty())
574  p_set->default_value(true);
575 }
576 
578  opts = std::move(m_opts);
579 }
580 
581 const Parser::Options& Parser::get_options() const noexcept {
582  return m_opts;
583 }
584 
585 void Parser::print(std::ostream& os) const {
586  os << "*** Raw Parsed Options:" << '\n';
587  for (const auto& kv : raw_opts)
588  os << kv.first << '=' << format_list(kv.second) << '\n';
589 }
590 
591 void Parser::print_options(std::ostream& os) const {
592  os << "*** Parsed Options:" << '\n';
593  for(const auto& kv : m_opts.map)
594  os << kv.first << '=' << kv.second->to_string() << '\n';
595 }
596 
597 std::ostream& operator<<(std::ostream& os, const Parser& prs) {
598  prs.print(os);
599  return os;
600 }
601 
602 
603 }} // namespace SWC::Config
SWC::Config::i32
Property::Value_int32::Ptr i32(const int32_t &v)
Definition: PropertiesParser.cc:33
SWC::Config::Parser
Definition: PropertiesParser.h:168
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE reference front() noexcept
Definition: Vector.h:243
SWC::Config::Parser::own_options
void own_options(Options &opts)
Definition: PropertiesParser.cc:577
SWC::Config::ParserConfig::print
void print(std::ostream &os) const
Definition: PropertiesParser.cc:312
SWC::Config::ParserConfig::ParserOpt::desc
std::string desc
Definition: PropertiesParser.h:69
SWC::Config::g_i32
Property::Value_int32_g::Ptr g_i32(const int32_t &v)
Definition: PropertiesParser.cc:77
SWC::Config::ParserConfig::add
ParserConfig & add(const ParserConfig &other_cfg)
Definition: PropertiesParser.cc:175
SWC::Config::Parser::m_unregistered
bool m_unregistered
Definition: PropertiesParser.h:234
SWC::Config::ParserConfig::free
void free() noexcept
Definition: PropertiesParser.cc:155
SWC::Config::g_strs
Property::Value_strings_g::Ptr g_strs(Strings &&v)
Definition: PropertiesParser.cc:85
SWC::Config::Property::Value_uint64_g
Definition: Property.h:624
SWC::Config::Parser::parse_opt
bool parse_opt(const std::string &s)
Definition: PropertiesParser.cc:531
SWC::Config::g_enum
Property::Value_enum_g::Ptr g_enum(const int32_t &v, Property::Value_enum_g::OnChg_t &&cb, Property::Value_enum_g::FromString_t &&from_string, Property::Value_enum_g::Repr_t &&repr)
Definition: PropertiesParser.cc:89
SWC::Core::Vector::resize
SWC_CAN_INLINE void resize(size_type sz, ArgsT &&... args)
Definition: Vector.h:308
SWC::Config::g_boo
Property::Value_bool_g::Ptr g_boo(const bool &v)
Definition: PropertiesParser.cc:65
SWC::Config::f64s
Property::Value_doubles::Ptr f64s(Doubles &&v)
Definition: PropertiesParser.cc:57
SWC::Config::i8
Property::Value_uint8::Ptr i8(const uint8_t &v)
Definition: PropertiesParser.cc:25
SWC::Config::Doubles
Core::Vector< double > Doubles
Definition: Property.h:19
SWC::Config::Strings
Core::Vector< std::string > Strings
Definition: Property.h:17
SWC::Config::Parser::m_opts
Options m_opts
Definition: PropertiesParser.h:235
SWC::Config::ParserConfig::has
bool SWC_PURE_FUNC has(const std::string &name) const noexcept
Definition: PropertiesParser.cc:261
SWC::Config::Parser::raw_opts
Map raw_opts
Definition: PropertiesParser.h:233
SWC::Config::Property::Value::SKIPPABLE
static const uint8_t SKIPPABLE
Definition: Property.h:63
SWC::Config::Parser::print
void print(std::ostream &os) const
Definition: PropertiesParser.cc:585
SWC::Config::Parser::get_options
const Options &SWC_CONST_FUNC get_options() const noexcept
Definition: PropertiesParser.cc:581
SWC::Config::Parser::Parser
SWC_SHOULD_NOT_INLINE Parser(bool unregistered=false) noexcept
Definition: PropertiesParser.cc:371
SWC::Config::Property::Value_strings
Definition: Property.h:383
SWC::Config::boo
Property::Value_bool::Ptr boo(const bool &v)
Definition: PropertiesParser.cc:21
SWC::Config::ParserConfig::positions
Positions positions
Definition: PropertiesParser.h:105
SWC::Config::ParserConfig::position_name
std::string position_name(int n)
Definition: PropertiesParser.cc:252
SWC::Config::Parser::parse_line
void parse_line(const std::string &line)
Definition: PropertiesParser.cc:486
SWC::Config::ParserConfig::remove
void remove(const std::string &name)
Definition: PropertiesParser.cc:303
SWC::Config::Property::Value_uint16
Definition: Property.h:201
SWC::Config::Property::Value_bool
Definition: Property.h:143
SWC::Config::Property::Value::Ptr
Value * Ptr
Definition: Property.h:68
SWC::Config::Parser::config
ParserConfig config
Definition: PropertiesParser.h:171
SWC::Config::Parser::~Parser
~Parser() noexcept
Definition: PropertiesParser.cc:378
SWC::Config::Property::Value_int32
Definition: Property.h:230
SWC::Config::i16
Property::Value_uint16::Ptr i16(const uint16_t &v)
Definition: PropertiesParser.cc:29
SWC::Config::Parser::Options::Options
Options() noexcept
Definition: PropertiesParser.cc:357
SWC::Config::Property::Value_doubles
Definition: Property.h:441
SWC::Config::Property::Value_strings_g
Definition: Property.h:711
SWC::Condition::str_eq
bool str_eq(const char *s1, const char *s2) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: Comparators_basic.h:237
SWC::Config::Property::Value_int64
Definition: Property.h:259
SWC::Core::Vector::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC::Config::i64s
Property::Value_int64s::Ptr i64s(Int64s &&v)
Definition: PropertiesParser.cc:53
Exception.h
SWC::Config::Parser::add_opt
void add_opt(const std::string &name, Property::Value::Ptr p, const Strings &raw_opt)
Definition: PropertiesParser.cc:566
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Config::ParserConfig::add_pos
ParserConfig & add_pos(const char *s, int pos)
Definition: PropertiesParser.cc:243
SWC::Config::Parser::print_options
void print_options(std::ostream &os) const
Definition: PropertiesParser.cc:591
SWC::Config::Parser::parse_cmdline
void parse_cmdline(int argc, char *argv[])
Definition: PropertiesParser.cc:416
SWC::Config::ParserConfig::~ParserConfig
~ParserConfig() noexcept
Definition: PropertiesParser.cc:151
SWC::Config::Parser::Options::map
std::map< std::string, Property::Value::Ptr > map
Definition: PropertiesParser.h:177
SWC::Config::ParserConfig::ParserOpt::aliases
Strings aliases
Definition: PropertiesParser.h:68
SWC::Config::strs
Property::Value_strings::Ptr strs(Strings &&v)
Definition: PropertiesParser.cc:49
SWC_THROWF
#define SWC_THROWF(_code_, _fmt_,...)
Definition: Exception.h:136
SWC::Config::ParserConfig::add_options
ParserConfig &SWC_CONST_FUNC add_options()
Definition: PropertiesParser.cc:223
SWC::Config::str
Property::Value_string::Ptr str(std::string &&v)
Definition: PropertiesParser.cc:45
SWC::Config::Property::from_string
void from_string(const char *s, double *value)
Definition: Property.cc:109
SWC::Config::ParserConfig::usage
std::string usage
Definition: PropertiesParser.h:104
SWC::Config::ParserConfig
Definition: PropertiesParser.h:64
SWC::Config::Parser::parse_filedata
void parse_filedata(std::ifstream &in)
Definition: PropertiesParser.cc:385
SWC::Config::Property::Value_uint8_g
Definition: Property.h:511
SWC::Config::ParserConfig::operator()
ParserConfig & operator()(const char *name, Property::Value::Ptr vptr, const char *description)
Definition: PropertiesParser.cc:217
SWC::Config::Property::Value_string
Definition: Property.h:317
SWC::Config::Property::Value
Definition: Property.h:35
SWC::Config::Int64s
Core::Vector< int64_t > Int64s
Definition: Property.h:18
SWC::Config::Property::Value_enum_g
Definition: Property.h:662
SWC::Config::Parser::free
void free() noexcept
Definition: PropertiesParser.cc:380
SWC::Config::Parser::Options
Definition: PropertiesParser.h:175
SWC::Config::ParserConfig::ParserOpt::value
Property::Value::Ptr value
Definition: PropertiesParser.h:67
SWC::format
std::string format(const char *fmt,...) __attribute__((format(printf
Definition: String.cc:17
SWC::Config::Parser::Options::~Options
~Options() noexcept
Definition: PropertiesParser.cc:365
SWC::Core::Vector< std::string >
SWC::format_list
std::string SWC_PRAGMA_DIAGNOSTIC_PUSH SWC_PRAGMA_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") std SWC_PRAGMA_DIAGNOSTIC_POP std::string format_list(const SequenceT &seq, const char *sep=", ")
Definition: String.h:34
SWC::Config::Property::Value_enum_g::Repr_t
Value_enum::Repr_t Repr_t
Definition: Property.h:669
SWC::Config::g_i16
Property::Value_uint16_g::Ptr g_i16(const uint16_t &v)
Definition: PropertiesParser.cc:73
SWC::Config::i64
Property::Value_int64::Ptr i64(const int64_t &v)
Definition: PropertiesParser.cc:37
SWC::Config::Property::Value_uint8
Definition: Property.h:172
SWC::Config::ParserConfig::options
Map options
Definition: PropertiesParser.h:106
SWC::Config::Property::Value_int64s
Definition: Property.h:412
SWC::Config::Property::Value_uint16_g
Definition: Property.h:548
SWC::Config::Property::Value_enum_g::OnChg_t
std::function< void(int32_t)> OnChg_t
Definition: Property.h:667
SWC::Config::ParserConfig::ParserOpt
Definition: PropertiesParser.h:66
SWC::Config::ParserConfig::own
bool own
Definition: PropertiesParser.h:107
SWC::Config::Parser::args_to_strings
static Strings args_to_strings(int argc, char *argv[])
Definition: PropertiesParser.cc:349
SWC::Config::Property::Value_double
Definition: Property.h:288
SWC::Config::g_i64
Property::Value_uint64_g::Ptr g_i64(const uint64_t &v)
Definition: PropertiesParser.cc:81
SWC::Config::g_i8
Property::Value_uint8_g::Ptr g_i8(const uint8_t &v)
Definition: PropertiesParser.cc:69
SWC::Config::Parser::make_options
void make_options()
Definition: PropertiesParser.cc:549
SWC::Error::CONFIG_GET_ERROR
@ CONFIG_GET_ERROR
Definition: Error.h:80
SWC::Config::Property::Value::is_zero_token
bool is_zero_token() const noexcept
Definition: Property.cc:99
SWC::Comm::Protocol::FsBroker::Handler::append
void append(const ConnHandlerPtr &conn, const Event::Ptr &ev)
Definition: Append.h:17
SWC::Config::Property::Value_bool_g
Definition: Property.h:472
SWC::Config::Property::Value_enum_g::FromString_t
Value_enum::FromString_t FromString_t
Definition: Property.h:668
SWC::Config::operator<<
std::ostream & operator<<(std::ostream &os, const ParserConfig &cfg)
Definition: PropertiesParser.cc:341
SWC::Config::ParserConfig::get_default
Property::Value::Ptr get_default(const std::string &name)
Definition: PropertiesParser.cc:290
SWC::Core::Vector::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Config::Parser::set_pos_parse
void set_pos_parse(const std::string &name, const std::string &value)
Definition: PropertiesParser.cc:526
SWC::Config::ParserConfig::ParserConfig
SWC_SHOULD_NOT_INLINE ParserConfig(bool own) noexcept
Definition: PropertiesParser.cc:146
SWC::Core::Vector::emplace_back
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
Definition: Vector.h:349
SWC::Config::Parser::Options::operator=
Options & operator=(Options &&) noexcept
Definition: PropertiesParser.cc:360
SWC::Config::Property::Value_int32_g
Definition: Property.h:586
SWC::Config::f64
Property::Value_double::Ptr f64(const double &v)
Definition: PropertiesParser.cc:41
SWC::Config::ParserConfig::definition
ParserConfig & definition(const char *u)
Definition: PropertiesParser.cc:163
PropertiesParser.h