diff --git a/hilti/runtime/include/types/bytes.h b/hilti/runtime/include/types/bytes.h index 77d34a0a7..58594f1fa 100644 --- a/hilti/runtime/include/types/bytes.h +++ b/hilti/runtime/include/types/bytes.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -445,10 +444,7 @@ class Bytes : protected std::string { * @param errors how to handle errors when decoding/encoding the data * @return an upper case version of the instance */ - Bytes upper(unicode::Charset cs, - unicode::DecodeErrorStrategy errors = unicode::DecodeErrorStrategy::REPLACE) const { - return hilti::rt::string::encode(hilti::rt::string::upper(decode(cs, errors), errors), cs, errors); - } + Bytes upper(unicode::Charset cs, unicode::DecodeErrorStrategy errors = unicode::DecodeErrorStrategy::REPLACE) const; /** * Returns an upper-case version of the instance. @@ -457,10 +453,7 @@ class Bytes : protected std::string { * @param errors how to handle errors when decoding/encoding the data * @return a lower case version of the instance */ - Bytes lower(unicode::Charset cs, - unicode::DecodeErrorStrategy errors = unicode::DecodeErrorStrategy::REPLACE) const { - return hilti::rt::string::encode(hilti::rt::string::lower(decode(cs, errors), errors), cs, errors); - } + Bytes lower(unicode::Charset cs, unicode::DecodeErrorStrategy errors = unicode::DecodeErrorStrategy::REPLACE) const; /** * Removes leading and/or trailing sequences of all characters of a set diff --git a/hilti/runtime/src/tests/integer.cc b/hilti/runtime/src/tests/integer.cc index c186b25be..a1885adb4 100644 --- a/hilti/runtime/src/tests/integer.cc +++ b/hilti/runtime/src/tests/integer.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include using namespace hilti::rt; diff --git a/hilti/runtime/src/tests/union.cc b/hilti/runtime/src/tests/union.cc index 7b76a134b..d21a953c1 100644 --- a/hilti/runtime/src/tests/union.cc +++ b/hilti/runtime/src/tests/union.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include using namespace hilti::rt; diff --git a/hilti/runtime/src/types/bytes.cc b/hilti/runtime/src/types/bytes.cc index 0139303cf..f56770bd2 100644 --- a/hilti/runtime/src/types/bytes.cc +++ b/hilti/runtime/src/types/bytes.cc @@ -236,6 +236,10 @@ Bytes Bytes::strip(bytes::Side side) const { cannot_be_reached(); } +Bytes Bytes::upper(unicode::Charset cs, unicode::DecodeErrorStrategy errors) const { + return string::encode(string::upper(decode(cs, errors), errors), cs, errors); +} + integer::safe Bytes::toInt(uint64_t base) const { int64_t x = 0; if ( hilti::rt::atoi_n(str().begin(), str().end(), base, &x) == str().end() ) @@ -310,6 +314,10 @@ double Bytes::toReal() const { return d; } +Bytes Bytes::lower(unicode::Charset cs, unicode::DecodeErrorStrategy errors) const { + return string::encode(string::lower(decode(cs, errors), errors), cs, errors); +} + Result Bytes::match(const RegExp& re, unsigned int group) const { auto groups = re.matchGroups(*this);