Created
January 13, 2014 15:04
-
-
Save Gocrazy/8401850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "smaato_parsing.h" | |
| #include "soa/types/json_parsing.h" | |
| using namespace Smaato; | |
| using namespace std; | |
| namespace Datacratic { | |
| DefaultDescription<BidRequest>:: | |
| DefaultDescription() | |
| { | |
| onUnknownField = [=] (BidRequest * br, JsonParsingContext & context) | |
| { | |
| cerr << "got unknown field " << context.printPath() << endl; | |
| /*std::function<Json::Value & (int, Json::Value &)> getEntry | |
| = [&] (int n, Json::Value & curr) -> Json::Value & | |
| { | |
| if (n == context.path.size()) | |
| return curr; | |
| else if (context.path[n].index != -1) | |
| return getEntry(n + 1, curr[context.path[n].index]); | |
| else return getEntry(n + 1, curr[context.path[n].fieldName()]); | |
| }; | |
| getEntry(0, br->unparseable) = = context.expectJson(); | |
| */ | |
| }; | |
| addField("at", &BidRequest::at, "Type of auction: 1(st) or 2(nd)"); | |
| addField("device", &BidRequest::device, "Information about the device on which the request was made"); | |
| addField("ext", &BidRequest::ext, "Extended fields outside of protocol"); | |
| addField("id", &BidRequest::id, "Bid Request ID"); | |
| addField("imp", &BidRequest::imp, "Impressions"); | |
| addField("site", &BidRequest::site, "Information about site the request is on"); | |
| addField("app", &BidRequest::app, "Information about the app the request is being shown in"); | |
| addField("user", &BidRequest::user, "Information about the user who is making the request"); | |
| addField("unparseable", &BidRequest::unparseable, "Unparseable fields are collected here"); | |
| } | |
| } // namespace Datacratic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment