mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0026890: Foundation Classes, TKernel - define OSD_OpenStream for std::ifstream
This commit is contained in:
parent
e71669c6e5
commit
b40693b0c2
@ -123,3 +123,36 @@ void OSD_OpenStream(std::ofstream& theStream,
|
||||
#endif
|
||||
}
|
||||
|
||||
// ==============================================
|
||||
// function : OSD_OpenStream
|
||||
// purpose : Opens file stream
|
||||
// ==============================================
|
||||
void OSD_OpenStream (std::ifstream& theStream,
|
||||
const char* theName,
|
||||
const std::ios_base::openmode theMode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// file name is treated as UTF-8 string and converted to UTF-16 one
|
||||
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
|
||||
theStream.open ((const wchar_t*)aFileNameW.ToExtString(), theMode);
|
||||
#else
|
||||
theStream.open (theName, theMode);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ==============================================
|
||||
// function : OSD_OpenStream
|
||||
// purpose : Opens file stream
|
||||
// ==============================================
|
||||
void OSD_OpenStream (std::ifstream& theStream,
|
||||
const TCollection_ExtendedString& theName,
|
||||
const std::ios_base::openmode theMode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
theStream.open ((const wchar_t*)theName.ToExtString(), theMode);
|
||||
#else
|
||||
// conversion in UTF-8 for linux
|
||||
NCollection_Utf8String aString ((const Standard_Utf16Char*)theName.ToExtString());
|
||||
theStream.open (aString.ToCString(), theMode);
|
||||
#endif
|
||||
}
|
||||
|
@ -40,6 +40,22 @@ __Standard_API void OSD_OpenStream (std::ofstream& theStream,
|
||||
const TCollection_ExtendedString& theName,
|
||||
const std::ios_base::openmode theMode);
|
||||
|
||||
//! Function opens the file stream.
|
||||
//! @param theStream stream to open
|
||||
//! @param theName name of file encoded in UTF-8
|
||||
//! @param theMode opening mode
|
||||
__Standard_API void OSD_OpenStream (std::ifstream& theStream,
|
||||
const char* theName,
|
||||
const std::ios_base::openmode theMode);
|
||||
|
||||
//! Function opens the file stream.
|
||||
//! @param theStream stream to open
|
||||
//! @param theName name of file encoded in UTF-16
|
||||
//! @param theMode opening mode
|
||||
__Standard_API void OSD_OpenStream (std::ifstream& theStream,
|
||||
const TCollection_ExtendedString& theName,
|
||||
const std::ios_base::openmode theMode);
|
||||
|
||||
//! Function opens the file buffer.
|
||||
//! @param theBuff file buffer to open
|
||||
//! @param theName name of file encoded in UTF-8
|
||||
|
Loading…
x
Reference in New Issue
Block a user