16 bool Label::isClear_ =
true;
17 bool Label::isMatched_ =
false;
18 std::string Label::input_;
46 : isRequired_(isRequired),
54 : isRequired_(isRequired),
62 : isRequired_(isRequired),
70 : isRequired_(other.isRequired_),
71 string_(other.string_)
109 if (label.isClear_) {
112 UTIL_THROW(
"istream::fail() before reading Label");
116 if (label.input_.size() != 0) {
117 label.isClear_ =
false;
120 Log::file() <<
"Empty required label" << std::endl;
121 Log::file() <<
"Expected: " << label.string_ << std::endl;
122 UTIL_THROW(
"Empty required label after read");
127 Log::file() <<
"End-of-file before reading required Label" 129 Log::file() <<
"Expected: " << label.string_ << std::endl;
130 UTIL_THROW(
"EOF before reading required label");
132 Label::input_.clear();
133 Label::isClear_ =
true;
134 Label::isMatched_ =
false;
139 if (label.input_ == label.string_) {
140 Label::input_.clear();;
141 Label::isClear_ =
true;
142 Label::isMatched_ =
true;
144 Label::isMatched_ =
false;
145 if (label.isRequired_) {
146 Log::file() <<
"Error reading label" << std::endl;
147 Log::file() <<
"Expected: " << label.string_ << std::endl;
148 Log::file() <<
"Scanned: " << label.input_ << std::endl;
static const int LabelWidth
Width of label field in file output format.
bool isRequired() const
Is this the label for a required component?
static bool isClear()
Is the input buffer clear?
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
std::string string() const
Return label string.
virtual ~Label()
Destructor.
Utility classes for scientific computation.
friend std::ostream & operator<<(std::ostream &out, Label label)
Inserter for Label.
void setString(std::string string)
Set the label string.
A label string in a file format.
static std::ostream & file()
Get log ostream by reference.
bool match(std::istream &in)
Read and attempt to match next word in an input stream.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
friend std::istream & operator>>(std::istream &in, Label label)
Extractor for Label.
Label(bool isRequired=true)
Constructor.
static void clear()
Reset buffer and flags to initial state.