0032826: Data Exchange - use OSD_FileSystem within RWStl::ReadAscii() and StepFile_Read()

This commit is contained in:
kgv
2022-02-09 21:16:26 +03:00
committed by smoskvin
parent e2d60d0f7f
commit 2922a73ea7
3 changed files with 25 additions and 44 deletions
+14 -23
View File
@@ -14,22 +14,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// StepFile_Read
// routine assurant l enchainement des operations de lecture d un fichier
// STEP dans un StepModel, en fonction d une cle de reconnaissance
// Retour de la fonction :
// 0 si OK (le StepModel a ete charge)
// -1 si abandon car fichier pas pu etre ouvert
// 1 si erreur en cours de lecture
// Compilation conditionnelle : concerne les mesures de performances
#include <stdio.h>
#include <iostream>
#include <step.tab.hxx>
#include <StepFile_Read.hxx>
#include <StepFile_ReadData.hxx>
#include <Interface_Check.hxx>
@@ -49,9 +35,13 @@
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <OSD_OpenFile.hxx>
#include <OSD_FileSystem.hxx>
#include <OSD_Timer.hxx>
#include "step.tab.hxx"
#include <stdio.h>
#ifdef OCCT_DEBUG
#define CHRONOMESURE
#endif
@@ -73,14 +63,15 @@ static Standard_Integer StepFile_Read (const char* theName,
const Handle(StepData_FileRecognizer)& theRecogData)
{
// if stream is not provided, open file stream here
std::istream *aStreamPtr = theIStream;
std::ifstream aFileStream;
if (!aStreamPtr) {
OSD_OpenStream(aFileStream, theName, std::ios_base::in | std::ios_base::binary);
aStreamPtr = &aFileStream;
std::istream* aStreamPtr = theIStream;
std::shared_ptr<std::istream> aFileStream;
if (aStreamPtr == nullptr)
{
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
aFileStream = aFileSystem->OpenIStream (theName, std::ios::in | std::ios::binary);
aStreamPtr = aFileStream.get();
}
if (aStreamPtr->fail())
if (aStreamPtr == nullptr || aStreamPtr->fail())
{
return -1;
}
+3
View File
@@ -17,6 +17,9 @@
#ifndef StepFile_Read_HeaderFile
#define StepFile_Read_HeaderFile
#include <Standard_CString.hxx>
#include <Standard_Type.hxx>
#include <iostream>
class StepData_StepModel;