Warning, /include/Geant4/toolx/xml/xml_style is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef toolx_xml_style
0005 #define toolx_xml_style
0006
0007 #include <tools/xml/styles>
0008
0009 #include "loader"
0010
0011 namespace toolx {
0012 namespace xml {
0013
0014 inline bool load_style_file(std::ostream&,const std::string& a_file,tools::xml::styles& a_styles) {
0015 tools::xml::default_factory factory;
0016 toolx::xml::loader ml(factory,a_styles.out(),false);
0017 std::vector<std::string> tags;
0018 tags.push_back("styles");
0019 tags.push_back("style");
0020 tags.push_back("plotter_style");
0021 ml.set_tags(tags);
0022 if(!ml.load_file(a_file,false)) return false;
0023 tools::xml::tree* top = ml.top_item();
0024 if(!top) return true; //File could be empty.
0025 return scan_style_tree(a_styles,*top);
0026 }
0027
0028 inline bool load_style_string(tools::xml::styles& a_styles,const std::string& a_string) {
0029 tools::xml::default_factory factory;
0030 toolx::xml::loader ml(factory,a_styles.out(),false);
0031 std::vector<std::string> tags;
0032 tags.push_back("styles");
0033 tags.push_back("style");
0034 tags.push_back("plotter_style");
0035 ml.set_tags(tags);
0036 if(!ml.load_string(a_string)) return false;
0037 tools::xml::tree* top = ml.top_item();
0038 if(!top) return true;
0039 return scan_style_tree(a_styles,*top);
0040 }
0041
0042 }}
0043
0044 #endif