/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library 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 * OpenSceneGraph Public License for more details. */ #ifndef OSGDB_CONVERTUTF #define OSGDB_CONVERTUTF 1 #include #include #include #include #ifdef __CYGWIN__ namespace std { typedef basic_string wstring; } #endif namespace osgDB { std::string OSGDB_EXPORT convertUTF16toUTF8(const wchar_t* source, unsigned sourceLength); std::wstring OSGDB_EXPORT convertUTF8toUTF16(const char* source, unsigned sourceLength); inline std::string convertUTF16toUTF8(const std::wstring& s){return convertUTF16toUTF8(s.c_str(), s.length());} inline std::string convertUTF16toUTF8(const wchar_t* s){return convertUTF16toUTF8(s, wcslen(s));} inline std::wstring convertUTF8toUTF16(const std::string& s){return convertUTF8toUTF16(s.c_str(), s.length());} inline std::wstring convertUTF8toUTF16(const char* s){return convertUTF8toUTF16(s, strlen(s));} } #endif