gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

propertyMap.h (947B)


      1 #pragma once
      2 
      3 #include <string>
      4 #include <map>
      5 #include <set>
      6 
      7 namespace baseLib
      8 {
      9 	class PropertyMap
     10 	{
     11 	public:
     12 		bool add(const std::string& _key, const std::string& _value);
     13 		bool add(const std::string& _key);
     14 		bool add(const PropertyMap& _other, bool _overwrite = false);
     15 
     16 		std::string tryGet(const std::string& _key, const std::string& _value = std::string()) const;
     17 
     18 		std::string get(const std::string& _key, const std::string& _default = {}) const;
     19 
     20 		float getFloat(const std::string& _key, float _default = 0.0f) const;
     21 
     22 		int getInt(const std::string& _key, int _default = 0) const;
     23 
     24 		bool contains(const std::string& _key) const;
     25 
     26 		const auto& getArgsWithValues() const { return m_argsWithValues; }
     27 		const auto& getArgs() const { return m_args; }
     28 
     29 		bool empty() const { return m_argsWithValues.empty() && m_args.empty(); }
     30 
     31 	private:
     32 		std::map<std::string, std::string> m_argsWithValues;
     33 		std::set<std::string> m_args;
     34 	};
     35 }