Browse Source

start to encapsulate the functions in a class, to avoid the prohibition of partial function specialization.

master
roker 4 years ago
parent
commit
f5b13062c3
  1. 14
      src/nfc.hh

14
src/nfc.hh

@ -31,6 +31,20 @@ protected:
}; };
/// Common class template to define the same functions for all 3 Unicode Transfer Formats.
template<class CharT>
class UTF
{
public:
/// parses a sequence of input code units into one Unicode code point and updates the input iterator c.
/// \todo change to iterator templates?
uint32_t parse(const CharT*& c, const CharT* end);
/// generates a UTF sequence from a given Unicode code point
template<class OutIter>
void generate(const char32_t c, OutIter& out);
};
// scans the char sequences and parses UTF-8 sequences. Detect UTF-8 errors and throws exceptions. // scans the char sequences and parses UTF-8 sequences. Detect UTF-8 errors and throws exceptions.
uint32_t parseUtf8(const char*& c, const char* end); uint32_t parseUtf8(const char*& c, const char* end);

Loading…
Cancel
Save