1 // Copyright (c) 2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 //! Auxiulary file to provide Unicode compatibility for file open functionality
15 //! Names of files are encoded as UTF-16 strings
17 #ifndef _OSD_OpenFile_HeaderFile
18 #define _OSD_OpenFile_HeaderFile
20 #include <Standard_Macro.hxx>
22 #if defined(__cplusplus)
25 #include <TCollection_ExtendedString.hxx>
27 //! Function opens the file stream.
28 //! @param theStream stream to open
29 //! @param theName name of file encoded in UTF-8
30 //! @param theMode opening mode
31 __Standard_API void OSD_OpenStream (std::ofstream& theStream,
33 const std::ios_base::openmode theMode);
35 //! Function opens the file stream.
36 //! @param theStream stream to open
37 //! @param theName name of file encoded in UTF-16
38 //! @param theMode opening mode
39 __Standard_API void OSD_OpenStream (std::ofstream& theStream,
40 const TCollection_ExtendedString& theName,
41 const std::ios_base::openmode theMode);
43 //! Function opens the file stream.
44 //! @param theStream stream to open
45 //! @param theName name of file encoded in UTF-8
46 //! @param theMode opening mode
47 __Standard_API void OSD_OpenStream (std::ifstream& theStream,
49 const std::ios_base::openmode theMode);
51 //! Function opens the file stream.
52 //! @param theStream stream to open
53 //! @param theName name of file encoded in UTF-16
54 //! @param theMode opening mode
55 __Standard_API void OSD_OpenStream (std::ifstream& theStream,
56 const TCollection_ExtendedString& theName,
57 const std::ios_base::openmode theMode);
59 //! Function opens the file buffer.
60 //! @param theBuff file buffer to open
61 //! @param theName name of file encoded in UTF-8
62 //! @param theMode opening mode
63 __Standard_API void OSD_OpenFileBuf (std::filebuf& theBuff,
65 const std::ios_base::openmode theMode);
67 //! Function opens the file buffer.
68 //! @param theBuff file buffer to open
69 //! @param theName name of file encoded in UTF-16
70 //! @param theMode opening mode
71 __Standard_API void OSD_OpenFileBuf (std::filebuf& theBuff,
72 const TCollection_ExtendedString& theName,
73 const std::ios_base::openmode theMode);
76 //! Function opens the file.
77 //! @param theName name of file encoded in UTF-16
78 //! @param theMode opening mode
79 //! @return file handle of opened file
80 __Standard_API FILE* OSD_OpenFile (const TCollection_ExtendedString& theName,
86 //! Function opens the file.
87 //! @param theName name of file encoded in UTF-8
88 //! @param theMode opening mode
89 //! @return file handle of opened file
90 __Standard_API FILE* OSD_OpenFile (const char* theName, const char* theMode);
92 #if defined(__cplusplus)
96 #endif // _OSD_OpenFile_HeaderFile