Helper for mapping JSON objects onto protocol structs.
More...
#include "llvm/Support/JSON.h"
Helper for mapping JSON objects onto protocol structs.
Example:
return O && O.map("mandatory_field", R.MandatoryField) &&
O.mapOptional("optional_field", R.OptionalField);
}
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ObjectMapper(const Value &E, Path P)
If O is not an object, this mapper is invalid and an error is reported.
A "cursor" marking a position within a Value.
A Value is an JSON value of unknown type.
bool fromJSON(const Value &E, std::string &Out, Path P)
Definition at line 861 of file JSON.h.
◆ ObjectMapper()
If O is not an object, this mapper is invalid and an error is reported.
Definition at line 864 of file JSON.h.
References E().
◆ map() [1/2]
Maps a property to a field, if it exists.
If the property exists and is invalid, reports an error. (Optional requires special handling, because missing keys are OK).
Definition at line 886 of file JSON.h.
References assert(), E(), and llvm::json::fromJSON().
◆ map() [2/2]
◆ mapOptional()
Maps a property to a field, if it exists.
If the property exists and is invalid, reports an error. If the property does not exist, Out is unchanged.
Definition at line 897 of file JSON.h.
References assert(), E(), llvm::json::fromJSON(), and T.
◆ operator bool()
llvm::json::ObjectMapper::operator bool |
( |
| ) |
const |
|
inline |
True if the expression is an object.
Must be checked before calling map().
Definition at line 871 of file JSON.h.
The documentation for this class was generated from the following file: