bpp-core3  3.0.0
KeyvalTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_TEXT_KEYVALTOOLS_H
6 #define BPP_TEXT_KEYVALTOOLS_H
7 
8 
9 #include "../Exceptions.h"
10 #include "StringTokenizer.h"
11 #include "TextTools.h"
12 
13 // From the STL:
14 #include <map>
15 
16 namespace bpp
17 {
22  public Exception
23 {
24 public:
25  KeyvalException(const std::string& text) : Exception(text) {}
26 };
27 
40 {
41 public:
42  KeyvalTools();
43  virtual ~KeyvalTools();
44 
45 public:
56  static void singleKeyval(const std::string& desc, std::string& key, std::string& val, const std::string& split = "=");
57 
68  static void multipleKeyvals(const std::string& desc, std::map<std::string, std::string>& keyvals, const std::string& split = ",", bool nested = true);
69 
87  static std::string changeKeyvals(const std::string& desc, const std::map<std::string, std::string>& newkeyvals, const std::string& split = ",", bool nested = true);
88 
97  static void parseProcedure(const std::string& desc, std::string& name, std::map<std::string, std::string>& args);
98 };
99 } // End of namespace bpp.
100 #endif // BPP_TEXT_KEYVALTOOLS_H
Tools to deal with the keyval syntax.
Definition: KeyvalTools.h:39
Exception thrown by the Keyval parser.
Definition: KeyvalTools.h:21
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
Definition: Exceptions.h:20
KeyvalException(const std::string &text)
Definition: KeyvalTools.h:25
std::vector< std::string > split(const std::string &s, std::size_t n)
Definition: TextTools.cpp:263