Elaztek Developer Hub
Blamite Game Engine - Strings  00428.01.13.25.2134.blamite
A library containing general purpose utilities and classes for use in multiple projects.
project_info.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #ifdef STRINGS_EXPORTS
6 #define STRINGS_API __declspec(dllexport)
7 #else
8 #define STRINGS_API __declspec(dllimport)
9 #endif
10 
19 #define PROJECT_SECTION(name, fields) struct name##_data fields; name##_data name = name##_data();
20 
29 #define PROJECT_FILE_FORMAT_VERSION 1
30 
44 {
45  bool load_result = false;
46  std::string file_path = "";
47  int format_version = 0;
48  std::string project_name = "unnamed";
49  std::string project_root = "";
50 
51  PROJECT_SECTION(game_info,
52  {
53  std::string title = "core";
54  std::string codename = "core";
55  std::string publisher = "Elaztek Studios";
56  std::string developer = "Elaztek Studios";
57  std::string affiliates = "";
58  std::string copyright = "Copyright (c) Elaztek Studios 2013-2023";
59  std::string website = "https://elaztek.com/";
60  std::string version = "";
61  std::string icon = "";
62  });
63 
64  PROJECT_SECTION(cpp_script_info,
65  {
66  bool uses_cpp_script = false;
67  std::string vcxproj_path = "";
68  std::string engine_dependencies_path = "";
69  std::string msbuild_path = "msbuild.exe";
70  std::string msbuild_extra_args = "";
71  std::string pre_build_commands = "";
72  std::string post_build_commands = "";
73  });
74 
75  /*PROJECT_SECTION(network_settings,
76  {
77  std::string update_info_url = "";
78  std::string mods_info_url = "";
79  std::string invision_api_url = "";
80  });*/
81 
82  PROJECT_SECTION(engine_settings,
83  {
84  std::string user_data_folder = "/";
85 
86  std::string default_cache = "mainmenu";
87  std::string campaign_info = "";
88  std::string startup_movie = "";
89 
90  std::string content_root = "";
91  std::string tags_dir = "tags";
92  std::string movies_dir = "bink";
93  std::string data_dir = "data";
94  std::string cache_dir = "maps";
95  std::string plugins_dir = "plugins";
96  std::string fonts_dir = "maps/fonts";
97 
98  bool allow_user_tag_overrides = false;
99  });
100 
101  std::string GetVcxprojPath()
102  {
103  if ((cpp_script_info.vcxproj_path.length() >= 2 && cpp_script_info.vcxproj_path[1] == ':') || cpp_script_info.vcxproj_path.starts_with("\\\\"))
104  {
105  return cpp_script_info.vcxproj_path;
106  }
107 
108  return project_root + "/" + cpp_script_info.vcxproj_path;
109  }
110 };
111 
116 {
124  STRINGS_API BlamProjectInfo LoadProjectInfo(std::string file_path);
125 
134 }
PROJECT_FILE_FORMAT_VERSION
#define PROJECT_FILE_FORMAT_VERSION
The current project file format version.
Definition: project_info.h:29
BlamProjectInfo::project_name
std::string project_name
The name of the project.
Definition: project_info.h:48
logger.h
GetChildNodeValueBool
bool GetChildNodeValueBool(rapidxml::xml_node<> *parent_node, std::string child_node_name, bool _default=false)
Retrieves the value of a child node within an XML node.
Definition: project_info.cpp:58
BlamProjectInfo::GetVcxprojPath
std::string GetVcxprojPath()
Definition: project_info.h:101
BlamProjectInfo::project_root
std::string project_root
The root folder for the project.
Definition: project_info.h:49
project_info.h
BlamStrings::Logger::LogEvent
STRINGS_API void LogEvent(BlamBasicLogMessage message)
Logs an event to the logger.
Definition: logger.cpp:41
bstoi
#define bstoi(x)
Macro for converting string to int. Meant as a drop-in replacement for stoi()
Definition: converters.h:17
xml.h
BlamStrings::Utils::XML::FormatXMLString
STRINGS_API std::string FormatXMLString(std::string xml_contents, int spaces_per_indent=4)
Formats a string containing XML data into a human-readable format.
Definition: xml.cpp:91
BlamStrings::Utils::IO::GetAbsolutePathFromRelative
STRINGS_API std::string GetAbsolutePathFromRelative(std::string relative_path)
Converts a relative path to an absolute file path.
Definition: io.cpp:438
BlamStrings::Resources::ProjectInfo::SaveProjectInfo
STRINGS_API bool SaveProjectInfo(BlamProjectInfo project)
Saves a project information file to disk.
Definition: project_info.cpp:200
BlamStrings::Resources::ProjectInfo::LoadProjectInfo
STRINGS_API BlamProjectInfo LoadProjectInfo(std::string file_path)
Loads a project information file from disk.
Definition: project_info.cpp:75
BlamStrings::Utils::IO::CreateNewFile
STRINGS_API bool CreateNewFile(std::string filename, std::string file_contents)
Creates a file with the specified contents, or overwrites an existing file if it already exists.
Definition: io.cpp:75
rapidxml::xml_node::first_node
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets first child node, optionally matching node name.
Definition: rapidxml.hpp:936
BlamStrings::Resources::ProjectInfo
Namespace containing functions used to work with Blam Project Information files.
Definition: project_info.h:115
BlamProjectInfo
Structure representing a Blam Project Information file.
Definition: project_info.h:43
BlamStrings::Converters::IsStringInt
STRINGS_API bool IsStringInt(std::string string)
Checks whether or not a string is a valid representation of an integer.
Definition: converters.cpp:263
BlamProjectInfo::PROJECT_SECTION
PROJECT_SECTION(game_info, { std::string title="core";std::string codename="core";std::string publisher="Elaztek Studios";std::string developer="Elaztek Studios";std::string affiliates="";std::string copyright="Copyright (c) Elaztek Studios 2013-2023";std::string website="https://elaztek.com/";std::string version="";std::string icon="";})
rapidxml::xml_document
This class represents root of the DOM hierarchy.
Definition: rapidxml.hpp:139
BlamStrings::Utils::IO::GetFileNameWithoutExtension
STRINGS_API std::string GetFileNameWithoutExtension(std::string path)
Retrieves the name of the file or folder that a given path refers to, excluding the file's extension ...
Definition: io.cpp:337
rapidxml::xml_node
Class representing a node of XML document.
Definition: rapidxml.hpp:137
BlamStrings::Converters::StringToBool
STRINGS_API bool StringToBool(std::string string)
Converts a string to a boolean.
Definition: converters.cpp:67
BlamProjectInfo::load_result
bool load_result
Definition: project_info.h:45
BlamStrings::Utils::IO::GetContainingFolder
STRINGS_API std::string GetContainingFolder(std::string path)
Retrieves the containing folder of a given file or directory.
Definition: io.cpp:373
uuids::to_string
std::basic_string< CharT, Traits, Allocator > to_string(uuid const &id)
Definition: uuid.h:581
io.h
GetChildNodeValue
std::string GetChildNodeValue(rapidxml::xml_node<> *parent_node, std::string child_node_name, std::string _default="", bool treat_as_directory=false)
Retrieves the value of a child node within an XML node.
Definition: project_info.cpp:22
converters.h
rapidxml.hpp
rapidxml::xml_node::first_attribute
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets first attribute of node, optionally matching attribute name.
Definition: rapidxml.hpp:1025
BlamProjectInfo::format_version
int format_version
Definition: project_info.h:47
BlamLogLevel::Warning
@ Warning
Indicates a warning message. Not something critical, but something that could cause unexpected behavi...
BlamProjectInfo::file_path
std::string file_path
Definition: project_info.h:46
STRINGS_API
#define STRINGS_API
Definition: project_info.h:8
rapidxml::xml_document::parse
void parse(Ch *text)
Parses zero-terminated XML string according to given flags.
Definition: rapidxml.hpp:1381