void FieldGenerator::generateOptionalProperty( google::protobuf::io::Printer& p) { p.Print(variables_, "$i$$type$.prototype.get$capital_name$ = function() {\n"); if (oneof_) { p.Print(variables_, "$i$ if (this.$oneof_camel$Case != " "type.$oneof_capital$Case.$all_capital_name$) {\n" "$i$ return undefined;\n" "$i$ } else {\n"); indentUp(); indentUp(); genGet(p); indentDown(); indentDown(); // TODO: Currently, if undefined is passed to oneof field, the entire oneof // is cleared. It may better to ignore undefined value if the4 field is not // the active value at the time. p.Print(variables_, " }\n" " };\n" "$i$$type$.prototype.set$capital_name$ = function(value) {\n" "$i$ this.clear$oneof_capital$();\n" "$i$ this._oneofs[$oneof_index$] = " "type.$oneof_capital$Case.$all_capital_name$;\n"); } else { indentUp(); genGet(p); indentDown(); p.Print(variables_, "$i$}\n" "$i$$type$.prototype.set$capital_name$ = function(value) {\n"); } indentUp(); genSet(p); indentDown(); p.Print(variables_, "$i$};\n" "$i$$type$.prototype.clear$capital_name$ = function() {\n"); indentUp(); genClear(p); indentDown(); if (oneof_) { p.Print(variables_, "$i$ if (this.$oneof_camel$Case == " "type.$oneof_capital$Case.$all_capital_name$) {\n" "$i$ this._oneofs[$oneof_index$] = " "type.$oneof_capital$Case.$oneof_all_capital$_NOT_SET;\n" "$i$ }\n"); } p.Print(variables_, "$i$};\n" "$i$Object.defineProperty(type.prototype, '$name$', {\n" "$i$ get: $type$.prototype.get$capital_name$,\n" "$i$ set: $type$.prototype.set$capital_name$,\n" "$i$});\n\n"); }
/*********************************************************************** * MapGenerator * genSewersMeta ***********************************************************************/ void fired::MapGenerator::genSewersMeta() { genClear(200, 100); }
/*********************************************************************** * MapGenerator * genForestMeta ***********************************************************************/ void fired::MapGenerator::genForestMeta() { genClear(100, 90); }