Exemplo n.º 1
0
      void
      toJSON(std::ostream& os, const char* label, unsigned nindent, char prefix = ',') const
      {
        const char* indent = indentJSON(nindent);
        const char* indent_next = indentJSON(nindent + 2);

        os << prefix << '\n' << indent << '"' << label << "\": ";

        if (m_msg == NULL)
        {
          os << "\"null\"";
        }
        else
        {
          os << "{\n" << indent_next << "\"abbrev\": \"" << m_msg->getName() << '"';
          m_msg->fieldsToJSON(os, nindent + 2);
          os << '\n' << indent << "}";
        }
      }
Exemplo n.º 2
0
 inline void
 toJSON(std::ostream& os, const char* label, const std::string& value, unsigned nindent, char prefix)
 {
   const char* indent = indentJSON(nindent);
   os << prefix << '\n' << indent << '"' << label << "\": \"" << value << '"';
 }
Exemplo n.º 3
0
 inline void
 toJSON(std::ostream& os, const char* label, const std::vector<char>& value, unsigned nindent, char prefix)
 {
   const char* indent = indentJSON(nindent);
   os << prefix << '\n' << indent << '"' << label << "\": \"" << Utils::String::toHex(value) << '"';
 }