DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Path.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation for LCD
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_DDCORE_PATH_H
16 #define DD4HEP_DDCORE_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& c) : std::string(c) { }
52  Path(const Path& c) : std::string(c) { }
54  template <class Iter> Path(Iter _begin,Iter _end) {
55  if ( _begin != _end ) {
56  std::string s(_begin, _end);
57  this->std::string::operator=(s);
58  }
59  }
61  ~Path() {}
63  Path& operator=(const Path& c) {
64  this->std::string::operator=(c);
65  return *this;
66  }
68  Path& operator=(const std::string& c) {
69  this->std::string::operator=(c);
70  return *this;
71  }
73  Path& append(const std::string& c);
75  Path& operator/=(const Path& c) { return append(c); }
77  Path& operator/=(const std::string& c) { return append(c); }
79  Path normalize() const;
81  Path parent_path() const;
83  Path filename() const;
85  Path file_path() const;
88 
90  const std::string& native() const { return *this; }
92  const char* string_data() const { return this->std::string::c_str(); }
94  size_t parent_path_end() const;
96  class detail {
97  public:
99  static const Path& dot_path();
101  static const Path& dot_dot_path();
102  };
103  };
104 } /* End namespace DD4hep */
105 #endif /* DD4HEP_DDCORE_PATH_H */
Path(Iter _begin, Iter _end)
Assigning constructor.
Definition: Path.h:54
Path filename() const
The file name of the path.
Definition: Path.cpp:209
Path & operator/=(const Path &c)
Append operation.
Definition: Path.h:75
static const Path & dot_dot_path()
Path representing "..".
Definition: Path.cpp:101
static const Path & dot_path()
Path representing ".".
Definition: Path.cpp:97
Path handling class.
Definition: Path.h:45
Path(const Path &c)
Copy constructor.
Definition: Path.h:52
TGeoShape * s
Definition: Volumes.cpp:294
size_t parent_path_end() const
Index of the parent's path end.
Definition: Path.cpp:183
const char * string_data() const
String representation of thre Path object.
Definition: Path.h:92
Path & append(const std::string &c)
Append operation.
Definition: Path.cpp:106
Path parent_path() const
Parent's path.
Definition: Path.cpp:204
Path file_path() const
The full file path of the object.
Definition: Path.cpp:220
Path(const std::string &c)
Initializing constructor.
Definition: Path.h:50
Path()
Default constructor.
Definition: Path.h:48
Path & remove_filename()
Manipulator: remove the file name part. Leaves the parent path.
Definition: Path.cpp:199
Path & operator=(const Path &c)
Assignment operator from Path object.
Definition: Path.h:63
~Path()
Default destructor.
Definition: Path.h:61
const std::string & native() const
String representation of thre Path object.
Definition: Path.h:90
Path normalize() const
Normalize path name.
Definition: Path.cpp:112
Helpers.
Definition: Path.h:96
Path & operator=(const std::string &c)
Assignment operator from string object.
Definition: Path.h:68
Path & operator/=(const std::string &c)
Append operation.
Definition: Path.h:77