1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0022573: Extend the range of status values returned by the method TDocStd_Application::SaveAs

This commit is contained in:
MSV 2011-09-15 06:32:58 +00:00 committed by bugmaster
parent c345d68b3a
commit 15e8b08292
24 changed files with 305 additions and 318 deletions

View File

@ -39,8 +39,6 @@ is
is redefined virtual;
---Purpose: Write <theDocument> to the binary file <theFileName>
IsError (me) returns Boolean from Standard;
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
returns ADriverTable from BinMDF
is virtual;
@ -93,7 +91,6 @@ fields
myPAtt : Persistent from BinObjMgt;
myDrivers : ADriverTable from BinMDF is protected;
myRelocTable: SRelocationTable from BinObjMgt is protected;
myIsError : Boolean from Standard is protected;
myMsgDriver : MessageDriver from CDM;
-- labels not having writable attributes on it-self and on children

View File

@ -55,7 +55,9 @@ void BinLDrivers_DocumentStorageDriver::Write
(const Handle(CDM_Document)& theDocument,
const TCollection_ExtendedString& theFileName)
{
myIsError = Standard_False;
SetIsError(Standard_False);
SetStoreStatus(PCDM_SS_OK);
myMsgDriver = theDocument -> Application() -> MessageDriver();
myMapUnsupported.Clear();
@ -69,7 +71,8 @@ void BinLDrivers_DocumentStorageDriver::Write
Handle(TDocStd_Document) aDoc =
Handle(TDocStd_Document)::DownCast(theDocument);
if (aDoc.IsNull()) {
myIsError = Standard_True;
SetIsError(Standard_True);
SetStoreStatus(PCDM_SS_Doc_IsNull);
}
else {
// Open the file
@ -84,8 +87,11 @@ void BinLDrivers_DocumentStorageDriver::Write
// 1. Write info section (including types table)
WriteInfoSection(theDocument, aFileName);
myTypesMap.Clear();
if (myIsError)
return;
if (IsError())
{
SetStoreStatus(PCDM_SS_Info_Section_Error);
return;
}
#if !defined(IRIX) // 10.10.2005
ofstream anOS (aFileName.ToCString(), ios::in | ios::binary | ios::ate);
@ -140,7 +146,9 @@ void BinLDrivers_DocumentStorageDriver::Write
#ifdef DEB
WriteMessage (aMethStr + "no objects written");
#endif
myIsError = Standard_True;
SetIsError(Standard_True);
SetStoreStatus(PCDM_SS_No_Obj);
}
myRelocTable.Clear();
}
@ -156,7 +164,8 @@ void BinLDrivers_DocumentStorageDriver::Write
anErrorStr + aMethStr + "Problem writing the file ";
WriteMessage (aStr + theFileName);
#endif
myIsError = Standard_True;
SetIsError(Standard_True);
SetStoreStatus(PCDM_SS_DiskWritingFailure);
}
}
@ -258,16 +267,6 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
}
//=======================================================================
//function : IsError
//purpose :
//=======================================================================
Standard_Boolean BinLDrivers_DocumentStorageDriver::IsError () const
{
return myIsError;
}
//=======================================================================
//function : AttributeDrivers
//purpose :
@ -364,7 +363,7 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
WriteMessage (TCollection_ExtendedString("Error: Cannot open file ") +
theFileName);
#endif
myIsError = Standard_True;
SetIsError(Standard_True);
return;
}
@ -424,7 +423,7 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
WriteMessage(TCollection_ExtendedString("Error: Problem writing header "
"into file ") + theFileName);
#endif
myIsError = Standard_True;
SetIsError(Standard_True);
}
#ifdef DEB
const Standard_Integer aP = (Standard_Integer) aFileDriver.Tell();

View File

@ -22,22 +22,8 @@ is
deferred class Application;
---Category: Store in Database related classes.
--
private class StoreList;
enumeration StoreStatus is
SS_OK,
SS_DriverFailure,
SS_WriteFailure,
SS_Failure
end StoreStatus from CDF;
---Category: Retrieve from Database related classes.
--
---Category: API for Store and retrieve
--
@ -46,30 +32,6 @@ is
enumeration TryStoreStatus is TS_OK,TS_NoCurrentDocument,TS_NoDriver,TS_NoSubComponentDriver
end TryStoreStatus;
enumeration RetrievableStatus is
RS_OK,
RS_AlreadyRetrievedAndModified,
RS_AlreadyRetrieved,
RS_UnknownDocument,
RS_NoDriver,
RS_UnknownFileDriver,
RS_WrongResource,
RS_OpenError,
RS_NoVersion,
RS_NoModel,
RS_NoSchema,
RS_NoDocument,
RS_ExtensionFailure,
RS_WrongStreamMode,
RS_FormatFailure,
RS_TypeFailure,
RS_TypeNotFoundInSchema,
RS_UnrecognizedFileFormat,
RS_MakeFailure,
RS_PermissionDenied,
RS_DriverFailure
end RetrievableStatus;
enumeration SubComponentStatus is SCS_Consistent, SCS_Unconsistent,SCS_Stored,SCS_Modified
end SubComponentStatus;
@ -105,4 +67,3 @@ is
returns Boolean from Standard;
end CDF;

View File

