30#include "neml2/misc/parser_utils.h"
31#include "csvparser/csv.hpp"
39std::stringstream &
operator>>(std::stringstream &, Sequence<T> &);
74 operator std::vector<T>()
const;
77 std::vector<T>
vec()
const;
83 const std::string &
raw()
const {
return _raw_str; }
118 if (_raw_str.empty())
119 return std::vector<T>();
123 auto str_vec = utils::parse_vector<std::string>(_raw_str);
128 v.push_back(utils::parse<T>(
s));
137 return {utils::parse<T>(
str_vec[0])};
163 v.push_back(utils::parse<T>(
row[
col].get<std::string>()));
165 catch (std::exception &
e)
167 throw NEMLException(
"The following error was thrown while reading the CSV column '" + _raw_str +
187 seq._raw_str =
ss.str();
188 ss.setstate(std::ios_base::eofbit);
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:52
const std::string & raw() const
Get the raw string literal.
Definition CrossRef.h:79
A lazily parsed sequence of data.
Definition Sequence.h:62
std::vector< T > vec() const
Convert to a vector.
Definition Sequence.h:115
Sequence< T > & operator=(const std::string &other)
Assignment operator.
Definition Sequence.h:101
const std::string & raw() const
Get the raw string literal.
Definition Sequence.h:83
bool operator==(const Sequence< T > &other) const
Test equality.
Definition Sequence.h:80
std::string trim(const std::string &str, const std::string &white_space)
Definition parser_utils.cxx:76
Definition CrossRef.cxx:32
std::ostream & operator<<(std::ostream &os, const OptionCollection &p)
Definition OptionCollection.cxx:37
std::stringstream & operator>>(std::stringstream &, CrossRef< T > &)
Definition CrossRef.h:113