std::string get_current_full_path (const std::string &name) const;
/**
- * Scan one line of input. <tt>input_filename</tt> and <tt>lineno</tt> are
- * the name of the input file and the current number of the line presently
- * scanned (for the logs if there are messages). Return <tt>false</tt> if
- * line contained stuff that could not be understood, the uppermost
- * subsection was to be left by an <tt>END</tt> or <tt>end</tt> statement, a
- * value for a non-declared entry was given or the entry value did not match
- * the regular expression. <tt>true</tt> otherwise.
+ * Scan one line of input. <tt>input_filename</tt> and <tt>current_line_n</tt>
+ * are the name of the input file and the current number of the line presently
+ * scanned (for the logs if there are messages). Return <tt>false</tt> if line
+ * contained stuff that could not be understood, the uppermost subsection was
+ * to be left by an <tt>END</tt> or <tt>end</tt> statement, a value for a
+ * non-declared entry was given or the entry value did not match the regular
+ * expression. <tt>true</tt> otherwise.
*
* The function modifies its argument, but also takes it by value, so the
* caller's variable is not changed.
*/
bool scan_line (std::string line,
const std::string &input_filename,
- const unsigned int lineno);
+ const unsigned int current_line_n);
friend class MultipleParameterLoop;
};
std::vector<std::string> saved_path = subsection_path;
std::string line;
- int lineno=0;
+ unsigned int current_line_n = 0;
bool status = true;
while (getline (input, line))
{
- ++lineno;
- status &= scan_line (line, filename, lineno);
+ ++current_line_n;
+ status &= scan_line (line, filename, current_line_n);
}
if (status && (saved_path != subsection_path))
bool
ParameterHandler::scan_line (std::string line,
const std::string &input_filename,
- const unsigned int lineno)
+ const unsigned int current_line_n)
{
// if there is a comment, delete it
if (line.find('#') != std::string::npos)
// check whether subsection exists
if (!entries->get_child_optional (get_current_full_path(subsection)))
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">: There is no such subsection to be entered: "
<< demangle(get_current_full_path(subsection)) << std::endl;
if (line.size()>0)
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">: invalid content after 'end'!" << std::endl;
return false;
if (subsection_path.size() == 0)
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">: There is no subsection to leave here!" << std::endl;
return false;
std::string::size_type pos = line.find("=");
if (pos == std::string::npos)
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">: invalid format of set expression!" << std::endl;
return false;
{
if (entries->get<std::string>(path + path_separator + "deprecation_status") == "true")
{
- std::cerr << "Warning in line <" << lineno
+ std::cerr << "Warning in line <" << current_line_n
<< "> of file <" << input_filename
<< ">: You are using the deprecated spelling <"
<< entry_name
= entries->get<unsigned int> (path + path_separator + "pattern");
if (!patterns[pattern_index]->match(entry_value))
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">:" << std::endl
<< " The entry value" << std::endl
}
else
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">: No such entry was declared:" << std::endl
<< " " << entry_name << std::endl
// the remainder must then be a filename
if (line.size() == 0)
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< "> is an include statement but does not name a file!"
<< std::endl;
std::ifstream input (line.c_str());
if (!input)
{
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< "> is an include statement but the file <"
<< line << "> could not be opened!"
}
// this line matched nothing known
- std::cerr << "Line <" << lineno
+ std::cerr << "Line <" << current_line_n
<< "> of file <" << input_filename
<< ">: This line matched nothing known ('set' or 'subsection' missing!?):" << std::endl
<< " " << line << std::endl;