13 const std::string OutputFormat::_labels[
LAST_VALUE] =
14 {
"Short",
"Full",
"JSON",
"PROTOBUF" };
17 const char OutputFormat::_formatLabels[
LAST_VALUE] = {
'S',
'F',
'J',
'P' };
21 OutputFormat::OutputFormat() : _format (
LAST_VALUE) {
28 : _format (iOutputFormat._format) {
34 : _format (iOutputFormat) {
41 switch (iFormatChar) {
42 case 'S': oFormat =
SHORT;
break;
43 case 'F': oFormat =
FULL;
break;
44 case 'J': oFormat =
JSON;
break;
51 std::ostringstream oMessage;
52 oMessage <<
"The output format '" << iFormatChar
53 <<
"' is not known. Known output formats: " << lLabels;
61 OutputFormat::OutputFormat (
const char iFormatChar)
62 : _format (getFormat (iFormatChar)) {
67 OutputFormat (
const std::string& iFormatStr) {
69 const size_t lSize = iFormatStr.size();
71 const char lFormatChar = iFormatStr[0];
78 return _labels[iFormat];
84 return _formatLabels[iFormat];
90 std::ostringstream oStr;
91 oStr << _formatLabels[iFormat];
97 std::ostringstream ostr;
98 for (
unsigned short idx = 0; idx !=
LAST_VALUE; ++idx) {
102 ostr << _labels[idx];
115 const char oFormatChar = _formatLabels[_format];
121 std::ostringstream oStr;
122 oStr << _formatLabels[_format];
128 std::ostringstream ostr;
129 ostr << _labels[_format];
136 return (_format == iFormat);