-
Notifications
You must be signed in to change notification settings - Fork 821
Open
Description
I need to read some json files, not controlled by me. I'm interested in a couple of nodes in those files, and they might be there or not. If they're not there, I'll live with some defaults. And there might be some other nodes I'm not interested in.
To do so, my struct would have a loading function like this:
template <class Archive>
void load( Archive & archive )
{
do
{
char const * name = archive.getNodeName();
if ( name )
{
if ( strcmp( name, "foo" ) == 0 )
{
archive( foo );
}
else if ( strcmp( name, "bar" ) == 0 )
{
archive( bar );
}
else
{
// ignore all other possible elements here
archive.skipValue();
}
}
} while ( name );
Near the end, you see a call archive.skipValue();. As far as I know, nothing like that exits.
An implementation in JSONInputArchive would be pretty simple and could look like this:
void skipValue()
{
++itsIteratorStack.back();
}
Are there some means available with the current state to achieve such behaviour?
If that's not the case, could such a function be added?
Metadata
Metadata
Assignees
Labels
No labels