added -N argument to read command

This commit is contained in:
john30
2017-04-22 16:06:52 +02:00
parent 586a21fc9f
commit b9a9e7ba53
3 changed files with 33 additions and 16 deletions
+9 -1
View File
@@ -718,8 +718,16 @@ result_t ValueListDataField::readSymbols(const SymbolString& input,
} else if (outputFormat & OF_NUMERIC) {
output << setw(0) << dec << static_cast<unsigned>(value);
} else if (outputFormat & OF_JSON) {
output << '"' << it->second << '"';
if (outputFormat & OF_VALUENAME) {
output << "{\"value\":" << setw(0) << dec << static_cast<unsigned>(value);
output << ",\"name\":\"" << it->second << "\"}";
} else {
output << '"' << it->second << '"';
}
} else {
if (outputFormat & OF_VALUENAME) {
output << setw(0) << dec << static_cast<unsigned>(value) << '=';
}
output << it->second;
}
return RESULT_OK;
+6 -3
View File
@@ -94,14 +94,17 @@ typedef int OutputFormat;
/** bit flag for @a OutputFormat: numeric format (keep numeric value of value=name pairs). */
#define OF_NUMERIC 0x08
/** bit flag for @a OutputFormat: value=name format for such pairs. */
#define OF_VALUENAME 0x10
/** bit flag for @a OutputFormat: JSON format. */
#define OF_JSON 0x10
#define OF_JSON 0x20
/** bit flag for @a OutputFormat: short format (only name and value, no indentation). */
#define OF_SHORT 0x20
#define OF_SHORT 0x40
/** bit flag for @a OutputFormat: include all attributes. */
#define OF_ALL_ATTRS 0x40
#define OF_ALL_ATTRS 0x80
/** the message part in which a data field is stored. */
enum PartType {