diff --git a/simgear/props/props_io.cxx b/simgear/props/props_io.cxx index 69500977..71e389f8 100644 --- a/simgear/props/props_io.cxx +++ b/simgear/props/props_io.cxx @@ -689,6 +689,24 @@ writeProperties (ostream &output, const SGPropertyNode * start_node, output << "" << endl; } +writePropertiesInline::writePropertiesInline( + const SGPropertyNode * start_node, + bool write_all, + SGPropertyNode::Attribute archive_flag + ) +: +m_start_node(start_node), +m_write_all(write_all), +m_archive_flag(archive_flag) +{ +} + +std::ostream& operator<< (std::ostream& out, const writePropertiesInline& wpm) +{ + writeProperties(out, wpm.m_start_node, wpm.m_write_all, wpm.m_archive_flag); + return out; +} + void writeProperties (const SGPath &path, const SGPropertyNode * start_node, diff --git a/simgear/props/props_io.hxx b/simgear/props/props_io.hxx index 17c28df3..79c23534 100644 --- a/simgear/props/props_io.hxx +++ b/simgear/props/props_io.hxx @@ -49,6 +49,23 @@ void writeProperties (std::ostream &output, const SGPropertyNode * start_node, bool write_all = false, SGPropertyNode::Attribute archive_flag = SGPropertyNode::ARCHIVE); +/** + * Convenience manipulator for calling writeProperties(), e.g.: + * std::cerr << "node is:\n" << writePropertiesStream(node, true) << "\n"; + */ +struct writePropertiesInline +{ + writePropertiesInline( + const SGPropertyNode * start_node, + bool write_all = false, + SGPropertyNode::Attribute archive_flag = SGPropertyNode::ARCHIVE + ); + const SGPropertyNode * m_start_node; + bool m_write_all; + SGPropertyNode::Attribute m_archive_flag; +}; + +std::ostream& operator<< (std::ostream& out, const writePropertiesInline& wpm); /** * Write properties to an XML file.