GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
ExampleExtensionUsagesFinder.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #pragma once
8 
9 #include <set>
10 
11 #include "GDCore/Events/Parsers/ExpressionParser2NodeWorker.h"
12 #include "GDCore/Extensions/Metadata/SourceFileMetadata.h"
13 #include "GDCore/Extensions/PlatformExtension.h"
14 #include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
15 #include "GDCore/IDE/Project/ArbitraryObjectsWorker.h"
16 #include "GDCore/String.h"
17 
18 namespace gd {
19 class Project;
20 class Object;
21 class Behavior;
22 } // namespace gd
23 
24 namespace gd {
25 
32  : public ArbitraryObjectsWorker,
35 public:
36  static std::set<gd::String> GetUsedExtensions(gd::Project &project);
37 
38 private:
39  ExampleExtensionUsagesFinder(gd::Project &project_) : project(project_){};
40  gd::Project &project;
41  gd::String rootType;
42  bool isStoreExtension = false;
43 
44  // Result
45  std::set<gd::String> usedExtensions;
46  bool has3DObjects = false;
47 
48  void AddUsedExtension(const gd::PlatformExtension &extension);
49  void AddUsedBuiltinExtension(const gd::String &extensionName);
50 
51  // Object Visitor
52  void DoVisitObject(gd::Object &object) override;
53 
54  // Behavior Visitor
55  void DoVisitBehavior(gd::Behavior &behavior) override;
56 
57  // Instructions Visitor
58  bool DoVisitInstruction(gd::Instruction &instruction,
59  bool isCondition) override;
60 
61  // Expression Visitor
62  void OnVisitSubExpressionNode(SubExpressionNode &node) override;
63  void OnVisitOperatorNode(OperatorNode &node) override;
64  void OnVisitUnaryOperatorNode(UnaryOperatorNode &node) override;
65  void OnVisitNumberNode(NumberNode &node) override;
66  void OnVisitTextNode(TextNode &node) override;
67  void OnVisitVariableNode(VariableNode &node) override;
68  void OnVisitVariableAccessorNode(VariableAccessorNode &node) override;
69  void OnVisitVariableBracketAccessorNode(
70  VariableBracketAccessorNode &node) override;
71  void OnVisitIdentifierNode(IdentifierNode &node) override;
72  void OnVisitObjectFunctionNameNode(ObjectFunctionNameNode &node) override;
73  void OnVisitFunctionCallNode(FunctionCallNode &node) override;
74  void OnVisitEmptyNode(EmptyNode &node) override;
75 };
76 
77 }; // namespace gd
An events worker that will know about the context (the objects container). Useful for workers working...
Definition: ArbitraryEventsWorker.h:136
ArbitraryObjectsWorker is an abstract class used to browse objects (and behaviors) and do some work o...
Definition: ArbitraryObjectsWorker.h:30
Base class used to represents a behavior that can be applied to an object. It stores the content (i....
Definition: Behavior.h:23
List extension usages for generated example web-pages.
Definition: ExampleExtensionUsagesFinder.h:34
The interface for any worker class ("visitor" pattern) that want to interact with the nodes of a pars...
Definition: ExpressionParser2NodeWorker.h:36
An instruction is a member of an event: It can be a condition or an action.
Definition: Instruction.h:30
Represent an object of a platform.
Definition: Object.h:37
Base class for implementing platform's extensions.
Definition: PlatformExtension.h:84
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:50
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24
An empty node, used when parsing failed/a syntax error was encountered and any other node could not m...
Definition: ExpressionParser2Node.h:423
A function call node (either free function, object function or object behavior function)....
Definition: ExpressionParser2Node.h:371
An identifier node, usually representing an object or a variable with an optional function name or ch...
Definition: ExpressionParser2Node.h:204
A number node. For example: "123". Its type is always "number".
Definition: ExpressionParser2Node.h:161
The name of a function to call on an object or the behavior For example: "MyObject....
Definition: ExpressionParser2Node.h:321
An operator node. For example: "lhs + rhs".
Definition: ExpressionParser2Node.h:129
Definition: ExpressionParser2Node.h:115
A text node. For example: "Hello World". Its type is always "string".
Definition: ExpressionParser2Node.h:177
A unary operator node. For example: "-2".
Definition: ExpressionParser2Node.h:145
A direct accessor to a child variable. Example: MyChild in MyVariable.MyChild.
Definition: ExpressionParser2Node.h:282
A bracket accessor to a child variable. Example: ["MyChild"] (in MyVariable["MyChild"]).
Definition: ExpressionParser2Node.h:300
A variable, or object variable, with bracket accessor or at least 2 "dot" accessors.
Definition: ExpressionParser2Node.h:261