Esempio n. 1
0
void BaseEntity::SerializeProperties(IPropertyContainer *container, SerializableNodeObject *parent)
{
    int count = container->GetNumProperties();
    auto props = container->GetProperties();

    SerializableNodeArray* nPropContainer = new SerializableNodeArray("properties");

    for (int i = 0; i < count; ++i)
    {
        auto p = props[i];
        PropertyDescriptor* desc = p->GetDescriptor();

        if (desc->CanSerialize)
        {
            auto propObject = new SerializableNodeObject();

            desc->Serialize(propObject);

            propObject->AddChild(new SerializableProperty("Value", p->GetString().c_str()));

            nPropContainer->AddChild(propObject);
        }
    }

    parent->AddChild(nPropContainer);
}