File: get.cc

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (38 lines) | stat: -rw-r--r-- 873 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//#define XERR "configlines"
#include "configlines.ih"

    // by parser/load2.cc

bool ConfigLines::get()
{
    if (d_redo)
    {
        d_redo = false;
        return d_iter != d_config.end();
    }

    while (d_iter != d_config.end())
    {
        string const &line = d_iter->line();

        if (line.empty() or isspace(line.front()))      // skip empty lines
        {
            ++d_iter;
            continue;
        }

        d_line = d_iter->line();
        d_lineNr = d_iter->lineNr();
        d_tail = d_iter->tail();
        d_value = d_iter->value();

        d_key = d_iter->key();
        if (d_key.empty())                              // no key -> store
            d_key = d_line;                             // the line as key

        ++d_iter;
        return true;
    }

    return false;                                       // end of file
}