Browse Source

Add override keyword when compiled with C++11 or later

master
Nemanja Trifunovic 5 years ago
parent
commit
687a59d88c
  1. 8
      source/utf8/checked.h
  2. 6
      source/utf8/core.h

8
source/utf8/checked.h

@ -42,7 +42,7 @@ namespace utf8
uint32_t cp;
public:
invalid_code_point(uint32_t codepoint) : cp(codepoint) {}
virtual const char* what() const throw() { return "Invalid code point"; }
virtual const char* what() const throw() OVERRIDE { return "Invalid code point"; }
uint32_t code_point() const {return cp;}
};
@ -50,7 +50,7 @@ namespace utf8
uint8_t u8;
public:
invalid_utf8 (uint8_t u) : u8(u) {}
virtual const char* what() const throw() { return "Invalid UTF-8"; }
virtual const char* what() const throw() OVERRIDE { return "Invalid UTF-8"; }
uint8_t utf8_octet() const {return u8;}
};
@ -58,13 +58,13 @@ namespace utf8
uint16_t u16;
public:
invalid_utf16 (uint16_t u) : u16(u) {}
virtual const char* what() const throw() { return "Invalid UTF-16"; }
virtual const char* what() const throw() OVERRIDE { return "Invalid UTF-16"; }
uint16_t utf16_word() const {return u16;}
};
class not_enough_room : public exception {
public:
virtual const char* what() const throw() { return "Not enough space"; }
virtual const char* what() const throw() OVERRIDE { return "Not enough space"; }
};
/// The library API - functions intended to be called by the users

6
source/utf8/core.h

@ -38,6 +38,12 @@ DEALINGS IN THE SOFTWARE.
#define UTF_CPP_CPLUSPLUS __cplusplus
#endif
#if UTF_CPP_CPLUSPLUS >= 201103L // C++ 11 or later
#define OVERRIDE override
#else // C++ 98/03
#define OVERRIDE
#endif // C++ 11 or later
namespace utf8
{

Loading…
Cancel
Save