@ -12,7 +12,7 @@ uses
Document from CDM,
Manager from Resource,
MetaData from CDM,
RetrievableStatus from CDF,
ReaderStatus from PCDM,
GUID from Standard,
Reader from PCDM,
Writer from PCDM,
@ -101,18 +101,18 @@ is
CanRetrieve(me: mutable; aFolder, aName: ExtendedString from TCollection)
---Purpose:
returns RetrievableStatus from CDF;
returns ReaderStatus from PCDM;
CanRetrieve(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
---Purpose:
returns RetrievableStatus from CDF;
returns ReaderStatus from PCDM;
Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
is deferred;
---Category: CurrentDocument methods.
--
GetRetrieveStatus(me) returns RetrievableStatus from CDF;
GetRetrieveStatus(me) returns ReaderStatus from PCDM;
---C++: inline
---Purpose: Checks status after Retrieve
@ -200,12 +200,12 @@ is
is private;
CanRetrieve(me: mutable; aMetaData: MetaData from CDM)
returns RetrievableStatus from CDF
returns ReaderStatus from PCDM
is private;
fields
myDefaultFolder: ExtendedString from TCollection;
myRetrievableStatus : RetrievableStatus from CDF is protected;
myRetrievableStatus : ReaderStatus from PCDM is protected;
friends
class Session from CDF--,

View File

@ -15,11 +15,11 @@
#include <CDF_Session.hxx>
#include <CDF_Directory.hxx>
#include <CDF_MetaDataDriver.hxx>
#include <CDF_RetrievableStatus.hxx>
#include <PCDM_ReaderStatus.hxx>
#include <PCDM_ReadWriter.hxx>
#include <PCDM_RetrievalDriver.hxx>
#include <PCDM_StorageDriver.hxx>
#include <PCDM_ReaderStatus.hxx>
#include <Plugin.hxx>
#include <UTL.hxx>
@ -33,7 +33,7 @@
//function :
//purpose :
//=======================================================================
CDF_Application::CDF_Application():myRetrievableStatus(CDF_RS_OK) {}
CDF_Application::CDF_Application():myRetrievableStatus(PCDM_RS_OK) {}
//=======================================================================
//function : Load
@ -128,7 +128,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const TCollection_ExtendedString
//function : CanRetrieve
//purpose :
//=======================================================================
CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
TCollection_ExtendedString aVersion;
return CanRetrieve(aFolder,aName,aVersion);
}
@ -137,16 +137,16 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
//function : CanRetrieve
//purpose :
//=======================================================================
CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
#ifdef DEB
CDF_Timer theTimer;
#endif
if (!theMetaDataDriver->Find(aFolder,aName,aVersion))
return CDF_RS_UnknownDocument;
return PCDM_RS_UnknownDocument;
else if (!theMetaDataDriver->HasReadPermission(aFolder,aName,aVersion))
return CDF_RS_PermissionDenied;
return PCDM_RS_PermissionDenied;
else {
#ifdef DEB
theTimer.ShowAndRestart("theMetaDataDriver->Find: ");
@ -160,7 +160,7 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
if(theMetaData->IsRetrieved()) {
return theMetaData->Document()->IsModified()
? CDF_RS_AlreadyRetrievedAndModified : CDF_RS_AlreadyRetrieved;
? PCDM_RS_AlreadyRetrievedAndModified : PCDM_RS_AlreadyRetrieved;
}
else {
TCollection_ExtendedString theFileName=theMetaData->FileName();
@ -172,12 +172,12 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
theFormat=UTL::Value(Resources(),ResourceName);
}
else
return CDF_RS_UnrecognizedFileFormat;
return PCDM_RS_UnrecognizedFileFormat;
}
if(!FindReaderFromFormat(theFormat)) return CDF_RS_NoDriver;
if(!FindReaderFromFormat(theFormat)) return PCDM_RS_NoDriver;
}
}
return CDF_RS_OK;
return PCDM_RS_OK;
}
@ -241,64 +241,6 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
return Retrieve(aMetaData,UseStorageConfiguration,Standard_True);
}
//=======================================================================
//function : ConvertStatus
//purpose :
//=======================================================================
static CDF_RetrievableStatus ConvertStatus(const PCDM_ReaderStatus theStatus) {
CDF_RetrievableStatus aStatus;
switch(theStatus) {
case PCDM_RS_OK:
aStatus=CDF_RS_OK;
break;
case PCDM_RS_NoDriver:
aStatus=CDF_RS_NoDriver;
break;
case PCDM_RS_UnknownFileDriver:
aStatus=CDF_RS_UnknownFileDriver;
break;
case PCDM_RS_OpenError:
aStatus=CDF_RS_OpenError;
break;
case PCDM_RS_NoVersion:
aStatus=CDF_RS_NoVersion;
break;
case PCDM_RS_NoSchema:
aStatus=CDF_RS_NoSchema;
break;
case PCDM_RS_NoDocument:
aStatus=CDF_RS_NoDocument;
break;
case PCDM_RS_ExtensionFailure:
aStatus=CDF_RS_ExtensionFailure;
break;
case PCDM_RS_WrongStreamMode:
aStatus=CDF_RS_WrongStreamMode;
break;
case PCDM_RS_FormatFailure:
aStatus=CDF_RS_FormatFailure;
break;
case PCDM_RS_TypeFailure:
aStatus=CDF_RS_TypeFailure;
break;
case PCDM_RS_TypeNotFoundInSchema:
aStatus=CDF_RS_TypeNotFoundInSchema;
break;
case PCDM_RS_UnrecognizedFileFormat:
aStatus=CDF_RS_UnrecognizedFileFormat;
break;
case PCDM_RS_MakeFailure:
aStatus=CDF_RS_MakeFailure;
break;
case PCDM_RS_PermissionDenied:
aStatus=CDF_RS_PermissionDenied;
break;
default:
aStatus=CDF_RS_DriverFailure;
}
return aStatus;
}
//=======================================================================
//function : Retrieve
//purpose :
@ -306,18 +248,18 @@ static CDF_RetrievableStatus ConvertStatus(const PCDM_ReaderStatus theStatus) {
Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration, const Standard_Boolean IsComponent) {
Handle(CDM_Document) theDocumentToReturn;
myRetrievableStatus = CDF_RS_DriverFailure;
myRetrievableStatus = PCDM_RS_DriverFailure;
if(IsComponent) {
Standard_SStream aMsg;
switch (CanRetrieve(aMetaData)) {
case CDF_RS_UnknownDocument:
case PCDM_RS_UnknownDocument:
aMsg << "could not find the referenced document: " << aMetaData->Path() << "; not found." <<(char)0 << endl;
myRetrievableStatus = CDF_RS_UnknownDocument;
myRetrievableStatus = PCDM_RS_UnknownDocument;
Standard_Failure::Raise(aMsg);
break;
case CDF_RS_PermissionDenied:
case PCDM_RS_PermissionDenied:
aMsg << "Could not find the referenced document: " << aMetaData->Path() << "; permission denied. " <<(char)0 << endl;
myRetrievableStatus = CDF_RS_PermissionDenied;
myRetrievableStatus = PCDM_RS_PermissionDenied;
Standard_Failure::Raise(aMsg);
break;
default:
@ -326,9 +268,9 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
}
Standard_Boolean AlreadyRetrieved=aMetaData->IsRetrieved();
if(AlreadyRetrieved) myRetrievableStatus = CDF_RS_AlreadyRetrieved;
if(AlreadyRetrieved) myRetrievableStatus = PCDM_RS_AlreadyRetrieved;
Standard_Boolean Modified=AlreadyRetrieved && aMetaData->Document()->IsModified();
if(Modified) myRetrievableStatus = CDF_RS_AlreadyRetrievedAndModified;
if(Modified) myRetrievableStatus = PCDM_RS_AlreadyRetrievedAndModified;
if(!AlreadyRetrieved || Modified) {
Handle(PCDM_Reader) theReader=Reader(aMetaData->FileName());
@ -353,17 +295,14 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
theReader->Read(aMetaData->FileName(),theDocument,this);
}
catch (Standard_Failure) {
PCDM_ReaderStatus aStatus = theReader->GetStatus();
myRetrievableStatus = ConvertStatus(aStatus);
if(myRetrievableStatus > CDF_RS_AlreadyRetrieved){
myRetrievableStatus = theReader->GetStatus();
if(myRetrievableStatus > PCDM_RS_AlreadyRetrieved){
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
}
}
PCDM_ReaderStatus aStatus = theReader->GetStatus();
myRetrievableStatus = ConvertStatus(aStatus);
myRetrievableStatus = theReader->GetStatus();
theDocument->SetMetaData(aMetaData);
theDocumentToReturn=theDocument;
@ -451,7 +390,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
if(!FindReaderFromFormat(aFormat,thePluginId,UnfoundResourceName)) {
Standard_SStream aMsg;
aMsg << "Could not found the item:" << UnfoundResourceName <<(char)0;
myRetrievableStatus = CDF_RS_WrongResource;
myRetrievableStatus = PCDM_RS_WrongResource;
Standard_NoSuchObject::Raise(aMsg);
}
Handle(PCDM_Reader) R;
@ -460,7 +399,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
R = Handle(PCDM_Reader)::DownCast(Plugin::Load(thePluginId));
}
catch (Standard_Failure) {
myRetrievableStatus = CDF_RS_WrongResource;
myRetrievableStatus = PCDM_RS_WrongResource;
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
@ -470,7 +409,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
RD->SetFormat(aFormat);
return RD;
} else
myRetrievableStatus = CDF_RS_WrongResource;
myRetrievableStatus = PCDM_RS_WrongResource;
return R;
}
@ -540,7 +479,7 @@ Standard_Boolean CDF_Application::FindReaderFromFormat(const TCollection_Extende
//function : CanRetrieve
//purpose :
//=======================================================================
CDF_RetrievableStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
PCDM_ReaderStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
if(aMetaData->HasVersion())
return CanRetrieve(aMetaData->Folder(),aMetaData->Name(),aMetaData->Version());
else

View File

@ -10,7 +10,7 @@
// ! szy ! Creation !26-06-2003! 5.0-20-%L%!
// +---------------------------------------------------------------------------+
inline CDF_RetrievableStatus CDF_Application::GetRetrieveStatus() const {
inline PCDM_ReaderStatus CDF_Application::GetRetrieveStatus() const {
return myRetrievableStatus;
}
// @@SDM: begin

View File

@ -12,7 +12,7 @@ uses Document from CDM,
SubComponentStatus from CDF,
ExtendedString from TCollection,
StoreList from CDF,
StoreStatus from CDF,
StoreStatus from PCDM,
ExtendedString from TCollection
is
@ -148,7 +148,7 @@ is
-- be used just after Realize or Import -- method to know if
-- thes methods worked correctly, and if not why.
StoreStatus(me) returns StoreStatus from CDF;
StoreStatus(me) returns StoreStatus from PCDM;
AssociatedStatusText(me) returns ExtString from Standard;
---Category: Private methods
@ -181,7 +181,7 @@ fields
myPath: ExtendedString from TCollection;
myText: ExtendedString from TCollection;
myStatus: StoreStatus from CDF;
myStatus: StoreStatus from PCDM;
end Store from CDF;

View File

@ -2,7 +2,7 @@
#include <CDF_Store.ixx>
#include <CDF_Session.hxx>
#include <CDF_Application.hxx>
#include <CDF_StoreStatus.hxx>
#include <PCDM_StoreStatus.hxx>
#include <CDF_StoreSetNameStatus.hxx>
#include <Standard_ProgramError.hxx>
#include <CDF_MetaDataDriver.hxx>
@ -160,7 +160,7 @@ void CDF_Store::Realize() {
Handle(CDM_MetaData) m;
myText = "";
myStatus = myList->Store(m,myText);
if(myStatus==CDF_SS_OK) myPath = m->Path();
if(myStatus==PCDM_SS_OK) myPath = m->Path();
}
Standard_ExtString CDF_Store::Path() const {
return myPath.ToExtString();
@ -280,7 +280,7 @@ CDF_SubComponentStatus CDF_Store::SubComponentStatus(const Standard_ExtString aP
CDF_StoreStatus CDF_Store::StoreStatus() const {
PCDM_StoreStatus CDF_Store::StoreStatus() const {
return myStatus;
}
Standard_ExtString CDF_Store::AssociatedStatusText() const {

View File

@ -6,7 +6,15 @@
private class StoreList from CDF inherits Transient from Standard
uses Document from CDM, StackOfDocument from CDM, MapOfDocument from CDM, MapIteratorOfMapOfDocument from CDM, StackIteratorOfStackOfDocument from CDM,MetaData from CDM, ExtendedString from TCollection, StoreStatus from CDF
uses
Document from CDM,
StackOfDocument from CDM,
MapOfDocument from CDM,
MapIteratorOfMapOfDocument from CDM,
StackIteratorOfStackOfDocument from CDM,
MetaData from CDM,
ExtendedString from TCollection,
StoreStatus from PCDM
raises NoSuchObject from Standard
is
@ -19,7 +27,7 @@ is
Store(me: mutable; aMetaData: out MetaData from CDM;
aStatusAssociatedText: out ExtendedString from TCollection)
returns StoreStatus from CDF
returns StoreStatus from PCDM
---Purpose: stores each object of the storelist in the reverse
-- order of which they had been added.
raises NoSuchObject from Standard;

View File

@ -65,61 +65,60 @@ void CDF_StoreList::Next() {
Handle(CDM_Document) CDF_StoreList::Value() const {
return myIterator.Key();
}
CDF_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
Handle(CDF_MetaDataDriver) theMetaDataDriver = CDF_Session::CurrentSession()->MetaDataDriver();
static CDF_StoreStatus status ;
status = CDF_SS_OK;
PCDM_StoreStatus status = PCDM_SS_OK;
{
try {
OCC_CATCH_SIGNALS
for (; !myStack.IsEmpty(); myStack.Pop()) {
Handle(CDM_Document) theDocument = myStack.Top();
if( theDocument == myMainDocument || theDocument->IsModified()) {
if(!PCDM::FindStorageDriver(theDocument)){
Standard_SStream aMsg;
aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
Standard_Failure::Raise(aMsg);
}
if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
Standard_SStream aMsg; aMsg << "could not find the active dbunit";
aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
Standard_NoSuchObject::Raise(aMsg);
}
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
Handle(CDM_Document) theDocument = myStack.Top();
if( theDocument == myMainDocument || theDocument->IsModified()) {
CDF_Timer theTimer;
PCDM::StorageDriver(theDocument)->Write(theDocument,theName);
theTimer.ShowAndRestart("Driver->Write: ");
if(!PCDM::FindStorageDriver(theDocument)){
Standard_SStream aMsg;
aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
Standard_Failure::Raise(aMsg);
}
aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
theTimer.ShowAndStop("metadata creating: ");
theDocument->SetMetaData(aMetaData);
if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
Standard_SStream aMsg; aMsg << "could not find the active dbunit";
aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
Standard_NoSuchObject::Raise(aMsg);
}
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
CDM_ReferenceIterator it(theDocument);
for(; it.More();it.Next()) {
theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
}
}
CDF_Timer theTimer;
Handle(PCDM_StorageDriver) aDocumentStorageDriver = PCDM::StorageDriver(theDocument);
aDocumentStorageDriver->Write(theDocument,theName);
status = aDocumentStorageDriver->GetStoreStatus();
theTimer.ShowAndRestart("Driver->Write: ");
aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
theTimer.ShowAndStop("metadata creating: ");
theDocument->SetMetaData(aMetaData);
CDM_ReferenceIterator it(theDocument);
for(; it.More();it.Next()) {
theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
}
}
}
}
catch (CDF_MetaDataDriverError) {
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("metadatadriver failed; reason:"));
status = CDF_SS_DriverFailure;
status = PCDM_SS_DriverFailure;
}
catch (Standard_Failure) {
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("driver failed; reason:"));
status = CDF_SS_Failure;
status = PCDM_SS_Failure;
}
}

View File

@ -162,38 +162,40 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
di <<"document " << insession << " is already in session" << "\n";
return 0;
}
CDF_RetrievableStatus theStatus = A->Open(path,D);
if (theStatus == CDF_RS_OK && !D.IsNull()) {
PCDM_ReaderStatus theStatus = A->Open(path,D);
if (theStatus == PCDM_RS_OK && !D.IsNull()) {
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(D);
TDataStd_Name::Set(D->GetData()->Root(),a[2]);
Draw::Set(a[2],DD);
return 0;
} else {
switch ( theStatus ) {
case CDF_RS_AlreadyRetrieved:
case CDF_RS_AlreadyRetrievedAndModified: {
case PCDM_RS_AlreadyRetrieved:
case PCDM_RS_AlreadyRetrievedAndModified: {
di << " already retrieved " << "\n" ;
break;
}
case CDF_RS_NoDriver: {
case PCDM_RS_NoDriver: {
di << " could not retrieve , no Driver to make it " <<"\n" ;
break ;
}
case CDF_RS_UnknownDocument:
case CDF_RS_NoModel: {
case PCDM_RS_UnknownDocument:
case PCDM_RS_NoModel: {
di << " could not retrieve , Unknown Document or No Model " <<"\n";
break ;
}
case CDF_RS_TypeNotFoundInSchema:
case CDF_RS_UnrecognizedFileFormat: {
case PCDM_RS_TypeNotFoundInSchema:
case PCDM_RS_UnrecognizedFileFormat: {
di << " could not retrieve , Type not found or Unrecognized File Format" <<"\n";
break ;
}
case CDF_RS_PermissionDenied: {
case PCDM_RS_PermissionDenied: {
di << " could not retrieve , permission denied " << "\n" ;
break;
}
default:
di << " could not retrieve " << "\n" ;
break;
}
di << "DDocStd_Open : Error" << "\n";
}
@ -241,18 +243,18 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
TCollection_ExtendedString path (a[2]);
Handle(TDocStd_Application) A;
if (!DDocStd::Find(A)) return 1;
CDF_StoreStatus theStatus = A->SaveAs(D,path);
if (theStatus != CDF_SS_OK ) {
PCDM_StoreStatus theStatus = A->SaveAs(D,path);
if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
case CDF_SS_DriverFailure: {
case PCDM_SS_DriverFailure: {
di << " could not store , no driver found to make it " <<"\n" ;
break ;
}
case CDF_SS_WriteFailure: {
case PCDM_SS_WriteFailure: {
di << " Write access failure " << "\n" ;
break;
}
case CDF_SS_Failure: {
case PCDM_SS_Failure: {
di << " Write failure " << "\n" ;
}
}

View File

@ -29,9 +29,25 @@ is
RS_UnrecognizedFileFormat,
RS_MakeFailure,
RS_PermissionDenied,
RS_DriverFailure
RS_DriverFailure,
RS_AlreadyRetrievedAndModified,
RS_AlreadyRetrieved,
RS_UnknownDocument,
RS_WrongResource,
RS_NoModel
end ReaderStatus;
enumeration StoreStatus is
SS_OK,
SS_DriverFailure,
SS_WriteFailure,
SS_Failure,
SS_DiskWritingFailure,
SS_UserRightsFailure,
SS_Doc_IsNull,
SS_No_Obj,
SS_Info_Section_Error
end StoreStatus;
deferred class Document;
class SequenceOfDocument instantiates Sequence from TCollection(Document from PCDM);
@ -84,4 +100,3 @@ is
returns TypeOfFileDriver from PCDM
is private;
end PCDM;

View File

@ -23,7 +23,15 @@ deferred class StorageDriver from PCDM inherits Writer from PCDM
--
---Category: persistent implemention of storage.
uses Document from CDM, Document from PCDM, Data from Storage, ExtendedString from TCollection, Schema from Storage,SequenceOfExtendedString from TColStd, SequenceOfDocument from PCDM
uses
Document from CDM,
Document from PCDM,
Data from Storage,
ExtendedString from TCollection,
Schema from Storage,
SequenceOfExtendedString from TColStd,
SequenceOfDocument from PCDM,
StoreStatus from PCDM
raises NoSuchObject from Standard,DriverError from PCDM
is
@ -62,9 +70,17 @@ is
GetFormat (me)
returns ExtendedString from TCollection;
IsError (me) returns Boolean from Standard;
SetIsError(me : mutable; theIsError : Boolean);
GetStoreStatus (me) returns StoreStatus from PCDM;
SetStoreStatus(me : mutable; theStoreStatus : StoreStatus from PCDM);
fields
myFormat : ExtendedString from TCollection;
myIsError: Boolean from Standard;
myStoreStatus: StoreStatus from PCDM;
end StorageDriver from PCDM;

View File

@ -133,3 +133,40 @@ TCollection_ExtendedString PCDM_StorageDriver::GetFormat () const
{
return myFormat;
}
//=======================================================================
//function : IsError
//purpose :
//=======================================================================
Standard_Boolean PCDM_StorageDriver::IsError () const
{
return myIsError;
}
//=======================================================================
//function : SetIsError
//purpose :
//=======================================================================
void PCDM_StorageDriver::SetIsError(const Standard_Boolean theIsError)
{
myIsError = theIsError;
}
//=======================================================================
//function : GetStoreStatus
//purpose :
//=======================================================================
PCDM_StoreStatus PCDM_StorageDriver::GetStoreStatus () const
{
return myStoreStatus;
}
//=======================================================================
//function : SetStoreStatus
//purpose :
//=======================================================================
void PCDM_StorageDriver::SetStoreStatus(const PCDM_StoreStatus theStoreStatus)
{
myStoreStatus = theStoreStatus;
}

View File

@ -2003,8 +2003,8 @@ static int BUC60867(Draw_Interpretor& di, Standard_Integer argc, const char ** a
di<<2;
return 0;
}
CDF_RetrievableStatus Result = A->Open(path,D);
if(Result==CDF_RS_OK){
PCDM_ReaderStatus Result = A->Open(path,D);
if(Result==PCDM_RS_OK){
di<<0;
return 0;
}

View File

@ -788,7 +788,7 @@ static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/,
#include <TDocStd_Document.hxx>
#include <DDocStd.hxx>
#include <CDF_StoreStatus.hxx>
#include <PCDM_StoreStatus.hxx>
#include <TDocStd_Application.hxx>
static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
@ -809,18 +809,18 @@ static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb,
di << "this document has never been saved" << "\n";
return 0;
}
CDF_StoreStatus theStatus = A->Save(D, theStatusMessage);
if (theStatus != CDF_SS_OK ) {
PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
case CDF_SS_DriverFailure: {
case PCDM_SS_DriverFailure: {
di << " Could not store , no driver found to make it " <<"\n" ;
break ;
}
case CDF_SS_WriteFailure: {
case PCDM_SS_WriteFailure: {
di << " Write access failure " << "\n" ;
break;
}
case CDF_SS_Failure: {
case PCDM_SS_Failure: {
di << " Write failure " << "\n" ;
}
}
@ -844,18 +844,18 @@ static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb
if (!DDocStd::Find(A)) return 1;
TCollection_ExtendedString theStatusMessage;
CDF_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
if (theStatus != CDF_SS_OK ) {
PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
case CDF_SS_DriverFailure: {
case PCDM_SS_DriverFailure: {
di << " Could not store , no driver found to make it " <<"\n" ;
break ;
}
case CDF_SS_WriteFailure: {
case PCDM_SS_WriteFailure: {
di << " Write access failure " << "\n" ;
break;
}
case CDF_SS_Failure: {
case PCDM_SS_Failure: {
di << " Write failure " << "\n" ;
}
}
@ -1104,7 +1104,7 @@ static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, con
// 3. Open document
TCollection_ExtendedString name(argv[2]);
Handle(TDocStd_Document) Doc;
if(App->Open(name, Doc) != CDF_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
Draw::Set(argv[1],DD);
@ -4218,8 +4218,8 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
//
// Save
//if (app->SaveAs(doc_std, "W:\\doc.std") != CDF_SS_OK)
if (app->SaveAs(doc_std, aFile1) != CDF_SS_OK)
//if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
return 1;
intlist.Nullify();
dbllist.Nullify();
@ -4230,8 +4230,8 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
ref.Nullify();
app->Close(doc_std);
doc_std.Nullify();
//if (app->Open("W:\\doc.std", doc_std_open) != CDF_RS_OK)
if (app->Open(aFile1, doc_std_open) != CDF_RS_OK)
//if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
return 2;
if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
return 3;
@ -4364,15 +4364,15 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
//
// Save
//if (app->SaveAs(doc_xml, "W:\\doc.xml") != CDF_SS_OK)
if (app->SaveAs(doc_xml, aFile2) != CDF_SS_OK)
//if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
return 1;
intlist.Nullify();
ref.Nullify();
app->Close(doc_xml);
doc_xml.Nullify();
//if (app->Open("W:\\doc.xml", doc_xml_open) != CDF_RS_OK)
if (app->Open(aFile2, doc_xml_open) != CDF_RS_OK)
//if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
return 2;
if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
return 3;
@ -4525,15 +4525,15 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
//
// Save
//if (app->SaveAs(doc_bin, "W:\\doc.cbf") != CDF_SS_OK)
if (app->SaveAs(doc_bin, aFile3) != CDF_SS_OK)
//if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
return 1;
intlist.Nullify();
ref.Nullify();
app->Close(doc_bin);
doc_bin.Nullify();
//if (app->Open("W:\\doc.cbf", doc_bin_open) != CDF_RS_OK)
if (app->Open(aFile3, doc_bin_open) != CDF_RS_OK)
//if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
return 2;
if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
return 3;

View File

@ -117,11 +117,11 @@ static Standard_Integer OCC267 (Draw_Interpretor& di, Standard_Integer argc, con
Handle(TDocStd_Application) A;
if (!DDocStd::Find(A)) return 1;
CDF_StoreStatus theStatus = A->SaveAs(D,path);
if (theStatus == CDF_SS_OK ) {
di << "OCC267 : CDF_StoreStatus = CDF_SS_OK" << "\n";
PCDM_StoreStatus theStatus = A->SaveAs(D,path);
if (theStatus == PCDM_SS_OK ) {
di << "OCC267 : PCDM_StoreStatus = PCDM_SS_OK" << "\n";
} else {
di << "OCC267 : CDF_StoreStatus = Bad_Store_Status" << "\n";
di << "OCC267 : PCDM_StoreStatus = Bad_Store_Status" << "\n";
}
return 0;

View File

@ -43,6 +43,7 @@ uses
Standard,
CDF,
CDM,
PCDM,
MDF,
TDF,
TColStd,

View File

@ -43,8 +43,8 @@ uses Manager from Resource,
CString from Standard,
ExtendedString from TCollection,
SequenceOfExtendedString from TColStd,
RetrievableStatus from CDF,
StoreStatus from CDF
ReaderStatus from PCDM,
StoreStatus from PCDM
raises NoSuchObject from Standard
@ -182,13 +182,13 @@ is
-- In order not to override a version of aDoc which
-- is already in memory, this method can be made
-- to depend on the value returned by IsInSession.
returns RetrievableStatus from CDF;
returns ReaderStatus from PCDM;
SaveAs (me : mutable; aDoc : Document from TDocStd;
path : ExtendedString from TCollection)
---Purpose: Save the active document in the file <name> in the
-- path <path> ; o verwrites the file if it already exists.
returns StoreStatus from CDF;
returns StoreStatus from PCDM;
Save (me : mutable; aDoc : Document from TDocStd)
@ -196,7 +196,7 @@ is
-- Exceptions:
-- Standard_NotImplemented if the document
-- was not retrieved in the applicative session by using Open.
returns StoreStatus from CDF;
returns StoreStatus from PCDM;
SaveAs (me : mutable; aDoc : Document from TDocStd;
path : ExtendedString from TCollection;
@ -204,12 +204,12 @@ is
---Purpose: Save the active document in the file <name> in the
-- path <path> . overwrite the file if it
-- already exist.
returns StoreStatus from CDF;
returns StoreStatus from PCDM;
Save (me : mutable; aDoc : Document from TDocStd;
theStatusMessage: out ExtendedString from TCollection)
---Purpose: Save the document overwriting the previous file
returns StoreStatus from CDF;
returns StoreStatus from PCDM;
--Exit (me)
-- to quit the application. the applicative documents must be closed before.
@ -235,4 +235,3 @@ friends
class Document from TDocStd
end Application;

View File

@ -174,8 +174,8 @@ Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedStr
//purpose :
//=======================================================================
CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
CDF_RetrievableStatus status = CDF_RS_DriverFailure;
PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
PCDM_ReaderStatus status = PCDM_RS_DriverFailure;
TDocStd_PathParser tool (path);
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
@ -183,7 +183,7 @@ CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString
file+=tool.Extension();
#ifdef BUC60867
status = CanRetrieve(directory,file);
if (status != CDF_RS_OK) return status;
if (status != PCDM_RS_OK) return status;
#endif
try {
OCC_CATCH_SIGNALS
@ -215,7 +215,7 @@ CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString
//purpose :
//=======================================================================
CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,const TCollection_ExtendedString& path) {
PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,const TCollection_ExtendedString& path) {
TDocStd_PathParser tool (path);
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
@ -246,7 +246,7 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,co
MessageDriver()->Write(aString.ToExtString());
}
}
if(storer.StoreStatus() == CDF_SS_OK)
if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
#ifdef BUC60867
#ifdef DEB
@ -261,9 +261,9 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,co
//purpose :
//=======================================================================
CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
#ifdef BUC60867
CDF_StoreStatus status = CDF_SS_OK;
PCDM_StoreStatus status = PCDM_SS_OK;
#endif
if (D->IsSaved()) {
CDF_Store storer (D);
@ -278,18 +278,17 @@ CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
MessageDriver()->Write(aString.ToExtString());
}
}
if(storer.StoreStatus() == CDF_SS_OK)
if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
#ifdef BUC60867
status = storer.StoreStatus();
#endif
} else {
// Standard_DomainError::Raise ("TDocStd_Application::Save document is not already saved");
if(!MessageDriver().IsNull()) {
TCollection_ExtendedString aMsg("Document is already saved");
TCollection_ExtendedString aMsg("Document has not been saved yet");
MessageDriver()->Write(aMsg.ToExtString());
}
status = CDF_SS_Failure;
status = PCDM_SS_Failure;
}
#ifdef BUC60867
#ifdef DEB
@ -330,12 +329,12 @@ CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
//purpose :
//=======================================================================
CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
const TCollection_ExtendedString& path,
TCollection_ExtendedString& theStatusMessage)
{
TDocStd_PathParser tool (path);
CDF_StoreStatus aStatus = CDF_SS_Failure;
PCDM_StoreStatus aStatus = PCDM_SS_Failure;
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
file+=".";
@ -355,7 +354,7 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
MessageDriver()->Write(aString.ToExtString());
}
}
if(storer.StoreStatus() == CDF_SS_OK)
if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
theStatusMessage = storer.AssociatedStatusText();
aStatus = storer.StoreStatus();
@ -363,7 +362,7 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
theStatusMessage =
TCollection_ExtendedString("TDocStd_Application::SaveAs"
": No such directory ") + directory;
aStatus = CDF_SS_Failure;
aStatus = PCDM_SS_Failure;
}
return aStatus;
}
@ -373,10 +372,10 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
//purpose :
//=======================================================================
CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
TCollection_ExtendedString& theStatusMessage)
{
CDF_StoreStatus status = CDF_SS_OK;
PCDM_StoreStatus status = PCDM_SS_OK;
if (D->IsSaved()) {
CDF_Store storer (D);
try {
@ -390,14 +389,13 @@ CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
MessageDriver()->Write(aString.ToExtString());
}
}
if(storer.StoreStatus() == CDF_SS_OK)
if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
status = storer.StoreStatus();
theStatusMessage = storer.AssociatedStatusText();
} else {
Standard_DomainError::Raise ("TDocStd_Application::Save"
" document is not already saved");
theStatusMessage = "TDocStd_Application::the document is not already saved";
theStatusMessage = "TDocStd_Application::the document has not been saved yet";
status = PCDM_SS_Failure;
}
return status;
}

View File

@ -52,6 +52,21 @@
.TObj_Appl_SWriteFailure
Error saving document %s : write failure
.TObj_Appl_SFailure
Error saving document %s : general failure of persistence driver
.TObj_Appl_SDiskWritingFailure
Error saving document %s : possibly the disk is full or other disk write problem occurred
.TObj_Appl_SDocIsNull
Error saving document %s : No document to save
.TObj_Appl_SNoObj
Error saving document %s : No objects written
.TObj_Appl_SInfoSectionError
Error saving document %s : Write info section failure
.TObj_Appl_SUnknownFailure
Error saving document %s : unknown failure

View File

@ -73,19 +73,33 @@ Standard_Boolean TObj_Application::SaveDocument
myIsError = Standard_False;
TCollection_ExtendedString aPath ((const Standard_CString)theTargetFile);
CDF_StoreStatus aStatus = SaveAs (theSourceDoc, aPath);
myIsError = aStatus != CDF_SS_OK;
PCDM_StoreStatus aStatus = SaveAs (theSourceDoc, aPath);
myIsError = aStatus != PCDM_SS_OK;
if (myIsError)
{
switch (aStatus)
{
case CDF_SS_DriverFailure:
case PCDM_SS_DriverFailure:
ErrorMessage (Message_Msg("TObj_Appl_SDriverFailure") << aPath);
break;
case CDF_SS_WriteFailure:
case PCDM_SS_WriteFailure:
ErrorMessage (Message_Msg("TObj_Appl_SWriteFailure") << aPath);
break;
case CDF_SS_Failure:
case PCDM_SS_Failure:
ErrorMessage (Message_Msg("TObj_Appl_SFailure") << aPath);
break;
case PCDM_SS_DiskWritingFailure:
ErrorMessage (Message_Msg("TObj_Appl_SDiskWritingFailure") << aPath);
break;
case PCDM_SS_Doc_IsNull:
ErrorMessage (Message_Msg("TObj_Appl_SDocIsNull") << aPath);
break;
case PCDM_SS_No_Obj:
ErrorMessage (Message_Msg("TObj_Appl_SNoObj") << aPath);
break;
case PCDM_SS_Info_Section_Error:
ErrorMessage (Message_Msg("TObj_Appl_SInfoSectionError") << aPath);
break;
default:
ErrorMessage (Message_Msg("TObj_Appl_SUnknownFailure") << aPath);
break;
@ -109,7 +123,7 @@ Standard_Boolean TObj_Application::LoadDocument
myIsError = Standard_False;
TCollection_ExtendedString aPath ((const Standard_CString)theSourceFile);
CDF_RetrievableStatus aStatus = (CDF_RetrievableStatus) -1;
PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
{
try
{
@ -123,54 +137,54 @@ Standard_Boolean TObj_Application::LoadDocument
#endif
}
}
myIsError = aStatus != CDF_RS_OK;
myIsError = aStatus != PCDM_RS_OK;
if (myIsError)
{
switch (aStatus)
{
case CDF_RS_UnknownDocument:
case PCDM_RS_UnknownDocument:
ErrorMessage (Message_Msg("TObj_Appl_RUnknownDocument") << aPath);
break;
case CDF_RS_AlreadyRetrieved:
case PCDM_RS_AlreadyRetrieved:
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrieved") << aPath);
break;
case CDF_RS_AlreadyRetrievedAndModified:
case PCDM_RS_AlreadyRetrievedAndModified:
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrievedAndModified") << aPath);
break;
case CDF_RS_NoDriver:
case PCDM_RS_NoDriver:
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
break;
case CDF_RS_UnknownFileDriver:
case PCDM_RS_UnknownFileDriver:
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
break;
case CDF_RS_OpenError:
case PCDM_RS_OpenError:
ErrorMessage (Message_Msg("TObj_Appl_ROpenError") << aPath);
break;
case CDF_RS_NoVersion:
case PCDM_RS_NoVersion:
ErrorMessage (Message_Msg("TObj_Appl_RNoVersion") << aPath);
break;
case CDF_RS_NoModel:
case PCDM_RS_NoModel:
ErrorMessage (Message_Msg("TObj_Appl_RNoModel") << aPath);
break;
case CDF_RS_NoDocument:
case PCDM_RS_NoDocument:
ErrorMessage (Message_Msg("TObj_Appl_RNoDocument") << aPath);
break;
case CDF_RS_FormatFailure:
case PCDM_RS_FormatFailure:
ErrorMessage (Message_Msg("TObj_Appl_RFormatFailure") << aPath);
break;
case CDF_RS_TypeNotFoundInSchema:
case PCDM_RS_TypeNotFoundInSchema:
ErrorMessage (Message_Msg("TObj_Appl_RTypeNotFound") << aPath);
break;
case CDF_RS_UnrecognizedFileFormat:
case PCDM_RS_UnrecognizedFileFormat:
ErrorMessage (Message_Msg("TObj_Appl_RBadFileFormat") << aPath);
break;
case CDF_RS_MakeFailure:
case PCDM_RS_MakeFailure:
ErrorMessage (Message_Msg("TObj_Appl_RMakeFailure") << aPath);
break;
case CDF_RS_PermissionDenied:
case PCDM_RS_PermissionDenied:
ErrorMessage (Message_Msg("TObj_Appl_RPermissionDenied") << aPath);
break;
case CDF_RS_DriverFailure:
case PCDM_RS_DriverFailure:
ErrorMessage (Message_Msg("TObj_Appl_RDriverFailure") << aPath);
break;
case -1:

View File

@ -45,8 +45,6 @@ is
AddNamespace (me:mutable; thePrefix, theURI: AsciiString)
is protected;
IsError (me) returns Boolean from Standard;
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
returns ADriverTable from XmlMDF
is virtual;
@ -60,6 +58,5 @@ fields
mySeqOfNS : SequenceOfNamespaceDef from XmlLDrivers;
myCopyright : ExtendedString from TCollection;
myRelocTable: SRelocationTable from XmlObjMgt is protected;
myIsError : Boolean from Standard is protected;
end DocumentStorageDriver;

View File

@ -120,7 +120,7 @@ void XmlLDrivers_DocumentStorageDriver::Write
::take_time (0, " +++++ Fin formatting to XML : ", aMessageDriver);
}else{
myIsError = Standard_True;
SetIsError (Standard_True);
TCollection_ExtendedString aMsg =
TCollection_ExtendedString("Error: the file ") + aFileName +
" cannot be opened for writing";
@ -143,7 +143,7 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
XmlObjMgt_Element& theElement,
const TCollection_ExtendedString& theFileName)
{
myIsError = Standard_False;
SetIsError(Standard_False);
Handle(CDM_MessageDriver) aMessageDriver =
theDocument -> Application() -> MessageDriver();
// 1. Write header information
@ -289,13 +289,13 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
}
catch (Standard_Failure)
{
myIsError = Standard_True;
SetIsError (Standard_True);
TCollection_ExtendedString anErrorString (Standard_Failure::Caught()->GetMessageString());
aMessageDriver -> Write (anErrorString.ToExtString());
}
}
if (anObjNb <= 0 && myIsError == Standard_False) {
myIsError = Standard_True;
if (anObjNb <= 0 && IsError() == Standard_False) {
SetIsError (Standard_True);
TCollection_ExtendedString anErrorString ("error occurred");
aMessageDriver -> Write (anErrorString.ToExtString());
}
@ -311,7 +311,7 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
// 4. Write Shapes section
if(WriteShapeSection(theElement))
::take_time (0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
return myIsError;
return IsError();
}
//=======================================================================
@ -353,16 +353,6 @@ Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
return -1; // error
}
//=======================================================================
//function : IsError
//purpose :
//=======================================================================
Standard_Boolean XmlLDrivers_DocumentStorageDriver::IsError () const
{
return myIsError;
}
//=======================================================================
//function : AttributeDrivers
//purpose :