aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codepoint_iterator.cc8
-rw-r--r--src/codepoint_iterator.h4
-rw-r--r--src/utility.cc10
-rw-r--r--src/utility.h8
4 files changed, 14 insertions, 16 deletions
diff --git a/src/codepoint_iterator.cc b/src/codepoint_iterator.cc
index 99ea866..b2f6d81 100644
--- a/src/codepoint_iterator.cc
+++ b/src/codepoint_iterator.cc
@@ -35,8 +35,8 @@ bool CodepointIterator::operator!=(
}
char32_t CodepointIterator::operator*() {
- uint8_t currByte = *(this->iterator_);
- char32_t codePoint = 0;
+ std::uint8_t currByte = *(this->iterator_);
+ char32_t codePoint = 0;
if ( match(currByte, dtl::CodeUnitType::CONTINUATION) ) {
if ( match(currByte, dtl::CodeUnitType::THREE) ) {
@@ -89,8 +89,8 @@ char32_t CodepointIterator::operator*() {
}
CodepointIterator& CodepointIterator::operator++() {
- uint8_t currByte = *(this->iterator_);
- std::string::difference_type offset = 1;
+ std::uint8_t currByte(*(this->iterator_));
+ std::string::difference_type offset(1);
if ( match(currByte, dtl::CodeUnitType::CONTINUATION) ) {
if ( match(currByte, dtl::CodeUnitType::THREE) ) {
diff --git a/src/codepoint_iterator.h b/src/codepoint_iterator.h
index 6c8c43d..b505587 100644
--- a/src/codepoint_iterator.h
+++ b/src/codepoint_iterator.h
@@ -9,9 +9,7 @@ namespace UTF8 {
class CodepointIterator : public std::iterator<std::bidirectional_iterator_tag,
char32_t,
- std::string::difference_type,
- const char32_t*,
- const char32_t&> {
+ std::string::difference_type> {
public:
CodepointIterator(std::string::const_iterator);
CodepointIterator(const CodepointIterator&);
diff --git a/src/utility.cc b/src/utility.cc
index 92ba7b9..9d81f61 100644
--- a/src/utility.cc
+++ b/src/utility.cc
@@ -3,15 +3,15 @@
namespace UTF8 {
namespace dtl {
-bool match(const uint8_t& codeUnit, CodeUnitType&& type) {
- return codeUnit & static_cast<uint8_t>(type);
+bool match(const std::uint8_t& codeUnit, CodeUnitType&& type) {
+ return codeUnit & static_cast<std::uint8_t>(type);
}
void write(char32_t& codePoint,
- const uint8_t& codeUnit,
+ const std::uint8_t& codeUnit,
CodePoint&& mask,
- const uint8_t& offset) {
- codePoint += (codeUnit & static_cast<uint8_t>(mask)) << offset;
+ const std::uint8_t& offset) {
+ codePoint += (codeUnit & static_cast<std::uint8_t>(mask)) << offset;
}
}
diff --git a/src/utility.h b/src/utility.h
index dcdcf75..e185e3e 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -6,22 +6,22 @@
namespace UTF8 {
namespace dtl {
-enum class CodeUnitType : uint8_t {
+enum class CodeUnitType : std::uint8_t {
CONTINUATION = (128 >> 0), // 10000000
LEADING = (128 >> 1), // 01000000
THREE = (128 >> 2), // 00100000
FOUR = (128 >> 3), // 00010000
};
-enum class CodePoint : uint8_t {
+enum class CodePoint : std::uint8_t {
CONTINUATION = (UINT8_MAX >> 2), // 00111111
TWO = (UINT8_MAX >> 3), // 00011111
THREE = (UINT8_MAX >> 4), // 00001111
FOUR = (UINT8_MAX >> 5), // 00000111
};
-bool match(const uint8_t&, CodeUnitType&&);
-void write(char32_t&, const uint8_t&, CodePoint&&, const uint8_t&);
+bool match(const std::uint8_t&, CodeUnitType&&);
+void write(char32_t&, const std::uint8_t&, CodePoint&&, const std::uint8_t&);
}
}