h5cpp 0.7.1
A modern C++ wrapper for the HDF5 C library
path.hpp
Go to the documentation of this file.
1//
2// (c) Copyright 2017 DESY,ESS
3//
4// This file is part of h5cpp.
5//
6// This library is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License as published
8// by the Free Software Foundation; either version 2.1 of the License, or
9// (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful, but
12// WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY
13// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14// License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this library; if not, write to the
18// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19// Boston, MA 02110-1301 USA
20// ===========================================================================
21//
22// Authors:
23// Eugen Wintersberger <eugen.wintersberger@desy.de>
24// Martin Shetty <martin.shetty@esss.se>
25// Created on: Aug 24, 2017
26//
27#pragma once
28
29#include <list>
30#include <string>
32
33namespace hdf5 {
34
49#ifdef __clang__
50#pragma clang diagnostic push
51#pragma clang diagnostic ignored "-Wpadded"
52#endif
54{
55 public:
56 using value_type = std::string;
57 using iterator = std::list<value_type>::iterator;
58 using const_iterator = std::list<value_type>::const_iterator;
59 using reverse_iterator = std::list<value_type>::reverse_iterator;
60 using const_reverse_iterator= std::list<value_type>::const_reverse_iterator;
61
69
76 Path(const std::string &str);
77 Path(const char *str);
78
85 Path(const_iterator first_element, const_iterator last_element);
86
87 explicit operator std::string() const
88 {
89 return to_string();
90 }
91
98 size_t size() const noexcept;
99
101
114 const_iterator begin() const;
115 const_iterator end() const;
117
118
120
137
154 bool absolute() const noexcept;
155
172 void absolute(bool value) noexcept;
173
193 bool is_root() const;
194
203 bool is_name() const;
204
217 std::string name() const;
218
237 Path parent() const;
238
252 void append(const Path& p);
253
254 Path relative_to(const Path& base) const;
255
256 Path& operator+=(const Path &other);
257
258#ifndef _DOXYGEN_ /* workaround for the #613 breathe bug */
263 DLL_EXPORT friend bool operator==(const Path &lhs, const Path &rhs);
267 DLL_EXPORT friend Path common_base(const Path& lhs, const Path& rhs);
268#endif /* DOXYGEN */
269 private:
270 bool absolute_;
271#ifdef _MSC_VER
272#pragma warning(push)
273#pragma warning(disable:4251)
274#endif
275 std::list<std::string> link_names_;
276#ifdef _MSC_VER
277#pragma warning(pop)
278#endif
279
280 void from_string(const std::string &str);
281 std::string to_string() const;
282
283 void sanitize();
284};
285#ifdef __clang__
286#pragma clang diagnostic pop
287#endif
288
289#ifdef _DOXYGEN_ /* workaround for the #613 breathe bug */
294 DLL_EXPORT friend bool operator==(const Path &lhs, const Path &rhs);
298 DLL_EXPORT friend Path common_base(const Path& lhs, const Path& rhs);
299#endif /* DOXYGEN */
300
301DLL_EXPORT bool operator!=(const Path &lhs, const Path &rhs);
302
303DLL_EXPORT Path operator+(const Path &lhs,const Path &rhs);
304
305
306DLL_EXPORT std::ostream &operator<<(std::ostream &stream,const Path &path);
307
308} // namespace hdf5
path to a node object
Definition: path.hpp:54
std::list< value_type >::const_reverse_iterator const_reverse_iterator
Definition: path.hpp:60
Path(const std::string &str)
constructor
size_t size() const noexcept
return number of path elements
Path(const char *str)
Path()
default constructor
Path(const_iterator first_element, const_iterator last_element)
constructor from iterators
std::list< value_type >::iterator iterator
Definition: path.hpp:57
std::list< value_type >::reverse_iterator reverse_iterator
Definition: path.hpp:59
std::string value_type
Definition: path.hpp:56
std::list< value_type >::const_iterator const_iterator
Definition: path.hpp:58
top-level namespace of the entire library
Definition: attribute.hpp:45
friend Path common_base(const Path &lhs, const Path &rhs)
checks two paths for equality base
bool operator!=(const ObjectHandle &lhs, const ObjectHandle &rhs)
not equal to operator
std::ostream & operator<<(std::ostream &stream, const IterationOrder &order)
ouput stream for iteration order enumeration
bool operator==(const ObjectHandle &lhs, const ObjectHandle &rhs)
equality operator
Iterator operator+(const Iterator &a, ssize_t b)
#define DLL_EXPORT
Definition: windows.hpp:29