OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
shared::FileOrderBase< T > Class Template Referenceabstract

#include <file_path_util.h>

Public Member Functions

 FileOrderBase (const std::optional< std::string > &sort_regex, const std::optional< std::string > &sort_by)
 
virtual std::string concatCaptureGroups (const std::string &file_name) const
 
virtual std::string getSortBy ()
 
virtual T getFileComparator ()=0
 

Protected Attributes

std::optional< std::string > sort_regex_
 
std::optional< std::string > sort_by_
 

Detailed Description

template<class T>
class shared::FileOrderBase< T >

Definition at line 146 of file file_path_util.h.

Constructor & Destructor Documentation

template<class T>
shared::FileOrderBase< T >::FileOrderBase ( const std::optional< std::string > &  sort_regex,
const std::optional< std::string > &  sort_by 
)
inline

Definition at line 148 of file file_path_util.h.

150  : sort_regex_(sort_regex), sort_by_(sort_by) {}
std::optional< std::string > sort_regex_
std::optional< std::string > sort_by_

Member Function Documentation

template<class T>
virtual std::string shared::FileOrderBase< T >::concatCaptureGroups ( const std::string &  file_name) const
inlinevirtual

Definition at line 152 of file file_path_util.h.

152  {
153  CHECK(sort_regex_.has_value());
154  boost::match_results<std::string::const_iterator> capture_groups;
155  boost::regex regex_pattern(sort_regex_.value());
156 
157  if (boost::regex_search(file_name, capture_groups, regex_pattern)) {
158  std::stringstream ss;
159  for (size_t i = 1; i < capture_groups.size(); i++) {
160  ss << capture_groups[i];
161  }
162  return ss.str();
163  }
164  return ""; // Empty strings sorted to beginning
165  }
std::optional< std::string > sort_regex_
#define CHECK(condition)
Definition: Logger.h:211
template<class T>
virtual T shared::FileOrderBase< T >::getFileComparator ( )
pure virtual
template<class T>
virtual std::string shared::FileOrderBase< T >::getSortBy ( )
inlinevirtual

Definition at line 167 of file file_path_util.h.

167  {
168  return to_upper(sort_by_.value_or(PATHNAME_ORDER_TYPE));
169  }
const std::string PATHNAME_ORDER_TYPE
std::string to_upper(const std::string &str)
std::optional< std::string > sort_by_

Member Data Documentation

template<class T>
std::optional<std::string> shared::FileOrderBase< T >::sort_by_
protected
template<class T>
std::optional<std::string> shared::FileOrderBase< T >::sort_regex_
protected

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