Skip to content

Instantly share code, notes, and snippets.

@Gocrazy
Created January 13, 2014 15:04
Show Gist options
  • Select an option

  • Save Gocrazy/8401850 to your computer and use it in GitHub Desktop.

Select an option

Save Gocrazy/8401850 to your computer and use it in GitHub Desktop.
#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