You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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:
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: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?
The text was updated successfully, but these errors were encountered: