@@ -333,7 +333,7 @@ static void generateDeserializer( GeneratorContext &ctx, const Message &message
333
333
" else\n "
334
334
" // ignore the current field\n "
335
335
" {\n\t if (!protogen::json::ignore(in)) return false;\n "
336
- " if (!protogen::json::next(in)) return false;\n\b }\n\b\b }\n " );
336
+ " if (!protogen::json::next(in)) return false;\n\b }\n\b }\n " );
337
337
338
338
ctx.printer (" if (required && (" );
339
339
for (size_t i = 0 , t = message.fields .size (); i < t; ++i)
@@ -382,21 +382,6 @@ static void generateSerializer( GeneratorContext &ctx, const Message &message )
382
382
}
383
383
384
384
385
- static void generateTraitMacro ( GeneratorContext &ctx )
386
- {
387
- ctx.printer (
388
- " \n #define PROTOGEN_TRAIT_MACRO(MSGTYPE) \\\n "
389
- " \t namespace protogen { \\\n "
390
- " \t template<> struct traits<MSGTYPE> { \\\n "
391
- " \t static void clear( MSGTYPE &value ) { value.clear(); } \\\n "
392
- " static void write( std::ostream &out, const MSGTYPE &value ) { value.serialize(out); } \\\n "
393
- " template<typename I> \\\n "
394
- " static bool read( protogen::InputStream<I> &in, MSGTYPE &value ) { return value.deserialize(in); } \\\n "
395
- " static void swap( MSGTYPE &a, MSGTYPE &b ) { a.swap(b); } \\\n "
396
- " \b }; \\\n\b } \n\b\b " );
397
- }
398
-
399
-
400
385
static void generateTrait ( GeneratorContext &ctx, const Message &message )
401
386
{
402
387
ctx.printer (
@@ -448,37 +433,6 @@ static void generateNamespace( GeneratorContext &ctx, const Message &message, bo
448
433
}
449
434
450
435
451
- static void generateFieldTemplateMacro ( GeneratorContext &ctx )
452
- {
453
- ctx.printer (
454
- " \n #if __cplusplus >= 201103L\n "
455
- " #define PROTOGEN_FIELD_MOVECTOR_TEMPLATE(MSGTYPE) Field( Field<MSGTYPE> &&that ) { this->value_.swap(that.value_); }\n "
456
- " #else\n "
457
- " #define PROTOGEN_FIELD_MOVECTOR_TEMPLATE(MSGTYPE) \n "
458
- " #endif\n " );
459
-
460
- ctx.printer (
461
- " \n #define PROTOGEN_FIELD_TEMPLATE(MSGTYPE) \\\n "
462
- " \t namespace protogen {"
463
- " template<> class Field<MSGTYPE> { \\\n "
464
- " \t protected: \\\n "
465
- " \t MSGTYPE value_; \\\n "
466
- " \b public: \\\n "
467
- " \t Field() { clear(); } \\\n "
468
- " PROTOGEN_FIELD_MOVECTOR_TEMPLATE(MSGTYPE); \\\n "
469
- " void swap( Field<MSGTYPE> &that ) { traits<MSGTYPE>::swap(this->value_, that.value_); } \\\n "
470
- " const MSGTYPE &operator()() const { return value_; } \\\n "
471
- " MSGTYPE &operator()() { return value_; } \\\n "
472
- " void operator ()(const MSGTYPE &value ) { this->value_ = value; } \\\n "
473
- " bool undefined() const { return value_.undefined(); } \\\n "
474
- " void clear() { traits<MSGTYPE>::clear(value_); } \\\n "
475
- " Field<MSGTYPE> &operator=( const Field<MSGTYPE> &that ) { this->value_ = that.value_; return *this; } \\\n "
476
- " bool operator==( const MSGTYPE &that ) const { return this->value_ == that; } \\\n "
477
- " bool operator==( const Field<MSGTYPE> &that ) const { return this->value_ == that.value_; } \\\n "
478
- " \b\b }; }\n\b " );
479
- }
480
-
481
-
482
436
static void generateFieldTemplate ( GeneratorContext &ctx, const Message &message )
483
437
{
484
438
ctx.printer (
@@ -667,10 +621,6 @@ static void generateModel( GeneratorContext &ctx )
667
621
// base template
668
622
ctx.printer .output () << BASE_TEMPLATE;
669
623
670
- // macros for custom templates
671
- generateTraitMacro (ctx);
672
- generateFieldTemplateMacro (ctx);
673
-
674
624
// forward declarations
675
625
ctx.printer (" \n // forward declarations\n " );
676
626
for (auto mi = ctx.root .messages .begin (); mi != ctx.root .messages .end (); ++mi)
0 commit comments