X-Git-Url: http://www.andromeda.nl/gitweb/?a=blobdiff_plain;f=account.cpp;fp=account.cpp;h=ea071d6fd8fe1b8aba4f6c0f5c0b20e13b51daa9;hb=a3a605575dbaeb52ff352afd1b78ffaaf2c413e6;hp=ef1d0b80df2c6d0a244d95643ec306dcca695221;hpb=03647c648b72bd5b89c331ae3ed65634d920ff48;p=account.git diff --git a/account.cpp b/account.cpp index ef1d0b8..ea071d6 100644 --- a/account.cpp +++ b/account.cpp @@ -379,7 +379,7 @@ void Ledger::XML_saldi(std::ostream &s, date period_begin, date period_end) int i; s << "\n"; - s << "\n"; + s << "\n"; s << "\n"; for (i=0; i> A) - accs[nr_accs++] = A; + while (in) + { + in.get(line_begin); + if (isdigit(line_begin)) + { + in.putback(line_begin); + in >> A; + accs[nr_accs++] = A; + } + else if (line_begin == '$') + { + // Optional attributes + String attribute; + String a_name, a_value; + + in >> attribute; + + int separator = attribute.index('='); + do + { + separator--; + } + while (isspace(attribute[separator])); + a_name = attribute(0, separator+1); + + separator = attribute.index('='); + do + { + separator++; + } + while (isspace(attribute[separator])); + a_value = attribute; + a_value(0, separator) = ""; + + if (a_name == "companyname") + { + companyname = a_value; + } + else + { + std::cerr << "Unrecognized attribute in Ledger: " << a_name << "\n"; + } + } + else if (line_begin == '\n') + { + // Ignore empty lines + } + else + { + // Anything else is comment: eat it. + String comment; + in >> comment; + } + } accs[nr_accs].Name() = String("Rekening bestaat niet"); }