TinyTinni / ValveFileVDF

C++ Parser and Writer for Valve Data Format (e.g. .vdf files used in steam)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No support of multiple keys

aKalisch opened this issue · comments

Valve officially supports multiple keys.

for example:

"keys0"
{
    "item1"
    {
        // ...
    }
    "item2"
    {
        // ...
    }
    "item1"
    {
        // ...
    }
}

This is currently not supported since it just picks the last item of a "KeyValue" block.

Thanks,
the problem is the container type in basic_object.
Changing it from unordered_map to unordered_multimap should solve the problem.

I will not upload it since i am not sure, if i want one object which gets returned or where the returned object can be customized with a) allow multiple keys and/or b) keep the order (not saved in a map, but in a e.g. vector) or nothing of both options.

added new functions.
Use tyti::vdf::read<tyti::vdf::multikey_object>(...)
It will return the same object as before, just with a multimap instead of a map (and therefore, no [] operator for item access)
Also updated the readme.