-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from brisklib/i18n
Ability to select i18n implementation
- Loading branch information
Showing
13 changed files
with
393 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#pragma once | ||
|
||
#include "brisk/core/BasicTypes.hpp" | ||
#include "brisk/core/RC.hpp" | ||
#include "brisk/core/Reflection.hpp" | ||
#include <cstdint> | ||
#include <vector> | ||
#include <string_view> | ||
#include <type_traits> | ||
|
||
namespace Brisk { | ||
|
||
enum class TextBreakMode { | ||
Grapheme, | ||
Word, | ||
Line, | ||
}; | ||
|
||
constexpr auto operator+(TextBreakMode value) noexcept { | ||
return static_cast<std::underlying_type_t<decltype(value)>>(value); | ||
} | ||
|
||
enum class TextDirection : uint8_t { | ||
LTR, | ||
RTL, | ||
}; | ||
|
||
template <> | ||
inline constexpr std::initializer_list<NameValuePair<TextDirection>> defaultNames<TextDirection>{ | ||
{ "LTR", TextDirection::LTR }, | ||
{ "RTL", TextDirection::RTL }, | ||
}; | ||
|
||
namespace Internal { | ||
|
||
class TextBreakIterator { | ||
public: | ||
virtual ~TextBreakIterator() = 0; | ||
virtual std::optional<uint32_t> next() = 0; | ||
}; | ||
|
||
RC<TextBreakIterator> textBreakIterator(std::u32string_view text, TextBreakMode mode); | ||
|
||
class BidiTextIterator { | ||
public: | ||
virtual ~BidiTextIterator(); | ||
virtual bool isMixed() const = 0; | ||
|
||
struct TextFragment { | ||
Range<uint32_t> codepointRange; | ||
uint32_t visualPosition; | ||
uint8_t level; | ||
TextDirection direction; | ||
}; | ||
|
||
virtual std::optional<TextFragment> next() = 0; | ||
}; | ||
|
||
RC<BidiTextIterator> bidiTextIterator(std::u32string_view text, TextDirection defaultDirection); | ||
|
||
} // namespace Internal | ||
|
||
|
||
} // namespace Brisk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.