added to Space:

- methods for testing a string value if a Space is a string or a table:
  bool has_value(const char * val) const;
  bool has_value(const std::string & val) const;
  bool has_value(const wchar_t * val) const;
  bool has_value(const std::wstring & val) const;
- methods for testing a string value in an object (testing a string or a table):
  bool has_value(const wchar_t * field, const char * val) const;
  bool has_value(const wchar_t * field, const std::string & val) const;
  bool has_value(const wchar_t * field, const wchar_t * val) const;
  bool has_value(const wchar_t * field, const std::wstring & val) const;
- methods for removing a child space:
  void remove_child_space(const wchar_t * name);
  void remove_child_space(const std::wstring & name);
  void remove_child_space(size_t index);
This commit is contained in:
2021-04-09 17:49:44 +02:00
parent a1e8f13f46
commit 5d34db5fcf
2 changed files with 178 additions and 7 deletions

View File

@@ -294,11 +294,6 @@ public:
Space & add_empty_space(const std::wstring & field); // IMPROVEME rename me to something better
// for child spaces (used only in Space format)
// rename to something better
Space & add_child_space(const wchar_t * space_name);
// IMPROVEME add a similar 'set' method and cctor
template<typename StreamType>
Space & add_stream(const wchar_t * field, StreamType & str)
@@ -414,11 +409,17 @@ public:
ObjectType * get_object();
TableType * get_table();
// may a better name?
bool is_equal(const char * val) const;
bool is_equal(const std::string & val) const;
bool is_equal(const wchar_t * val) const;
bool is_equal(const std::wstring & val) const;
// add these is_equal with std::wstring
// may a better name?
bool has_value(const char * val) const;
bool has_value(const std::string & val) const;
bool has_value(const wchar_t * val) const;
bool has_value(const std::wstring & val) const;
// what about getters from tables?
@@ -540,21 +541,36 @@ public:
}
// add this method with field with std::wstring
bool is_equal(const wchar_t * field, const char * val) const;
bool is_equal(const wchar_t * field, const std::string & val) const;
bool is_equal(const wchar_t * field, const wchar_t * val) const;
bool is_equal(const wchar_t * field, const std::wstring & val) const;
// add these is_equal with std::wstring
// may a better name?
// add this method with field with std::wstring
bool has_value(const wchar_t * field, const char * val) const;
bool has_value(const wchar_t * field, const std::string & val) const;
bool has_value(const wchar_t * field, const wchar_t * val) const;
bool has_value(const wchar_t * field, const std::wstring & val) const;
// for child spaces (used only in Space format)
Space * find_child_space(const wchar_t * name);
Space * find_child_space(const std::wstring & name);
const Space * find_child_space(const wchar_t * name) const;
const Space * find_child_space(const std::wstring & name) const;
Space & add_child_space(const wchar_t * space_name);
Space & find_add_child_space(const wchar_t * name);
Space & find_add_child_space(const std::wstring & name);
void remove_child_space(const wchar_t * name);
void remove_child_space(const std::wstring & name);
void remove_child_space(size_t index);
protected: