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;
72 std::string attributeAsString(
const std::string& attname)
const;
74 bool attributeAsInt(
const std::string& attname,
int& val)
const;
75 bool attributeAsDouble(
const std::string& attname,
double& val)
const;
77 const std::map<std::string, std::string>& attributes()
const {
return m_attributes; }
79 Component& addChild(
const std::string& childName);
83 const std::vector<Component>& children()
const {
return m_children; }
84 std::vector<Component>& children() {
return m_children; }
86 std::size_t numberOfChildren()
const {
return m_children.size(); }
88 Component& child(std::size_t i) {
return m_children[i]; }
89 const Component& child(std::size_t i)
const {
return m_children[i]; }
92 int findChild(
const std::string& compName)
const;
94 bool operator==(
const Component& other)
const
96 return m_name == other.m_name && m_contents == other.m_contents &&
97 m_attributes == other.m_attributes && m_children == other.m_children;
102 std::string m_contents;
103 std::map<std::string, std::string> m_attributes;
104 std::vector<Component> m_children;
107 Configuration(
const std::string& myType,
const std::string& myName);
110 return std::make_shared<smtk::view::Configuration>(myType, myName);
118 const std::string& name()
const {
return m_name; }
121 std::string label()
const;
123 const std::string& type()
const {
return m_type; }
124 void setType(
const std::string& type) { m_type = type; }
126 const std::string& iconName()
const {
return m_iconName; }
127 void setIconName(
const std::string& iname) { m_iconName = iname; }
129 Component& details() {
return m_details; }
130 const Component& details()
const {
return m_details; }
132 bool operator==(
const Configuration& other)
const
134 return m_name == other.m_name && m_type == other.m_type && m_iconName == other.m_iconName &&
135 m_details == other.m_details;
143 std::size_t includeIndex()
const {
return m_includeIndex; }
148 std::string m_iconName;
150 std::size_t m_includeIndex{ 0 };
154 SMTKCORE_EXPORT std::ostream&
operator<<(std::ostream& os,
const Configuration::Component& comp);
156 SMTKCORE_EXPORT std::ostream&
operator<<(std::ostream& os,
const Configuration& conf);