DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Path.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // \author Markus Frank
11 // \date 2016-08-30
12 // \version 1.0
13 //
14 //==========================================================================
15 #ifndef DD4HEP_PATH_H
16 #define DD4HEP_PATH_H
17 
18 // Framework include files
19 
20 // C/C++ include files
21 #include <string>
22 
23 // Forward declartions
24 
26 namespace dd4hep {
27 
28 
30 
45  class Path : public std::string {
46  public:
48  Path() : std::string() { }
50  Path(const std::string& copy) : std::string(copy) { }
52  Path(std::string&& copy) : std::string(std::move(copy)) { }
54  Path(const Path& copy) : std::string(copy) { }
56  Path(Path&& copy) : std::string(std::move(copy)) { }
58  template <class Iter> Path(Iter _begin,Iter _end) {
59  if ( _begin != _end ) {
60  std::string str(_begin, _end);
61  this->std::string::operator=(std::move(str));
62  }
63  }
65  ~Path() {}
67  Path& operator=(const Path& copy) {
68  this->std::string::operator=(copy);
69  return *this;
70  }
72  Path& operator=(const std::string& copy) {
73  this->std::string::operator=(copy);
74  return *this;
75  }
78  this->std::string::operator=(std::move(copy));
79  return *this;
80  }
82  Path& operator=(std::string&& copy) {
83  this->std::string::operator=(std::move(copy));
84  return *this;
85  }
87  Path& append(const std::string& copy);
89  Path& operator/=(const Path& copy) { return append(copy); }
91  Path& operator/=(const std::string& copy) { return append(copy); }
93  Path normalize() const;
95  Path parent_path() const;
97  Path filename() const;
99  Path file_path() const;
102 
104  const std::string& native() const { return *this; }
106  const char* string_data() const { return this->std::string::c_str(); }
108  size_t parent_path_end() const;
110  class detail {
111  public:
113  static const Path& dot_path();
115  static const Path& dot_dot_path();
116  };
117  };
118 } /* End namespace dd4hep */
119 #endif // DD4HEP_PATH_H
dd4hep::Path::operator/=
Path & operator/=(const std::string &copy)
Append operation.
Definition: Path.h:91
dd4hep::Path::Path
Path(const Path &copy)
Copy constructor.
Definition: Path.h:54
dd4hep::Path::append
Path & append(const std::string &copy)
Append operation.
Definition: Path.cpp:108
dd4hep::Path::detail::dot_dot_path
static const Path & dot_dot_path()
Path representing "..".
Definition: Path.cpp:103
dd4hep::Path::remove_filename
Path & remove_filename()
Manipulator: remove the file name part. Leaves the parent path.
Definition: Path.cpp:201
dd4hep::Path::Path
Path(Path &&copy)
Move constructor.
Definition: Path.h:56
dd4hep::Path::native
const std::string & native() const
String representation of thre Path object.
Definition: Path.h:104
dd4hep::Path::Path
Path(const std::string &copy)
Initializing constructor.
Definition: Path.h:50
dd4hep::Path::operator=
Path & operator=(Path &&copy)
Move assignment operator from Path object.
Definition: Path.h:77
dd4hep::Path::filename
Path filename() const
The file name of the path.
Definition: Path.cpp:211
dd4hep::Path::operator=
Path & operator=(const Path &copy)
Assignment operator from Path object.
Definition: Path.h:67
dd4hep::Path::~Path
~Path()
Default destructor.
Definition: Path.h:65
dd4hep::Path::operator/=
Path & operator/=(const Path &copy)
Append operation.
Definition: Path.h:89
dd4hep::Path::file_path
Path file_path() const
The full file path of the object.
Definition: Path.cpp:222
dd4hep::Path::detail
Helpers.
Definition: Path.h:110
dd4hep::Path::normalize
Path normalize() const
Normalize path name.
Definition: Path.cpp:114
dd4hep::Path::parent_path_end
size_t parent_path_end() const
Index of the parent's path end.
Definition: Path.cpp:185
dd4hep::Path::operator=
Path & operator=(std::string &&copy)
Assignment operator from string object.
Definition: Path.h:82
dd4hep::Path::Path
Path(Iter _begin, Iter _end)
Assigning constructor.
Definition: Path.h:58
dd4hep::Path::string_data
const char * string_data() const
String representation of thre Path object.
Definition: Path.h:106
dd4hep::Path::operator=
Path & operator=(const std::string &copy)
Assignment operator from string object.
Definition: Path.h:72
std
Definition: Plugins.h:30
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::Path::Path
Path(std::string &&copy)
Initializing constructor.
Definition: Path.h:52
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::Path::Path
Path()
Default constructor.
Definition: Path.h:48
dd4hep::Path::detail::dot_path
static const Path & dot_path()
Path representing ".".
Definition: Path.cpp:99
dd4hep::Path
Path handling class.
Definition: Path.h:45
dd4hep::Path::parent_path
Path parent_path() const
Parent's path.
Definition: Path.cpp:206