Esempio n. 1
0
static void serializeElement(MemoryBuffer & target, IDefRecordElement * elem)
{
    byte kind = elem ? elem->getKind() : DEKnone;
    target.append(kind);
    switch (kind)
    {
    case DEKnone:
        break;
    case DEKrecord:
        {
            size32_t maxSize = elem->getMaxSize();
            unsigned numChildren = elem->numChildren();
            target.append(maxSize).append(numChildren);
            for (unsigned i=0; i < numChildren; i++)
                serializeElement(target, elem->queryChild(i));
            break;
        }
    case DEKifblock:
        {
            IValue * value = elem->queryCompareValue();
            serializeValue(target, value);
            serializeElement(target, elem->queryChild(0));
            serializeElement(target, elem->queryChild(1));
            break;
        }
    case DEKfield:
        {
            _ATOM name = elem->queryName();
            ITypeInfo * type = elem->queryType();
            size32_t maxSize = elem->getMaxSize();
            serializeAtom(target, name);
            type->serialize(target);
            serializeElement(target, elem->queryChild(0));
            target.append(maxSize);
            break;
        }
    default:
        throwUnexpected();
    }
}
Esempio n. 2
0
void Text::serialize(ObjectOutputStream & out) {
	XOJ_CHECK_TYPE(Text);

	out.writeObject("Text");

	serializeElement(out);

	out.writeString(this->text);

	font.serialize(out);

	out.endObject();
}
Esempio n. 3
0
void Image::serialize(ObjectOutputStream & out) {
	XOJ_CHECK_TYPE(Image);

	out.writeObject("Image");

	serializeElement(out);

	out.writeDouble(this->width);
	out.writeDouble(this->height);

	out.writeImage(this->image);

	out.endObject();
}
Esempio n. 4
0
static void doSerializeRecordMeta(MemoryBuffer & target, IDefRecordMeta * meta)
{
    serializeElement(target, meta->queryRecord());
    target.append(meta->numKeyedFields());
}
Esempio n. 5
0
QDomElement PListSerializer::serializeList(QDomDocument &doc, const QVariantList &list) {
	QDomElement element = doc.createElement(QStringLiteral("array"));
	foreach(QVariant item, list) {
		element.appendChild(serializeElement(doc, item));
	}