Elaztek Developer Hub
Blamite Game Engine - Strings  00326.06.27.21.0407.blamite
A library containing general purpose utilities and classes for use in multiple projects.
strings.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <map>
5 #include <vector>
6 
7 #define STRING_TEXT(string_id) BlamStrings::Resources::Strings::LookupString(string_id)
8 #define ERROR_TEXT(error_code) BlamStrings::Resources::Strings::LookupErrorString(error_code)
9 
10 #ifdef STRINGS_EXPORTS
11 #define STRINGS_API __declspec(dllexport)
12 #else
13 #define STRINGS_API __declspec(dllimport)
14 #endif
15 
20 {
22 };
23 
30 {
31  std::string id;
32  std::string value;
33 };
34 
39 {
40 public:
41  std::string id;
42  std::string text;
43 
44  std::vector<BlamStringAttribute> attributes;
45 
53  bool HasAttribute(std::string id);
54 
64  std::string GetAttribute(std::string id);
65 };
66 
71 {
79  STRINGS_API bool LoadCommonStrings(std::string base_dir);
80 
88  STRINGS_API bool LoadStrings(std::string file_path);
89 
97  STRINGS_API bool LoadErrorStrings(std::string file_path);
98 
106  STRINGS_API std::string LookupString(std::string id);
107 
116  STRINGS_API std::string LookupErrorString(int error_code);
117 
123  STRINGS_API std::map<std::string, BlamEngineString>* GetUniversalStrings();
124 
130  STRINGS_API std::map<int, BlamEngineString*>* GetErrorStrings();
131 
139  STRINGS_API bool StringExists(std::string id);
140 
148  STRINGS_API bool ErrorStringExists(int error_code);
149 }
BlamStrings::Resources::Strings::ErrorStringExists
STRINGS_API bool ErrorStringExists(int error_code)
Looks through the list of loaded error strings to see if a given error string has been loaded.
Definition: strings.cpp:259
BlamStrings::Resources::Strings::GetUniversalStrings
STRINGS_API std::map< std::string, BlamEngineString > * GetUniversalStrings()
Retrieves the list of all loaded strings.
Definition: strings.cpp:235
BlamStrings::Resources::Strings::LoadCommonStrings
STRINGS_API bool LoadCommonStrings(std::string base_dir)
Loads the string tables editor_strings, error_strings, shared_strings, and config_strings.
Definition: strings.cpp:111
BlamStrings::Resources::Strings
Namespace containing functions for Blamite string resources.
Definition: strings.h:70
en_US
@ en_US
Definition: strings.h:21
STRINGS_API
#define STRINGS_API
Definition: strings.h:13
BlamStrings::Resources::Strings::StringExists
STRINGS_API bool StringExists(std::string id)
Looks through the list of loaded engine strings to see if a given string has been loaded.
Definition: strings.cpp:245
BlamStringAttribute::value
std::string value
The attribute value.
Definition: strings.h:32
BlamStrings::Resources::Strings::LookupErrorString
STRINGS_API std::string LookupErrorString(int error_code)
Finds a string message associated with a given error code.
Definition: strings.cpp:221
BlamEngineString::text
std::string text
The content of the string.
Definition: strings.h:42
BlamStrings::Resources::Strings::LoadStrings
STRINGS_API bool LoadStrings(std::string file_path)
Loads all strings in the given file into the universal string list.
Definition: strings.cpp:123
BlamStringAttribute
Structure representing a Blamite string attribute.
Definition: strings.h:29
BlamEngineString::attributes
std::vector< BlamStringAttribute > attributes
The list of attributes present within the string.
Definition: strings.h:44
BlamEngineString
Class representing a Blamite string.
Definition: strings.h:38
BlamLanguage
BlamLanguage
Enum containing all supported languages within the engine.
Definition: strings.h:19
BlamEngineString::id
std::string id
The ID of the string.
Definition: strings.h:41
BlamStrings::Resources::Strings::LookupString
STRINGS_API std::string LookupString(std::string id)
Finds a string with a given ID.
Definition: strings.cpp:207
BlamStringAttribute::id
std::string id
The attribute ID.
Definition: strings.h:31
BlamStrings::Resources::Strings::LoadErrorStrings
STRINGS_API bool LoadErrorStrings(std::string file_path)
Loads all strings in the given file as error description strings.
Definition: strings.cpp:153
BlamStrings::Resources::Strings::GetErrorStrings
STRINGS_API std::map< int, BlamEngineString * > * GetErrorStrings()
Retrieves the list of all loaded error code strings.
Definition: strings.cpp:240