GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
InstructionSentenceFormatter.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 #ifndef TRANSLATEACTION_H
8 #define TRANSLATEACTION_H
9 #include <map>
10 #include <utility>
11 #include <vector>
12 #include "GDCore/String.h"
13 #include "GDCore/Events/Instruction.h"
14 #include "GDCore/IDE/Events/TextFormatting.h"
15 namespace gd {
16 class InstructionMetadata;
17 }
18 
19 namespace gd {
20 
25 class GD_CORE_API InstructionSentenceFormatter {
26  public:
30  std::vector<std::pair<gd::String, gd::TextFormatting> > GetAsFormattedText(
31  const gd::Instruction &instr, const gd::InstructionMetadata &metadata);
32 
33  static InstructionSentenceFormatter *Get() {
34  if (NULL == _singleton) {
35  _singleton = new InstructionSentenceFormatter;
36  }
37 
38  return (static_cast<InstructionSentenceFormatter *>(_singleton));
39  }
40 
41  gd::String GetFullText(const gd::Instruction &instr,
42  const gd::InstructionMetadata &metadata);
43 
44  static void DestroySingleton() {
45  if (NULL != _singleton) {
46  delete _singleton;
47  _singleton = NULL;
48  }
49  }
50 
51  virtual ~InstructionSentenceFormatter(){};
52 
53  private:
55  static InstructionSentenceFormatter *_singleton;
56 };
57 
58 } // namespace gd
59 #endif // TRANSLATEACTION_H
An instruction is a member of an event: It can be a condition or an action.
Definition: Instruction.h:30
Describe user-friendly information about an instruction (action or condition), its parameters and the...
Definition: InstructionMetadata.h:39
Generate user friendly sentences and information from an action or condition metadata.
Definition: InstructionSentenceFormatter.h:25
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24