1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
15#define OSGDB_FSTREAM 1
17#include <osgDB/Export>
27* Convenience function for fstream open , std::ifstream, and std::ofstream to
28* automatically handle UTF-8 to UTF-16 filename conversion. Always use one
29* of these classes in any OpenSceneGraph code instead of the STL equivalent.
32void OSGDB_EXPORT open(std::fstream& fs, const char* filename,std::ios_base::openmode mode);
34class ifstream : public std::ifstream
37 OSGDB_EXPORT ifstream();
38 OSGDB_EXPORT explicit ifstream(const char* filename,
39 std::ios_base::openmode mode = std::ios_base::in);
40 OSGDB_EXPORT ~ifstream();
42 void OSGDB_EXPORT open(const char* filename,
43 std::ios_base::openmode mode = std::ios_base::in);
46class ofstream : public std::ofstream
49 OSGDB_EXPORT ofstream();
50 OSGDB_EXPORT explicit ofstream(const char* filename,
51 std::ios_base::openmode mode = std::ios_base::out);
52 OSGDB_EXPORT ~ofstream();
54 void OSGDB_EXPORT open(const char* filename,
55 std::ios_base::openmode mode = std::ios_base::out);