OpenLexocad  28.0
PropertyTextMap.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/Property.h>
4 
5 namespace Core
6 {
7 class LX_CORE_EXPORT PropertyTextMap : public Core::Property
8 {
10 
11 public:
12  void setValue(const std::map<Base::String, Base::String>& textMap);
13  bool setValueFromVariant(const Core::Variant& value) override;
14  void copyValue(Core::Property* p) override;
15 
16  const std::map<Base::String, Base::String>& getValue() const;
17  Core::Variant getVariant() const override { return Core::Variant(_textMap); }
18 
19  Base::String value(const Base::String& key) const; // Returns empty string if the key is not found.
20  bool contains(const Base::String& key) const;
21  void clear();
22  void erase(const Base::String& key);
23  void insert(const Base::String& key, const Base::String& value);
24  bool empty() const;
25  size_t size() const;
26 
27  void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version) override;
29 
30  bool isEqual(const Property*) const override;
31 
32  Core::Property* copy() const override;
33  void paste(const Core::Property& from) override;
34 
35 protected:
36  std::map<Base::String, Base::String> _textMap;
37 };
38 
40 
41 DECLARE_PROPERTY_FACTORY(PropertyTextMap_Factory, Core::PropertyTextMap);
42 
43 } // namespace Core
Property.h
Core::PropertyTextMap::erase
void erase(const Base::String &key)
Core::PropertyTextMap::setValue
void setValue(const std::map< Base::String, Base::String > &textMap)
Core::PropertyTextMap::save
void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version) override
This method is used to save properties or very small amounts of data to an XML document.
Core::PropertyTextMap::copy
Core::Property * copy() const override
Returns a new copy of the property (mainly for Undo/Redo and transactions). The copy has no container...
Core::PropertyTextMap::paste
void paste(const Core::Property &from) override
Paste the value from the property (mainly for Undo/Redo and transactions)
Core::PropertyTextMap::_textMap
std::map< Base::String, Base::String > _textMap
Definition: PropertyTextMap.h:36
Core::PropertyTextMap::copyValue
void copyValue(Core::Property *p) override
Base::PersistenceVersion
Definition: Persistence.h:13
Core
Definition: Base.h:5
Core::Variant
Definition: Variant.h:78
Base::AbstractWriter
Definition: Writer.h:13
Base::AbstractXMLReader
Definition: AbstractXMLReader.h:7
Core::PropertyTextMap::contains
bool contains(const Base::String &key) const
Core::PropertyTextMap
Definition: PropertyTextMap.h:8
Core::PropertyTextMap::value
Base::String value(const Base::String &key) const
Core::PropertyTextMap::size
size_t size() const
Core::PropertyTextMap::restore
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
Core::version
LX_CORE_EXPORT Version & version
Core::Property
Definition: Property.h:72
Core::PropertyTextMap::insert
void insert(const Base::String &key, const Base::String &value)
Base::String
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
Core::DECLARE_OPTIONAL_PROPERTY_HEADER
DECLARE_OPTIONAL_PROPERTY_HEADER(PropertyColorOpt, Core::PropertyColor)
Core::PropertyTextMap::getValue
const std::map< Base::String, Base::String > & getValue() const
Core::PropertyTextMap::empty
bool empty() const
TYPESYSTEM_HEADER
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
Core::DECLARE_PROPERTY_FACTORY
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
Core::PropertyTextMap::setValueFromVariant
bool setValueFromVariant(const Core::Variant &value) override
Core::PropertyTextMap::isEqual
bool isEqual(const Property *) const override
compare properties
Core::PropertyTextMap::clear
void clear()
Core::PropertyTextMap::getVariant
Core::Variant getVariant() const override
Definition: PropertyTextMap.h:17