From 4e88c80a22b6ca982341413ee806ade0df57b4b7 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 2 Nov 2017 07:05:11 -0700 Subject: RethinkDB native connector work, minor fixes. --- ext/librethinkdbxx/src/utils.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ext/librethinkdbxx/src/utils.h (limited to 'ext/librethinkdbxx/src/utils.h') diff --git a/ext/librethinkdbxx/src/utils.h b/ext/librethinkdbxx/src/utils.h new file mode 100644 index 00000000..04496e2c --- /dev/null +++ b/ext/librethinkdbxx/src/utils.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include + +namespace RethinkDB { + +// The size of the longest UTF-8 encoded unicode codepoint +const size_t max_utf8_encoded_size = 6; + +// Decode a base64 string. Returns false on failure. +bool base64_decode(const std::string& in, std::string& out); +std::string base64_encode(const std::string&); + +// Encodes a single unicode codepoint into UTF-8. Returns the number of bytes written. +// Does not add a trailing null byte +size_t utf8_encode(unsigned int, char*); + +} -- cgit v1.2.3