From Michael Platings, Converted std::fstream/ifstream/ofstream to osgDB::fstream/ifstream/ofstream and
fopen to osgDB::fopen to facilitate support for wide character filenames using UT8 encoding.
This commit is contained in:
36
include/osgDB/ConvertUTF
Normal file
36
include/osgDB/ConvertUTF
Normal file
@@ -0,0 +1,36 @@
|
||||
/* -*-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>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user