Elaztek Developer Hub
Blamite Game Engine - Strings  00402.09.29.23.0627.blamite
A library containing general purpose utilities and classes for use in multiple projects.
string.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #ifdef STRINGS_EXPORTS
7 #define STRINGS_API __declspec(dllexport)
8 #else
9 #define STRINGS_API __declspec(dllimport)
10 #endif
11 
19 #define str_tolower(str) BlamStrings::Utils::String::ToLower(str)
20 
28 #define str_toupper(str) BlamStrings::Utils::String::ToUpper(str)
29 
34 {
44  STRINGS_API bool StartsWith(std::string string, std::string starts_with, bool case_insensetive = false);
45 
55  STRINGS_API bool StartsWithAny(std::string string, std::vector<std::string> starts_with, bool case_insensetive = false);
56 
66  STRINGS_API bool EndsWith(std::string string, std::string ends_with, bool case_insensetive = false);
67 
77  STRINGS_API bool EndsWithAny(std::string string, std::vector<std::string> ends_with, bool case_insensetive = false);
78 
88  STRINGS_API std::string Replace(std::string orig, std::string to_replace, std::string replace_with);
89 
99  STRINGS_API std::string Replace(std::string orig, char to_replace, char replace_with);
100 
108  STRINGS_API std::string ToLower(std::string string);
109 
117  STRINGS_API std::string ToUpper(std::string string);
118 
126  STRINGS_API std::string FixDirectorySeparators(std::string string);
127 
144  STRINGS_API std::vector<std::string> Split(std::string string, std::string splitter);
145 
154  STRINGS_API bool ContainsChar(std::string string, char contains);
155 
164  STRINGS_API bool Contains(std::string string, std::string contains);
165 
179  STRINGS_API bool MemoryStringCompare(char* address, char* to_compare, int size);
180 
194  STRINGS_API std::string FormatStringForTagFieldID(std::string original_string);
195 
212  STRINGS_API std::string FormatDecorativeHeaderComment(std::vector<std::string> lines);
213 
227  STRINGS_API std::string Capitalize(std::string original_string, bool remove_spaces = false);
228 
241  STRINGS_API std::string BuildFromList(std::vector<std::string> list, std::string splitter = ",");
242 
266  STRINGS_API std::string ParseStringFromXMLValue(std::string string);
267 
276  STRINGS_API std::string FormatStringForXML(std::string string, std::string prefix = "");
277 }
BlamStrings::Utils::String::FormatDecorativeHeaderComment
STRINGS_API std::string FormatDecorativeHeaderComment(std::vector< std::string > lines)
Generates a decorative header comment in the style used in some Blamite header/source files.
Definition: string.cpp:226
STRINGS_API
#define STRINGS_API
Definition: string.h:9
BlamStrings::Utils::String::Split
STRINGS_API std::vector< std::string > Split(std::string string, std::string splitter)
Splits a string around any instance of a substring.
Definition: string.cpp:136
BlamStrings::Utils::String::ParseStringFromXMLValue
STRINGS_API std::string ParseStringFromXMLValue(std::string string)
Performs a number of modifications and tweaks to a string.
Definition: string.cpp:328
string.h
BlamStrings::Utils::String::ToUpper
STRINGS_API std::string ToUpper(std::string string)
Transforms a string to all-uppercase.
Definition: string.cpp:85
BlamStrings::Utils::String
Utilities for working with and modifying strings.
Definition: string.h:33
BlamStrings::Utils::String::Contains
STRINGS_API bool Contains(std::string string, std::string contains)
Determines whether or not a string contains the specified substring.
Definition: string.cpp:181
BlamStrings::Utils::String::FixDirectorySeparators
STRINGS_API std::string FixDirectorySeparators(std::string string)
Replaces any instance of \\ in a string with /.
Definition: string.cpp:156
BlamStrings::Utils::String::FormatStringForXML
STRINGS_API std::string FormatStringForXML(std::string string, std::string prefix="")
Formats a string to be XML safe/friendly.
Definition: string.cpp:353
BlamStrings::Utils::String::Capitalize
STRINGS_API std::string Capitalize(std::string original_string, bool remove_spaces=false)
Capitalizes the first character within each word within a string.
Definition: string.cpp:285
BlamStrings::Utils::String::BuildFromList
STRINGS_API std::string BuildFromList(std::vector< std::string > list, std::string splitter=",")
Creates a separated list from a list of strings.
Definition: string.cpp:311
BlamStrings::Utils::String::StartsWith
STRINGS_API bool StartsWith(std::string string, std::string starts_with, bool case_insensetive=false)
Determines whether or not a string starts with another string, case-insensetive.
Definition: string.cpp:7
BlamStrings::Utils::String::ToLower
STRINGS_API std::string ToLower(std::string string)
Transforms a string to all-lowercase.
Definition: string.cpp:76
BlamStrings::Utils::String::MemoryStringCompare
STRINGS_API bool MemoryStringCompare(char *address, char *to_compare, int size)
Checks the specified address in memory to see if it matches a given string, ignoring null terminators...
Definition: string.cpp:191
BlamStrings::Utils::String::Replace
STRINGS_API std::string Replace(std::string orig, std::string to_replace, std::string replace_with)
Replaces part of a string with another string.
Definition: string.cpp:94
BlamStrings::Utils::String::EndsWith
STRINGS_API bool EndsWith(std::string string, std::string ends_with, bool case_insensetive=false)
Determines whether or not a string ends with another string, case-sensetive.
Definition: string.cpp:38
BlamStrings::Utils::String::EndsWithAny
STRINGS_API bool EndsWithAny(std::string string, std::vector< std::string > ends_with, bool case_insensetive=false)
Determines whether or not a string ends with any one of multiple possible strings.
Definition: string.cpp:63
BlamStrings::Utils::String::StartsWithAny
STRINGS_API bool StartsWithAny(std::string string, std::vector< std::string > starts_with, bool case_insensetive=false)
Determines whether or not a string starts with any one of multiple possible strings.
Definition: string.cpp:25
BlamStrings::Utils::String::FormatStringForTagFieldID
STRINGS_API std::string FormatStringForTagFieldID(std::string original_string)
Reformats a standard display name string to be appropriate for a field ID.
Definition: string.cpp:201
BlamStrings::Utils::String::ContainsChar
STRINGS_API bool ContainsChar(std::string string, char contains)
Determines whether or not a string contains the specified character.
Definition: string.cpp:165