Skip to content

Commit

Permalink
ofXml: add clear method which clears the xml doc
Browse files Browse the repository at this point in the history
  • Loading branch information
arturoc committed Sep 28, 2018
1 parent a27c74e commit 83dc9c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libs/openFrameworks/utils/ofXml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ bool ofXml::save(const std::filesystem::path & file) const{
return false;
}

void ofXml::clear(){
doc.reset(new pugi::xml_document);
xml = doc->root();
}

std::string ofXml::toString(const std::string & indent) const{
ostringstream stream;
if(xml == doc->root()){
Expand Down
1 change: 1 addition & 0 deletions libs/openFrameworks/utils/ofXml.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class ofXml{
bool load(const ofBuffer & buffer);
bool parse(const std::string & xmlStr);
bool save(const std::filesystem::path & file) const;
void clear();
std::string toString(const std::string & indent = "\t") const;

ofXml getChild(const std::string & name) const;
Expand Down

0 comments on commit 83dc9c5

Please sign in to comment.