mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
Allow to construct a XML tree from a text buffer
This commit is contained in:
parent
5ed764178a
commit
06700cb2f4
2 changed files with 10 additions and 3 deletions
|
|
@ -70,7 +70,7 @@ public:
|
|||
bool read(const std::string& fn) { set_filename(fn); return read_internal(false); }
|
||||
bool read_and_validate() { return read_internal(true); }
|
||||
bool read_and_validate(const std::string& fn) { set_filename(fn); return read_internal(true); }
|
||||
bool read_buffer(const std::string&);
|
||||
bool read_buffer(const std::string&, bool to_tree_doc = false);
|
||||
|
||||
bool write() const;
|
||||
bool write(const std::string& fn) { set_filename(fn); return write(); }
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ XMLTree::read_internal(bool validate)
|
|||
}
|
||||
|
||||
bool
|
||||
XMLTree::read_buffer(const string& buffer)
|
||||
XMLTree::read_buffer(const string& buffer, bool to_tree_doc)
|
||||
{
|
||||
xmlDocPtr doc;
|
||||
|
||||
|
|
@ -135,7 +135,14 @@ XMLTree::read_buffer(const string& buffer)
|
|||
}
|
||||
|
||||
_root = readnode(xmlDocGetRootElement(doc));
|
||||
xmlFreeDoc(doc);
|
||||
if (to_tree_doc) {
|
||||
if (_doc) {
|
||||
xmlFreeDoc (_doc);
|
||||
}
|
||||
_doc = doc;
|
||||
} else {
|
||||
xmlFreeDoc (doc);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue