OpenSceneGraph/include/osgDB/ConvertUTF
2008-11-07 17:07:43 +00:00

38 lines
1.4 KiB
C++

/* -*-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 <osg/Config>
#include <osgDB/Export>
#include <string>
#include <string.h>
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