libpniio
nxpath/utils.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 //
20 // Created on: Jun 27, 2013
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 #pragma once
24 
25 #include <iostream>
26 #include <pni/core/types.hpp>
27 #include "nxpath.hpp"
28 
29 
30 namespace pni{
31 namespace io{
32 namespace nx{
33 
34 
46  bool match(const pni::core::string &a,const pni::core::string &b);
47 
48  //-------------------------------------------------------------------------
60  bool match(const nxpath &a,const nxpath &b);
61 
62  //-------------------------------------------------------------------------
74  bool match(const nxpath::element_type &a,const nxpath::element_type &b);
75 
76 
77  //------------------------------------------------------------------------
90  nxpath::element_type object_element(const pni::core::string &name,
91  const pni::core::string &type);
92 
93  //------------------------------------------------------------------------
124  void split_path(const nxpath &p,size_t s,nxpath &p1,nxpath &p2);
125 
126  //--------------------------------------------------------------------------
140  void split_last(const nxpath &p,nxpath &gp,nxpath &op);
141 
142  //--------------------------------------------------------------------------
151  bool has_file_section(const nxpath &p);
152 
153  //------------------------------------------------------------------------
162  bool has_attribute_section(const nxpath &p);
163 
164  //------------------------------------------------------------------------
177  bool is_root_element(const nxpath::element_type &e);
178 
179  //--------------------------------------------------------------------------
186  bool is_absolute(const nxpath &p);
187 
188  //--------------------------------------------------------------------------
199  bool has_name(const nxpath::element_type &e);
200 
201  //--------------------------------------------------------------------------
211  bool has_class(const nxpath::element_type &e);
212 
213  //--------------------------------------------------------------------------
229  bool is_complete(const nxpath::element_type &e);
230 
231  //--------------------------------------------------------------------------
245  bool is_empty(const nxpath &p);
246 
247  //--------------------------------------------------------------------------
265  nxpath join(const nxpath &a,const nxpath &b);
266 
267  //--------------------------------------------------------------------------
285  std::istream &operator>>(std::istream &i,nxpath &p);
286 
287  //--------------------------------------------------------------------------
300  bool operator==(const nxpath::element_type &a,
301  const nxpath::element_type &b);
302 
303  //--------------------------------------------------------------------------
314  bool operator!=(const nxpath::element_type &a,
315  const nxpath::element_type &b);
316 
317  //--------------------------------------------------------------------------
330  bool operator==(const nxpath &lhs,const nxpath &rhs);
331 
332  //--------------------------------------------------------------------------
343  bool operator!=(const nxpath &lhs,const nxpath &rhs);
344 
345  //------------------------------------------------------------------------
357  std::ostream &operator<<(std::ostream &stream,
358  const nxpath::element_type &e);
359 
360  //--------------------------------------------------------------------------
385  std::ostream &operator<<(std::ostream &stream,const nxpath &p);
386 
387 //end of namespace
388 }
389 }
390 }
nxpath join(const nxpath &a, const nxpath &b)
Definition: nxpath/utils.cpp:142
void split_last(const nxpath &p, nxpath &gpath, nxpath &opath)
Definition: nxpath/utils.cpp:77
bool has_attribute_section(const nxpath &p)
Definition: nxpath/utils.cpp:90
bool has_file_section(const nxpath &p)
Definition: nxpath/utils.cpp:83
bool operator!=(const nxgroup< IMPID > &a, const nxgroup< IMPID > &b)
group inequality check
Definition: nxgroup.hpp:862
bool is_root_element(const nxpath::element_type &e)
Definition: nxpath/utils.cpp:97
bool has_class(const nxpath::element_type &e)
Definition: nxpath/utils.cpp:119
Definition: cbf_reader.hpp:41
bool is_complete(const nxpath::element_type &e)
Definition: nxpath/utils.cpp:125
bool match(const pni::core::string &a, const pni::core::string &b)
check if two paths are matching
Definition: nxpath/utils.cpp:299
bool is_absolute(const nxpath &p)
Definition: nxpath/utils.cpp:107
bool has_name(const nxpath::element_type &e)
Definition: nxpath/utils.cpp:113
std::pair< pni::core::string, pni::core::string > element_type
object element (groupname:class)
Definition: nxpath/nxpath.hpp:64
std::ostream & operator<<(std::ostream &stream, const nxlink_type &ltype)
ouput operator for link type enumeration
Definition: nxlink_type.cpp:30
bool operator==(const nxgroup< IMPID > &a, const nxgroup< IMPID > &b)
group equality check
Definition: nxgroup.hpp:841
nxpath::element_type object_element(const pni::core::string &name, const pni::core::string &type)
create object element
Definition: nxpath/utils.cpp:42
std::istream & operator>>(std::istream &i, nxpath &p)
Definition: nxpath/utils.cpp:173
void split_path(const nxpath &p, size_t s, nxpath &p1, nxpath &p2)
Definition: nxpath/utils.cpp:53
bool is_empty(const nxpath &p)
Definition: nxpath/utils.cpp:134