Exemplo n.º 1
0
bool Writer::writeStartObject()
{
	writeComma();
	fprintf(_file, "{");
	_comma = false;
	return true;
}
Exemplo n.º 2
0
bool Writer::writeName(const char *name)
{
	writeComma();
	_comma = false;
	fprintf(_file, "\"%s\" : ", name);
	return true;
}
void JsonDrooler::writeValueArrayComma()
{
        if(!openArrays.empty() && openArrays.top().isValueArray)
        {
                writeComma();
                file << tabsForLevel();
        }
}
bool JsonDrooler::push(const String childName)
{
        writeComma();
        //has a name // workaround for objects in arrays
        if(!childName.empty())
        {
                file << tabsForLevel() << '"' << childName << '"' << ": " << SYSTEM_NEW_LINE;
        }
        file << tabsForLevel() << '{' << SYSTEM_NEW_LINE;
        ++level;
        isFirstElement = true;
        return true;
}
void JsonDrooler::describeArray(const String arrayName, const String elementsName, unsigned int size)
{
        JsonWriterArray newArray;
        newArray.size = size;
        newArray.nameOfArray = arrayName;
        newArray.isValueArray = false;
        openArrays.push(newArray);

        writeComma();
        file << tabsForLevel() << '"' << arrayName << "\": " << SYSTEM_NEW_LINE << tabsForLevel() << '[' << SYSTEM_NEW_LINE;

        ++level;
        isFirstElement = true;
}
Exemplo n.º 6
0
  size_t handleMarkupChar(uint8_t c) {
    switch (c) {
      case '{':
      case '[':
        return writeBlockOpen(c);

      case '}':
      case ']':
        return writeBlockClose(c);

      case ':':
        return writeColon();

      case ',':
        return writeComma();

      case '"':
        return writeQuoteOpen();

      default:
        return writeNormalChar(c);
    }
  }
void JsonDrooler::describeName(const String name)
{
        writeComma();
        file << tabsForLevel() << '"' << name << '"' << ": ";
}