libpniio
node.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2013 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 //************************************************************************
19 // Created on: Jul 11, 2013
20 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
21 //
22 #pragma once
23 
24 #include <pni/core/types.hpp>
25 #include <boost/property_tree/ptree.hpp>
26 
27 namespace pni{
28 namespace io{
29 namespace nx{
30 namespace xml{
31 
39  using node = boost::property_tree::ptree;
40 
41 
42  //-------------------------------------------------------------------------
53  node create_from_string(const pni::core::string &s);
54 
55  //-------------------------------------------------------------------------
68  node create_from_file(const pni::core::string &s);
69 
70  //------------------------------------------------------------------------
81  pni::core::string attribute_path(const pni::core::string &name);
82 
83 
84  //------------------------------------------------------------------------
98  node get_attribute(const node &parent,const pni::core::string &name);
99 
100  //-------------------------------------------------------------------------
112  bool has_attribute(const node &parent,const pni::core::string &name);
113 
114  //-------------------------------------------------------------------------
127  pni::core::string get_name(const node &n);
128 
129 
130  //-------------------------------------------------------------------------
131  node get_child_by_name(const node &parent,const pni::core::string &name);
132 
133  //-------------------------------------------------------------------------
143  std::ostream &operator<<(std::ostream &o,const node &n);
144 
145 
146 //end of namespace
147 }
148 }
149 }
150 }
node get_child_by_name(const node &parent, const pni::core::string &name)
bool has_attribute(const node &parent, const pni::core::string &name)
check for attribute existence
node create_from_file(const pni::core::string &s)
create xml node from file
node create_from_string(const pni::core::string &s)
create xml node from string
std::ostream & operator<<(std::ostream &o, const node &n)
XML stream output.
Definition: node.cpp:129
pni::core::string get_name(const node &n)
get name of a node
Definition: node.cpp:138
Definition: cbf_reader.hpp:41
boost::property_tree::ptree node
alias for ptree
Definition: node.hpp:39
pni::core::string attribute_path(const pni::core::string &name)
create an attribute path
node get_attribute(const node &parent, const pni::core::string &name)
get attribute node