aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/UniConversion.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-21 08:43:03 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-21 08:43:03 +1000
commit8634c0958c532e7d219e649353e1f1a74d52da1b (patch)
tree91352944c8b5c727a385426431d2e62f3301f6ad /src/UniConversion.h
parentf00008fa5a49722171c5b288f988a64443122115 (diff)
downloadscintilla-mirror-8634c0958c532e7d219e649353e1f1a74d52da1b.tar.gz
Tighten definition of regular expression iterators so they are noexcept and
define all the standard member functions. This cascades to all methods called by the iterators, affecting Document, CellBuffer, Partitioning, SplitVector and UTF-8 and DBCS functions. Other trivial functions declared noexcept.
Diffstat (limited to 'src/UniConversion.h')
-rw-r--r--src/UniConversion.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/UniConversion.h b/src/UniConversion.h
index 98bcd0329..bece53f4d 100644
--- a/src/UniConversion.h
+++ b/src/UniConversion.h
@@ -20,12 +20,12 @@ void UTF8FromUTF32Character(int uch, char *putf);
size_t UTF16Length(const char *s, size_t len);
size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen);
size_t UTF32FromUTF8(const char *s, size_t len, unsigned int *tbuf, size_t tlen);
-unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf);
+unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf) noexcept;
std::string FixInvalidUTF8(const std::string &text);
extern const unsigned char UTF8BytesOfLead[256];
-inline int UnicodeFromUTF8(const unsigned char *us) {
+inline int UnicodeFromUTF8(const unsigned char *us) noexcept {
switch (UTF8BytesOfLead[us[0]]) {
case 1:
return us[0];
@@ -38,31 +38,31 @@ inline int UnicodeFromUTF8(const unsigned char *us) {
}
}
-inline bool UTF8IsTrailByte(unsigned char ch) {
+inline bool UTF8IsTrailByte(unsigned char ch) noexcept {
return (ch >= 0x80) && (ch < 0xc0);
}
-inline bool UTF8IsAscii(int ch) {
+inline bool UTF8IsAscii(int ch) noexcept {
return ch < 0x80;
}
enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 };
-int UTF8Classify(const unsigned char *us, int len);
+int UTF8Classify(const unsigned char *us, int len) noexcept;
// Similar to UTF8Classify but returns a length of 1 for invalid bytes
// instead of setting the invalid flag
-int UTF8DrawBytes(const unsigned char *us, int len);
+int UTF8DrawBytes(const unsigned char *us, int len) noexcept;
// Line separator is U+2028 \xe2\x80\xa8
// Paragraph separator is U+2029 \xe2\x80\xa9
const int UTF8SeparatorLength = 3;
-inline bool UTF8IsSeparator(const unsigned char *us) {
+inline bool UTF8IsSeparator(const unsigned char *us) noexcept {
return (us[0] == 0xe2) && (us[1] == 0x80) && ((us[2] == 0xa8) || (us[2] == 0xa9));
}
// NEL is U+0085 \xc2\x85
const int UTF8NELLength = 2;
-inline bool UTF8IsNEL(const unsigned char *us) {
+inline bool UTF8IsNEL(const unsigned char *us) noexcept {
return (us[0] == 0xc2) && (us[1] == 0x85);
}
@@ -72,11 +72,11 @@ enum { SURROGATE_TRAIL_FIRST = 0xDC00 };
enum { SURROGATE_TRAIL_LAST = 0xDFFF };
enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 };
-inline unsigned int UTF16CharLength(wchar_t uch) {
+inline unsigned int UTF16CharLength(wchar_t uch) noexcept {
return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1;
}
-inline unsigned int UTF16LengthFromUTF8ByteCount(unsigned int byteCount) {
+inline unsigned int UTF16LengthFromUTF8ByteCount(unsigned int byteCount) noexcept {
return (byteCount < 4) ? 1 : 2;
}