/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_UTILITIES_UTF8_HPP
#define SHARE_VM_UTILITIES_UTF8_HPP
#include "memory/allocation.hpp"
// Low-level interface for UTF8 strings
public:
// returns the unicode length of a 0-terminated uft8 string
static int unicode_length(const char* uft8_str);
// returns the unicode length of a non-0-terminated uft8 string
// converts a uft8 string to a unicode string
// decodes the current utf8 character, stores the result in value,
// and returns the end of the current uft8 chararacter.
// decodes the current utf8 character, gets the supplementary character instead of
// the surrogate pair when seeing a supplementary character in string,
// stores the result in value, and returns the end of the current uft8 chararacter.
// Utility methods
static bool is_supplementary_character(const unsigned char* str);
};
// Low-level interface for UNICODE strings
// A unicode string represents a string in the UTF-16 format in which supplementary
// characters are represented by surrogate pairs. Index values refer to char code
// units, so a supplementary character uses two positions in a unicode string.
public:
// returns the utf8 size of a unicode character
// returns the utf8 length of a unicode string
// converts a unicode string to utf8 string
// converts a unicode string to a utf8 string; result is allocated
// in resource area unless a buffer is provided.
};
#endif // SHARE_VM_UTILITIES_UTF8_HPP