27#include <unordered_map>
39std::vector<std::string>
split(std::string
const& input,
40 char delimiter =
' ');
48std::string
trim(std::string
const& line,
49 std::string
const& whitespace =
" \t");
60std::string
reduce(std::string
const& line,
61 std::string
const& whitespace =
" \t",
62 std::string
const& fill =
" ");
73std::string
pad(std::string
const& input,
79std::string
strpr(
const char* format, ...);
86std::string
cap(std::string word);
99 std::vector<std::string>
const& title,
100 std::vector<std::size_t>
const& colLength,
101 std::vector<std::string>
const& colName,
102 std::vector<std::string>
const& colInfo,
103 char const& commentChar =
'#');
112 std::vector<std::string>
const lines);
121 std::vector<std::string>
const lines);
133 std::string fileName,
134 std::vector<std::size_t> columns,
143template<
typename K,
typename V>
146 std::map<K, V>::key_type
const& key)
148 if (stdMap.find(key) == stdMap.end())
150 std::stringstream message;
151 message <<
"ERROR: No map entry found for key \"";
154 throw std::range_error(message.str());
156 return stdMap.find(key)->second;
169 return (std::find(stdVec.begin(), stdVec.end(), value) != stdVec.end());
178template<
typename T,
typename U>
180 std::unordered_map<T, U>
const& stdMap,
183 return ( stdMap.find(key) != stdMap.end() );
196 return ((*lhs) < (*rhs));
206double pow_int(
double x,
int n);
string pad(string const &input, size_t num, char fill, bool right)
string cap(string word)
Capitalize first letter of word.
string strpr(const char *format,...)
String version of printf function.
bool vectorContains(std::vector< T > const &stdVec, T value)
Test if vector contains specified value.
vector< string > createFileHeader(vector< string > const &title, vector< size_t > const &colSize, vector< string > const &colName, vector< string > const &colInfo, char const &commentChar)
string trim(string const &line, string const &whitespace)
Remove leading and trailing whitespaces from string.
vector< string > split(string const &input, char delimiter)
Split string at each delimiter.
map< size_t, vector< double > > readColumnsFromFile(string fileName, vector< size_t > columns, char comment)
string reduce(string const &line, string const &whitespace, string const &fill)
Replace multiple whitespaces with fill.
bool comparePointerTargets(T *lhs, T *rhs)
Compare pointer targets.
double pow_int(double x, int n)
Integer version of power function, "fast exponentiation algorithm".
void appendLinesToFile(ofstream &file, vector< string > const lines)
Append multiple lines of strings to open file stream.
bool unorderedMapContainsKey(std::unordered_map< T, U > const &stdMap, T key)
Test if unordered map contains specified key.
V const & safeFind(std::map< K, V > const &stdMap, typename std::map< K, V >::key_type const &key)
Safely access map entry.