Skip to content

Commit

Permalink
Add UTF-8 support
Browse files Browse the repository at this point in the history
- Updated RValue to support UTF-8 strings natively, together with std::string and std::u8string
  • Loading branch information
Archie-osu committed Dec 31, 2023
1 parent a10fd25 commit bb34f3a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
28 changes: 28 additions & 0 deletions YYToolkit/source/YYTK/Shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ YYTK::RValue::RValue(
*this = std::string_view(Value);
}

YYTK::RValue::RValue(
IN const char8_t* Value
)
{
*this = std::u8string_view(Value);
}

RValue::RValue(
IN std::string_view Value
)
Expand All @@ -139,6 +146,27 @@ RValue::RValue(
);
}

YYTK::RValue::RValue(
IN std::u8string_view Value
)
{
*this = std::string(Value.cbegin(), Value.cend());
}

YYTK::RValue::RValue(
IN const std::string& Value
)
{
*this = std::string_view(Value);
}

YYTK::RValue::RValue(
IN const std::u8string& Value
)
{
*this = std::u8string_view(Value);
}

RValue::RValue(
IN std::string_view Value,
IN class YYTKInterface* Interface
Expand Down
18 changes: 17 additions & 1 deletion YYToolkit/source/YYTK/Shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#define YYTK_MAJOR 3
#define YYTK_MINOR 1
#define YYTK_PATCH 0
#define YYTK_PATCH 1

#include <Aurie/shared.hpp>
#include <FunctionWrapper/FunctionWrapper.hpp>
Expand Down Expand Up @@ -176,10 +176,26 @@ namespace YYTK
IN const char* Value
);

RValue(
IN const char8_t* Value
);

RValue(
IN std::string_view Value
);

RValue(
IN std::u8string_view Value
);

RValue(
IN const std::string& Value
);

RValue(
IN const std::u8string& Value
);

RValue(
IN std::string_view Value,
IN YYTKInterface* Interface
Expand Down

0 comments on commit bb34f3a

Please sign in to comment.