12 #include "GDCore/String.h" 
   37       : maxDepthLevel(maxDepthLevel_){};
 
   45   void InheritsFrom(EventsCodeGenerationContext& parent);
 
   51   void InheritsAsAsyncCallbackFrom(EventsCodeGenerationContext& parent);
 
   59   void Reuse(EventsCodeGenerationContext& parent);
 
   75     return !reuseExplicitlyForbidden && parent != 
nullptr;
 
   97     currentObject = objectName;
 
  117   void ObjectsListNeeded(
const gd::String& objectName);
 
  127   void ObjectsListNeededOrEmptyIfJustDeclared(
const gd::String& objectName);
 
  137   void EmptyObjectsListNeeded(
const gd::String& objectName);
 
  143     return (alreadyDeclaredObjectsLists.find(objectName) !=
 
  144             alreadyDeclaredObjectsLists.end());
 
  151   std::set<gd::String> GetAllObjectsToBeDeclared() 
const;
 
  157     return objectsListsToBeDeclared;
 
  166     return objectsListsOrEmptyToBeDeclared;
 
  175     return emptyObjectsListsToBeDeclared;
 
  183     return alreadyDeclaredObjectsLists;
 
  193   unsigned int GetLastDepthObjectListWasNeeded(
 
  202   bool IsSameObjectsList(
const gd::String& objectName,
 
  234     return allObjectsListToBeDeclaredAcrossChildren;
 
  243   bool ShouldUseAsyncObjectsList(
const gd::String& objectName) 
const;
 
  256   bool IsAsyncCallback()
 const { 
return parent != 
nullptr && parent->asyncDepth != asyncDepth; }
 
  263     return objectsListsToBeDeclared.find(objectName) !=
 
  264                objectsListsToBeDeclared.end() ||
 
  265            objectsListsOrEmptyToBeDeclared.find(objectName) !=
 
  266                objectsListsOrEmptyToBeDeclared.end() ||
 
  267            emptyObjectsListsToBeDeclared.find(objectName) !=
 
  268                emptyObjectsListsToBeDeclared.end();
 
  272   void NotifyAsyncParentsAboutDeclaredObject(
const gd::String& objectName);
 
  275       alreadyDeclaredObjectsLists;  
 
  278       objectsListsToBeDeclared;  
 
  281       objectsListsOrEmptyToBeDeclared;  
 
  286       emptyObjectsListsToBeDeclared;  
 
  292       allObjectsListToBeDeclaredAcrossChildren;  
 
  300   std::map<gd::String, unsigned int>
 
  304   unsigned int contextDepth = 0;  
 
  307   unsigned int customConditionDepth =
 
  309   unsigned int asyncDepth =
 
  315   unsigned int* maxDepthLevel;  
 
  322   bool reuseExplicitlyForbidden =
 
Used to manage the context when generating code for events.
Definition: EventsCodeGenerationContext.h:27
 
bool CanReuse() const
Return false if the object lists of the context can not be reused in a child context.
Definition: EventsCodeGenerationContext.h:74
 
const EventsCodeGenerationContext * GetParentContext() const
Get the parent context, if any.
Definition: EventsCodeGenerationContext.h:91
 
size_t GetCurrentConditionDepth() const
Get the current condition depth : The depth is increased each time a custom condition code is generat...
Definition: EventsCodeGenerationContext.h:223
 
bool ObjectAlreadyDeclaredByParents(const gd::String &objectName) const
Definition: EventsCodeGenerationContext.h:142
 
bool IsToBeDeclared(const gd::String &objectName)
Returns true if the given object is already going to be declared in this context (either as a traditi...
Definition: EventsCodeGenerationContext.h:262
 
const std::set< gd::String > & GetObjectsListsToBeDeclaredEmpty() const
Definition: EventsCodeGenerationContext.h:174
 
const std::set< gd::String > & GetObjectsListsToBeEmptyIfJustDeclared() const
Definition: EventsCodeGenerationContext.h:164
 
const std::set< gd::String > & GetAllDeclaredObjectsAcrossChildren()
Returns the list of all objects declared in this context and subcontexts.
Definition: EventsCodeGenerationContext.h:233
 
EventsCodeGenerationContext(unsigned int *maxDepthLevel_=nullptr)
Definition: EventsCodeGenerationContext.h:36
 
void EnterCustomCondition()
Called when a custom condition code is generated.
Definition: EventsCodeGenerationContext.h:208
 
size_t GetContextDepth() const
Returns the depth of the inheritance of the context.
Definition: EventsCodeGenerationContext.h:84
 
void LeaveCustomCondition()
Called when a custom condition code generation is over.
Definition: EventsCodeGenerationContext.h:213
 
void SetCurrentObject(const gd::String &objectName)
Definition: EventsCodeGenerationContext.h:96
 
const gd::String & GetCurrentObject() const
Definition: EventsCodeGenerationContext.h:108
 
void SetNoCurrentObject()
Definition: EventsCodeGenerationContext.h:103
 
bool IsInsideAsync() const
Definition: EventsCodeGenerationContext.h:250
 
const std::set< gd::String > & GetObjectsListsAlreadyDeclaredByParents() const
Definition: EventsCodeGenerationContext.h:182
 
const std::set< gd::String > & GetObjectsListsToBeDeclared() const
Definition: EventsCodeGenerationContext.h:156
 
bool IsAsyncCallback() const
Definition: EventsCodeGenerationContext.h:256
 
void ForbidReuse()
Forbid any optimization that would reuse and modify the object list from this context in children con...
Definition: EventsCodeGenerationContext.h:68
 
Internal class used to generate code from events.
Definition: EventsCodeGenerator.h:41
 
String represents an UTF8 encoded string.
Definition: String.h:33
 
Definition: CommonTools.h:24