KrisLibrary
1.0.0
|
An any-schema is a simple validation and mapping scheme for AnyCollections. The keys in the document must match up with the schema. More...
#include <AnyMapper.h>
Public Member Functions | |
Wildcard (int _id) | |
Public Attributes | |
int | id |
An any-schema is a simple validation and mapping scheme for AnyCollections. The keys in the document must match up with the schema.
AnyCollection schema; schema["foo"]=_0; schema["bar"]=5; AnyCollection item; item["foo"]=4; item["bar"]=5;
AnyCollection matches; Match(item,schema) [returns true] Match(item,schema,matches) [returns true, sets matches to the map {0:4}]
They can also be used to map matched items to new schemas AnyCollection outschema,result; outschema["foo2"]=_0; outschema["bar2"]=10; Fill(outschema,matches,result) [returns true, fills result with {"foo2":4,"bar2":10}]
This can also be done in a single step: MatchAndFill(item,schema,outschema,result);A placeholder in an any-schema. The special value -1 matches everything.