DD4hep  1.28.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(const Path& copy) : std::string(copy) { }
54  Path(Path&& copy) : std::string(copy) { }
56  template <class Iter> Path(Iter _begin,Iter _end) {
57  if ( _begin != _end ) {
58  std::string str(_begin, _end);
59  this->std::string::operator=(str);
60  }
61  }
63  ~Path() {}
65  Path& operator=(const Path& copy) {
66  this->std::string::operator=(copy);
67  return *this;
68  }
70  Path& operator=(const std::string& copy) {
71  this->std::string::operator=(copy);
72  return *this;
73  }
76  this->std::string::operator=(copy);
77  return *this;
78  }
80  Path& operator=(std::string&& copy) {
81  this->std::string::operator=(copy);
82  return *this;
83  }
85  Path& append(const std::string& copy);
87  Path& operator/=(const Path& copy) { return append(copy); }
89  Path& operator/=(const std::string& copy) { return append(copy); }
91  Path normalize() const;
93  Path parent_path() const;
95  Path filename() const;
97  Path file_path() const;
100 
102  const std::string& native() const { return *this; }
104  const char* string_data() const { return this->std::string::c_str(); }
106  size_t parent_path_end() const;
108  class detail {
109  public:
111  static const Path& dot_path();
113  static const Path& dot_dot_path();
114  };
115  };
116 } /* End namespace dd4hep */
117 #endif // DD4HEP_PATH_H
dd4hep::Path::operator/=
Path & operator/=(const std::string &copy)
Append operation.
Definition: Path.h:89
dd4hep::Path::Path
Path(const Path &copy)
Copy constructor.
Definition: Path.h:52
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:54
dd4hep::Path::native
const std::string & native() const
String representation of thre Path object.
Definition: Path.h:102
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:75
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:65
dd4hep::Path::~Path
~Path()
Default destructor.
Definition: Path.h:63
dd4hep::Path::operator/=
Path & operator/=(const Path &copy)
Append operation.
Definition: Path.h:87
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:108
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:80
dd4hep::Path::Path
Path(Iter _begin, Iter _end)
Assigning constructor.
Definition: Path.h:56
dd4hep::Path::string_data
const char * string_data() const
String representation of thre Path object.
Definition: Path.h:104
dd4hep::Path::operator=
Path & operator=(const std::string &copy)
Assignment operator from string object.
Definition: Path.h:70
std
Definition: Plugins.h:30
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
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