GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
EventsCodeNameMangler.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 #if defined(GD_IDE_ONLY)
7 #ifndef EVENTSCODENAMEMANGLER_H
8 #define EVENTSCODENAMEMANGLER_H
9 #include <unordered_map>
10 #include "GDCore/String.h"
11 
17 class GD_CORE_API EventsCodeNameMangler {
18  public:
26  const gd::String &GetMangledObjectsListName(
27  const gd::String &originalObjectName);
28 
36  const gd::String &GetExternalEventsFunctionMangledName(
37  const gd::String &externalEventsName);
38 
39  static gd::String GetMangledName(const gd::String &name);
40 
41  static EventsCodeNameMangler *Get();
42  static void DestroySingleton();
43 
44  private:
46  virtual ~EventsCodeNameMangler(){};
47  static EventsCodeNameMangler *_singleton;
48 
49  // This method is inlined to avoid to copy the returned string.
50  static inline gd::String GetMangledNameWithForbiddenUnderscore(const gd::String &name);
51 
52  std::unordered_map<gd::String, gd::String>
53  mangledObjectNames;
54  std::unordered_map<gd::String, gd::String>
55  mangledExternalEventsNames;
57 };
58 
66 const gd::String &GD_CORE_API ManObjListName(const gd::String &objectName);
67 
68 #endif // EVENTSCODENAMEMANGLER_H
69 #endif
Mangle object names, so as to ensure all names used in code are valid.
Definition: EventsCodeNameMangler.h:17
String represents an UTF8 encoded string.
Definition: String.h:33