diff Resources/CodeGeneration/template.in.h @ 513:dea3787a8f4b bgo-commands-codegen

Added support for struct metadata, to disable/enable handler support in Typescript or C++
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 11 Mar 2019 13:02:46 +0100
parents 7105a0bad250
children 381144d2434f
line wrap: on
line diff
--- a/Resources/CodeGeneration/template.in.h	Wed Mar 06 18:26:35 2019 +0100
+++ b/Resources/CodeGeneration/template.in.h	Mon Mar 11 13:02:46 2019 +0100
@@ -352,8 +352,8 @@
   class IHandler
   {
   public:
-{% for struct in structs%}    virtual bool Handle(const {{struct['name']}}& value) = 0;
-{% endfor %}  };
+{% for struct in structs%}{% if struct['__meta__'].handleInCpp %}    virtual bool Handle(const {{struct['name']}}& value) = 0;
+{% endif %}{% endfor %}  };
 
   /** Service function for StoneDispatchToHandler */
   inline bool StoneDispatchJsonToHandler(
@@ -366,13 +366,13 @@
       // this should never ever happen
       throw std::runtime_error("Caught empty type while dispatching");
     }
-{% for struct in structs%}    else if (type == "{{rootName}}.{{struct['name']}}")
+{% for struct in structs%}{% if struct['__meta__'].handleInCpp %}    else if (type == "{{rootName}}.{{struct['name']}}")
     {
       {{struct['name']}} value;
       _StoneDeserializeValue(value, jsonValue["value"]);
       return handler->Handle(value);
     }
-{% endfor %}    else
+{% endif %}{% endfor %}    else
     {
       return false;
     }