Skip to content

Commit c53f978

Browse files
Randall FlaggTheNicker
authored andcommitted
Changed string to llutils native string
1 parent efc9d4b commit c53f978

7 files changed

Lines changed: 28 additions & 25 deletions

File tree

FreeTypeWrapper/Include/FreeTypeWrapper/FreeTypeCommon.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#pragma once
2+
#include <LLUtils/StringDefs.h>
3+
24
namespace FreeType
35
{
6+
using string_type = LLUtils::native_string_type;
7+
48
enum class RenderMode
59
{
610
Default

FreeTypeWrapper/Include/FreeTypeWrapper/FreeTypeConnector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace FreeType
4444

4545
struct TextCreateParams
4646
{
47-
std::wstring fontPath;
48-
std::wstring text;
47+
string_type fontPath;
48+
string_type text;
4949
uint16_t fontSize{};
5050
LLUtils::Color textColor;
5151
LLUtils::Color backgroundColor;
@@ -107,7 +107,7 @@ namespace FreeType
107107
//private member methods
108108

109109

110-
FreeTypeFont* GetOrCreateFont(const std::wstring& fontPath);
110+
FreeTypeFont* GetOrCreateFont(const string_type& fontPath);
111111
FT_Stroker GetStroker();
112112
static std::string GenerateFreeTypeErrorString(std::string userMessage, FT_Error error);
113113

@@ -119,7 +119,7 @@ namespace FreeType
119119
FT_Library fLibrary;
120120
FT_Stroker fStroker = nullptr;
121121

122-
std::map<std::wstring, FreeTypeFontUniquePtr> fFontNameToFont;
122+
std::map<string_type, FreeTypeFontUniquePtr> fFontNameToFont;
123123

124124
};
125125
}

FreeTypeWrapper/Source/FreeTypeConnector.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ namespace FreeType
107107
const bool lineEndFixedWidth = createFlags.test(TextCreateFlags::LineEndFixedWidth);
108108
const bool usebidiText = createFlags.test(TextCreateFlags::Bidirectional);
109109

110-
const std::wstring text = textCreateParams.text;
111-
const std::wstring& fontPath = textCreateParams.fontPath;
110+
const string_type text = textCreateParams.text;
111+
const string_type& fontPath = textCreateParams.fontPath;
112112
const uint16_t fontSize = textCreateParams.fontSize;
113113
const uint32_t OutlineWidth = textCreateParams.outlineWidth;
114114
FT_Render_Mode textRenderMOde = FreeTypeRenderer::GetRenderMode(textCreateParams.renderMode);
@@ -241,7 +241,7 @@ namespace FreeType
241241
}
242242
}
243243

244-
FreeTypeFont* FreeTypeConnector::GetOrCreateFont(const std::wstring& fontPath)
244+
FreeTypeFont* FreeTypeConnector::GetOrCreateFont(const string_type& fontPath)
245245
{
246246
FreeTypeFont* font = nullptr;
247247

@@ -288,8 +288,8 @@ namespace FreeType
288288
)
289289
{
290290
using namespace std;
291-
const std::wstring text = textCreateParams.text;
292-
const std::wstring& fontPath = textCreateParams.fontPath;
291+
const string_type text = textCreateParams.text;
292+
const string_type& fontPath = textCreateParams.fontPath;
293293
const uint16_t fontSize = textCreateParams.fontSize;
294294
const uint32_t OutlineWidth = textCreateParams.outlineWidth;
295295
const LLUtils::Color outlineColor = textCreateParams.outlineColor;

FreeTypeWrapper/Source/FreeTypeFont.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace FreeType
77
class FreeTypeFont
88
{
99
public:
10-
FreeTypeFont(FT_Library ftLibrary, const std::wstring& fileName)
10+
FreeTypeFont(FT_Library ftLibrary, const string_type& fileName)
1111
{
1212
fName = fileName;
1313
fLibrary = ftLibrary;
@@ -53,7 +53,7 @@ namespace FreeType
5353

5454

5555
private:
56-
std::wstring fName;
56+
string_type fName;
5757
FT_Face fFace = nullptr;
5858
FT_Library fLibrary = nullptr;
5959
uint16_t fFontSize = 0;

FreeTypeWrapper/Source/MetaTextParser.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,32 @@
22
#include <LLUtils/StringUtility.h>
33
namespace FreeType
44
{
5-
FormattedTextEntry FormattedTextEntry::Parse(const std::wstring& format, const std::wstring& text)
5+
FormattedTextEntry FormattedTextEntry::Parse(const string_type& format, const string_type& text)
66
{
77
using namespace std;
88
using namespace LLUtils;
99

1010
using string_type = std::remove_const_t<std::remove_reference_t<decltype(text)>>;
1111
FormattedTextEntry result {};
1212

13-
wstring trimmed = StringUtility::ToLower(format);
14-
trimmed.erase(trimmed.find_last_not_of(L" >") + 1);
15-
trimmed.erase(0, trimmed.find_first_not_of(L" <"));
16-
17-
13+
string_type trimmed = StringUtility::ToLower(format);
14+
trimmed.erase(trimmed.find_last_not_of(LLUTILS_TEXT(" >")) + 1);
15+
trimmed.erase(0, trimmed.find_first_not_of(LLUTILS_TEXT(" <")));
1816

1917
using stringList = ListString<string_type>;
2018

2119
bool isValid = false;
22-
stringList properties = StringUtility::split(trimmed, L';');
20+
stringList properties = StringUtility::split(trimmed, LLUTILS_TEXT(';'));
2321
stringstream ss;
2422
for (const string_type& prop : properties)
2523
{
26-
stringList trimmedList = StringUtility::split(prop, L'=');
24+
stringList trimmedList = StringUtility::split(prop, LLUTILS_TEXT('='));
2725

2826
if (trimmedList.size() == 2)
2927
{
3028
const string_type key = StringUtility::ToLower(trimmedList[0]);
3129
const string_type& value = trimmedList[1];
32-
if (key == L"textcolor")
30+
if (key == LLUTILS_TEXT("textcolor"))
3331
{
3432
result.textColor = Color::FromString(StringUtility::ToAString(value));
3533
}
@@ -64,7 +62,7 @@ namespace FreeType
6462

6563

6664

67-
VecFormattedTextEntry MetaText::GetFormattedText(std::wstring text)
65+
VecFormattedTextEntry MetaText::GetFormattedText(string_type text)
6866
{
6967
using namespace std;
7068
using string_type = decltype(text);

FreeTypeWrapper/Source/MetaTextParser.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <vector>
33
#include <string>
44
#include <LLUtils/Color.h>
5+
#include "../Include/FreeTypeWrapper/FreeTypeCommon.h"
56

67
namespace FreeType
78
{
@@ -13,15 +14,15 @@ namespace FreeType
1314
//uint32_t outlineWidth;
1415
//uint32_t outlineColor;
1516

16-
std::wstring text;
17-
static FormattedTextEntry Parse(const std::wstring& format, const std::wstring& text);
17+
string_type text;
18+
static FormattedTextEntry Parse(const string_type& format, const string_type& text);
1819
};
1920

2021
using VecFormattedTextEntry = std::vector<FormattedTextEntry>;
2122

2223
class MetaText
2324
{
2425
public:
25-
static VecFormattedTextEntry GetFormattedText(std::wstring text);
26+
static VecFormattedTextEntry GetFormattedText(string_type text);
2627
};
2728
}

0 commit comments

Comments
 (0)