OmniSciDB  a5dc49c757
 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 FilePathOptions &options)
 
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 FilePathOptions options)
inline

Definition at line 148 of file file_path_util.h.

149  : sort_regex_(options.sort_regex), sort_by_(options.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 151 of file file_path_util.h.

151  {
152  CHECK(sort_regex_.has_value());
153  boost::match_results<std::string::const_iterator> capture_groups;
154  boost::regex regex_pattern(sort_regex_.value());
155 
156  if (boost::regex_search(file_name, capture_groups, regex_pattern)) {
157  std::stringstream ss;
158  for (size_t i = 1; i < capture_groups.size(); i++) {
159  ss << capture_groups[i];
160  }
161  return ss.str();
162  }
163  return ""; // Empty strings sorted to beginning
164  }
std::optional< std::string > sort_regex_
#define CHECK(condition)
Definition: Logger.h:291
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 166 of file file_path_util.h.

166  {
167  return to_upper(sort_by_.value_or(PATHNAME_ORDER_TYPE));
168  }
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: