DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
CppUtils::Files::AsColumns Class Reference

#include <columnStrategy.hpp>

Public Member Functions

auto operator() (const std::string &fileContents_, const std::optional< std::string > &fieldSeparator_=std::nullopt) const
 

Private Member Functions

void resetColumnsOnNewLine (std::size_t tokenIndex_, std::size_t &columnIndex_) const
 
void trimTrainingSeparators () const
 

Private Attributes

std::vector< std::string > columnCache
 

Member Function Documentation

◆ resetColumnsOnNewLine()

void CppUtils::Files::AsColumns::resetColumnsOnNewLine ( std::size_t tokenIndex_,
std::size_t & columnIndex_ ) const
inlineprivate

References columnCache.

Referenced by operator()().

◆ trimTrainingSeparators()

void CppUtils::Files::AsColumns::trimTrainingSeparators ( ) const
inlineprivate

References columnCache.

Referenced by operator()().

◆ operator()()

auto CppUtils::Files::AsColumns::operator() ( const std::string & fileContents_,
const std::optional< std::string > & fieldSeparator_ = std::nullopt ) const
inline

A file parser strategy used for splitting the data in a text file into columns.

Parameters
fileContents- The content of a file read in to a std::string
fieldSeparator- The separator between data fields in the file (optional)
Returns
A std::vector<std::string> where each element of the vector is a column from the file.

References columnCache, resetColumnsOnNewLine(), CppUtils::Strings::Tokenizer< CharTraits >::split(), and trimTrainingSeparators().

Member Data Documentation

◆ columnCache

std::vector<std::string> CppUtils::Files::AsColumns::columnCache
mutableprivate

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