Game Develop Core: ActionSentenceFormatter.h Source File

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
ActionSentenceFormatter.h
Go to the documentation of this file.
1
6 #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
7 #ifndef TRANSLATEACTION_H
8 #define TRANSLATEACTION_H
9 #include <string>
10 #include <vector>
11 #include <map>
12 #include <utility>
13 #include <wx/bitmap.h>
14 #include "GDCore/Events/Instruction.h"
15 #include "GDCore/IDE/TextFormatting.h"
16 namespace gd { class InstructionMetadata;}
17
18 namespace gd
19 {
20
24 class GD_CORE_API ActionSentenceFormatter
25 {
26 public:
27
31 std::string Translate(const gd::Instruction & action, const gd::InstructionMetadata & infos);
32
36 std::vector< std::pair<std::string, gd::TextFormatting> > GetAsFormattedText(const gd::Instruction & action, const gd::InstructionMetadata & infos);
37
41 TextFormatting GetFormattingFromType(const std::string & type);
42
46 std::string LabelFromType(const std::string & type);
47
51 wxBitmap BitmapFromType(const std::string & type);
52
56 void LoadTypesFormattingFromConfig();
57
61 void SaveTypesFormattingToConfig();
62
63 std::map<std::string, gd::TextFormatting> typesFormatting;
64
65 static ActionSentenceFormatter *GetInstance()
66 {
67 if ( NULL == _singleton )
68 {
69 _singleton = new ActionSentenceFormatter;
70 }
71
72 return ( static_cast<ActionSentenceFormatter*>( _singleton ) );
73 }
74
75 static void DestroySingleton()
76 {
77 if ( NULL != _singleton )
78 {
79 delete _singleton;
80 _singleton = NULL;
81 }
82 }
83
84 private:
85 ActionSentenceFormatter() {};
86 virtual ~ActionSentenceFormatter() {};
87 static ActionSentenceFormatter *_singleton;
88 };
89
90
91 }
92 #endif // TRANSLATEACTION_H
93 #endif