Example #1
0
void IPRangeSet::write(JSON::Sink &sink) const {
  sink.beginList();

  for (unsigned i = 0; i < rangeSet.size(); i += 2)
    if (rangeSet[i] == rangeSet[i + 1])
      sink.append(IPAddress(rangeSet[i]).toString());

    else sink.append(IPAddress(rangeSet[i]).toString() + "-" +
                     IPAddress(rangeSet[i + 1]).toString());
  sink.endList();
}
Example #2
0
void Option::writeStrings(JSON::Sink &sink, const string &value,
                          const string &delims) {
  strings_t l = parseStrings(value, delims);

  sink.beginList();
  for (unsigned i = 0; i < l.size(); i++) sink.append(l[i]);
  sink.endList();
}
Example #3
0
void Option::writeDoubles(JSON::Sink &sink, const string &value,
                          const string &delims) {
  doubles_t l = parseDoubles(value, delims);

  sink.beginList();
  for (unsigned i = 0; i < value.size(); i++) {
    sink.beginAppend();
    sink.append(l[i]);
  }
  sink.endList();
}