Skip to content
Snippets Groups Projects
Commit 011f8873 authored by Andreas Schenk's avatar Andreas Schenk
Browse files

added GetComment to InfoHandle and InfoGroup

parent b1cf0eb3
No related branches found
No related tags found
No related merge requests found
...@@ -199,6 +199,7 @@ BOOST_PYTHON_MODULE(_ost_info) ...@@ -199,6 +199,7 @@ BOOST_PYTHON_MODULE(_ost_info)
.def("SetBool",&InfoItem::SetBool) .def("SetBool",&InfoItem::SetBool)
.def("SetVector",&InfoItem::SetVector) .def("SetVector",&InfoItem::SetVector)
.add_property("attribute",&InfoItem::GetAttribute,&InfoItem::SetAttribute) .add_property("attribute",&InfoItem::GetAttribute,&InfoItem::SetAttribute)
.def("GetComment",&InfoItem::GetComment)
; ;
class_<InfoGroupList>("InfoGroupList", no_init) class_<InfoGroupList>("InfoGroupList", no_init)
.def(vector_indexing_suite<InfoGroupList>()) .def(vector_indexing_suite<InfoGroupList>())
...@@ -237,6 +238,7 @@ BOOST_PYTHON_MODULE(_ost_info) ...@@ -237,6 +238,7 @@ BOOST_PYTHON_MODULE(_ost_info)
.def("Apply",info_group_apply2a) .def("Apply",info_group_apply2a)
.def("Apply",info_group_apply2b) .def("Apply",info_group_apply2b)
.def("GetTextData",&InfoGroup::GetTextData) .def("GetTextData",&InfoGroup::GetTextData)
.def("GetComment",&InfoGroup::GetComment)
.def("GetPath",&InfoGroup::GetPath) .def("GetPath",&InfoGroup::GetPath)
; ;
......
...@@ -418,6 +418,11 @@ void InfoGroup::SetTextData(const String& td) ...@@ -418,6 +418,11 @@ void InfoGroup::SetTextData(const String& td)
impl_->SetTextData(td); impl_->SetTextData(td);
} }
String InfoGroup::GetComment() const
{
return impl_->GetComment();
}
bool InfoGroup::operator==(const InfoGroup& ref) const bool InfoGroup::operator==(const InfoGroup& ref) const
{ {
return *impl_ == *ref.impl_; return *impl_ == *ref.impl_;
......
...@@ -90,6 +90,10 @@ public: ...@@ -90,6 +90,10 @@ public:
String GetTextData() const; String GetTextData() const;
void SetTextData(const String& td); void SetTextData(const String& td);
//! get comment just above item
String GetComment() const;
//! Apply visitor //! Apply visitor
/*! /*!
descends through all items and subgroups descends through all items and subgroups
......
...@@ -361,6 +361,16 @@ void EleImpl::SetTextData(const String& td) ...@@ -361,6 +361,16 @@ void EleImpl::SetTextData(const String& td)
} }
} }
String EleImpl::GetComment() const
{
QDomNode previous=ele_.previousSibling();
if(previous.isComment()){
return previous.toComment().data().toStdString();
}
return String();
}
Type EleImpl::GetType() const Type EleImpl::GetType() const
{ {
return type_; return type_;
......
...@@ -74,6 +74,8 @@ public: ...@@ -74,6 +74,8 @@ public:
String GetTextData() const; String GetTextData() const;
void SetTextData(const String& td); void SetTextData(const String& td);
String GetComment() const;
/// \brief get sub elements with specified element name /// \brief get sub elements with specified element name
/// ///
/// does not throw. returns empty list if not elements have been found /// does not throw. returns empty list if not elements have been found
......
...@@ -177,6 +177,11 @@ bool InfoItem::operator!=(const InfoItem& rhs) const ...@@ -177,6 +177,11 @@ bool InfoItem::operator!=(const InfoItem& rhs) const
return !this->operator==(rhs); return !this->operator==(rhs);
} }
String InfoItem::GetComment() const
{
return impl_->GetComment();
}
Real GetFloatInfoItem(const InfoGroup& ig, const InfoPath& path, Real def) Real GetFloatInfoItem(const InfoGroup& ig, const InfoPath& path, Real def)
{ {
if(ig.HasItem(path)) { if(ig.HasItem(path)) {
......
...@@ -107,6 +107,8 @@ public: ...@@ -107,6 +107,8 @@ public:
bool HasAttribute(const String& name) const; bool HasAttribute(const String& name) const;
//! remove attribute of given name //! remove attribute of given name
void RemoveAttribute(const String& name); void RemoveAttribute(const String& name);
//! get comment just above item
String GetComment() const;
//! returns a list with all attribute names //! returns a list with all attribute names
std::vector<String> GetAttributeList() const; std::vector<String> GetAttributeList() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment