15 #ifndef smtk_view_Configuration_h
16 #define smtk_view_Configuration_h
18 #include "smtk/CoreExports.h"
46 const std::string& name()
const {
return m_name; }
47 const std::string& contents()
const {
return m_contents; }
48 bool contentsAsVector(std::vector<double>& vec)
const;
49 bool contentsAsInt(
int& val)
const;
51 Component& setContents(
const std::string& c);
53 Component& setAttribute(
const std::string& attname,
const std::string& value);
54 Component& unsetAttribute(
const std::string& attname);
58 bool attribute(
const std::string& attname, std::string& value)
const;
60 bool attribute(
const std::string& attname)
const;
65 bool attributeAsBool(
const std::string& attname,
bool& value)
const;
68 bool attributeAsBool(
const std::string& attname)
const;
70 bool attributeAsInt(
const std::string& attname,
int& val)
const;
71 bool attributeAsDouble(
const std::string& attname,
double& val)
const;
73 const std::map<std::string, std::string>& attributes()
const {
return m_attributes; }
75 Component& addChild(
const std::string& childName);
79 const std::vector<Component>& children()
const {
return m_children; }
81 std::size_t numberOfChildren()
const {
return m_children.size(); }
83 Component& child(std::size_t i) {
return m_children[i]; }
84 const Component& child(std::size_t i)
const {
return m_children[i]; }
87 int findChild(
const std::string& compName)
const;
89 bool operator==(
const Component& other)
const
91 return m_name == other.m_name && m_contents == other.m_contents &&
92 m_attributes == other.m_attributes && m_children == other.m_children;
97 std::string m_contents;
98 std::map<std::string, std::string> m_attributes;
99 std::vector<Component> m_children;
102 Configuration(
const std::string& myType,
const std::string& myName);
105 return std::make_shared<smtk::view::Configuration>(myType, myName);
113 const std::string& name()
const {
return m_name; }
116 std::string label()
const;
118 const std::string& type()
const {
return m_type; }
119 void setType(
const std::string& type) { m_type = type; }
121 const std::string& iconName()
const {
return m_iconName; }
122 void setIconName(
const std::string& iname) { m_iconName = iname; }
124 Component& details() {
return m_details; }
125 const Component& details()
const {
return m_details; }
127 bool operator==(
const Configuration& other)
const
129 return m_name == other.m_name && m_type == other.m_type && m_iconName == other.m_iconName &&
130 m_details == other.m_details;
138 std::size_t includeIndex()
const {
return m_includeIndex; }
143 std::string m_iconName;
145 std::size_t m_includeIndex{ 0 };
149 SMTKCORE_EXPORT std::ostream&
operator<<(std::ostream& os,
const Configuration::Component& comp);
151 SMTKCORE_EXPORT std::ostream&
operator<<(std::ostream& os,
const Configuration& conf);