Public Member Functions | Private Attributes | List of all members
art::detail::FileNameComponents Class Reference

#include <FileNameComponents.h>

Public Member Functions

void add (std::string const &prefix, std::string const &digitFormat)
 
void setSuffix (std::string suffix)
 
std::string fileNameWithIndex (std::size_t index) const
 
bool operator< (FileNameComponents const &fnc) const
 

Private Attributes

std::vector< std::pair< std::string, std::string > > components_
 
std::string suffix_ {}
 

Detailed Description

Definition at line 28 of file FileNameComponents.h.

Member Function Documentation

void art::detail::FileNameComponents::add ( std::string const &  prefix,
std::string const &  digitFormat 
)

Definition at line 11 of file FileNameComponents.cc.

13  {
14  components_.emplace_back(prefix, digitFormat);
15  }
std::vector< std::pair< std::string, std::string > > components_
std::string art::detail::FileNameComponents::fileNameWithIndex ( std::size_t  index) const

Definition at line 45 of file FileNameComponents.cc.

46  {
47  std::ostringstream num_str;
48  for (auto const& pr : components_) {
49  auto const& prefix = pr.first;
50  auto const& specifier = pr.second;
51  num_str << prefix;
52  if (!specifier.empty()) { // Zero-filling.
53  num_str << std::setfill('0') << std::setw(std::stoul(specifier));
54  }
55  num_str << index;
56  }
57  num_str << suffix_;
58  return num_str.str();
59  }
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
std::vector< std::pair< std::string, std::string > > components_
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
bool art::detail::FileNameComponents::operator< ( FileNameComponents const &  fnc) const

Definition at line 24 of file FileNameComponents.cc.

25  {
26  if (components_.size() < fnc.components_.size()) {
27  return true;
28  }
29  if (components_.size() > fnc.components_.size()) {
30  return false;
31  }
32 
33  assert(components_.size() == fnc.components_.size());
34  auto b1 = cbegin(components_), e1 = cend(components_);
35  auto b2 = cbegin(fnc.components_);
36  for (; b1 != e1; ++b1, ++b2) {
37  if (b1->first < b2->first)
38  return true;
39  }
40  assert(b2 == cend(fnc.components_));
41  return false;
42  }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:82
std::vector< std::pair< std::string, std::string > > components_
void art::detail::FileNameComponents::setSuffix ( std::string  suffix)

Definition at line 18 of file FileNameComponents.cc.

19  {
20  suffix_ = move(suffix);
21  }
def move(depos, offset)
Definition: depos.py:107

Member Data Documentation

std::vector<std::pair<std::string, std::string> > art::detail::FileNameComponents::components_
private

Definition at line 39 of file FileNameComponents.h.

std::string art::detail::FileNameComponents::suffix_ {}
private

Definition at line 40 of file FileNameComponents.h.


The documentation for this class was generated from the following files: