FileNameComponents.h
Go to the documentation of this file.
1 #ifndef art_Framework_IO_detail_FileNameComponents_h
2 #define art_Framework_IO_detail_FileNameComponents_h
3 
4 //=====================================================================
5 // The FileNameComponents class breaks the following type of pattern:
6 //
7 // "run1_aladdin_%#_and_jasmine_%03#.root"
8 //
9 // into the components:
10 //
11 // ("run1_aladdin_", "")
12 // ("_and_jasmine_", "03")
13 //
14 // with the suffix ".root". With these components and suffix, the
15 // following filename is assembled whenever a call of (e.g.)
16 // fileNameWithIndex(4) is made:
17 //
18 // "run1_aladdin_4_and_jasmine_004.root"
19 //
20 //=====================================================================
21 
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
26 namespace art::detail {
27 
29  public:
30  void add(std::string const& prefix, std::string const& digitFormat);
31 
32  void setSuffix(std::string suffix);
33 
34  std::string fileNameWithIndex(std::size_t index) const;
35 
36  bool operator<(FileNameComponents const& fnc) const;
37 
38  private:
39  std::vector<std::pair<std::string, std::string>> components_;
41  };
42 
44 }
45 
46 #endif /* art_Framework_IO_detail_FileNameComponents_h */
47 
48 // Local Variables:
49 // mode: c++
50 // End:
std::string string
Definition: nybbler.cc:12
bool operator<(FileNameComponents const &fnc) const
void setSuffix(std::string suffix)
FileNameComponents componentsFromPattern(std::string const &pattern)
std::string fileNameWithIndex(std::size_t index) const
void add(std::string const &prefix, std::string const &digitFormat)
std::string pattern
Definition: regex_t.cc:35
std::vector< std::pair< std::string, std::string > > components_