// generated file, do not modify! <<<<<<< 3b50722f433ec5ecc515ea1441fd633d85118cb9 // 2016-03-01T13:00:40.810157000000Z ======= // 2016-03-20T21:42:12.996366000000Z >>>>>>> working c# backend #include "LambdaCube.TypeInfo.hpp" template<> json toJSON>(std::shared_ptr &v) { json obj({}); switch (v->tag) { case ::Range::tag::Range: obj["tag"] = "Range"; { std::shared_ptr tv = std::static_pointer_cast(v); obj["startLine"] = toJSON(tv->startLine); obj["startColumn"] = toJSON(tv->startColumn); obj["endLine"] = toJSON(tv->endLine); obj["endColumn"] = toJSON(tv->endColumn); } break; } return obj; } template<> std::shared_ptr fromJSON>(W> v, json &obj) { enum ::Range::tag tagType; std::string tag = obj["tag"]; if (tag == "Range") { tagType = ::Range::tag::Range; std::shared_ptr tv(new data::Range()); tv->startLine = fromJSON(W(), obj["startLine"]); tv->startColumn = fromJSON(W(), obj["startColumn"]); tv->endLine = fromJSON(W(), obj["endLine"]); tv->endColumn = fromJSON(W(), obj["endColumn"]); return tv; } else throw "unknown constructor: " + tag; std::shared_ptr<::Range> o(new ::Range()); o->tag = tagType; return o; } template<> json toJSON>(std::shared_ptr &v) { json obj({}); switch (v->tag) { case ::TypeInfo::tag::TypeInfo: obj["tag"] = "TypeInfo"; { std::shared_ptr tv = std::static_pointer_cast(v); obj["range"] = toJSON(tv->range); obj["text"] = toJSON(tv->text); } break; } return obj; } template<> std::shared_ptr fromJSON>(W> v, json &obj) { enum ::TypeInfo::tag tagType; std::string tag = obj["tag"]; if (tag == "TypeInfo") { tagType = ::TypeInfo::tag::TypeInfo; std::shared_ptr tv(new data::TypeInfo()); tv->range = fromJSON(W>(), obj["range"]); tv->text = fromJSON(W(), obj["text"]); return tv; } else throw "unknown constructor: " + tag; std::shared_ptr<::TypeInfo> o(new ::TypeInfo()); o->tag = tagType; return o; } template<> json toJSON>(std::shared_ptr &v) { json obj({}); switch (v->tag) { case ::CompileResult::tag::CompileError: obj["tag"] = "CompileError"; { std::shared_ptr tv = std::static_pointer_cast(v); obj["arg0"] = toJSON(tv->_0); obj["arg1"] = toJSON(tv->_1); obj["arg2"] = toJSON(tv->_2); } break; case ::CompileResult::tag::Compiled: obj["tag"] = "Compiled"; { std::shared_ptr tv = std::static_pointer_cast(v); obj["arg0"] = toJSON(tv->_0); obj["arg1"] = toJSON(tv->_1); obj["arg2"] = toJSON(tv->_2); obj["arg3"] = toJSON(tv->_3); } break; } return obj; } template<> std::shared_ptr fromJSON>(W> v, json &obj) { enum ::CompileResult::tag tagType; std::string tag = obj["tag"]; if (tag == "CompileError") { tagType = ::CompileResult::tag::CompileError; std::shared_ptr tv(new data::CompileError()); tv->_0 = fromJSON(W>>(), obj["arg0"]); tv->_1 = fromJSON(W(), obj["arg1"]); tv->_2 = fromJSON(W>>(), obj["arg2"]); return tv; } else if (tag == "Compiled") { tagType = ::CompileResult::tag::Compiled; std::shared_ptr tv(new data::Compiled()); tv->_0 = fromJSON(W(), obj["arg0"]); tv->_1 = fromJSON(W(), obj["arg1"]); tv->_2 = fromJSON(W>(), obj["arg2"]); tv->_3 = fromJSON(W>>(), obj["arg3"]); return tv; } else throw "unknown constructor: " + tag; std::shared_ptr<::CompileResult> o(new ::CompileResult()); o->tag = tagType; return o; }