mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0022573: Extend the range of status values returned by the method TDocStd_Application::SaveAs
This commit is contained in:
parent
c345d68b3a
commit
15e8b08292
@ -39,8 +39,6 @@ is
|
|||||||
is redefined virtual;
|
is redefined virtual;
|
||||||
---Purpose: Write <theDocument> to the binary file <theFileName>
|
---Purpose: Write <theDocument> to the binary file <theFileName>
|
||||||
|
|
||||||
IsError (me) returns Boolean from Standard;
|
|
||||||
|
|
||||||
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
|
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
|
||||||
returns ADriverTable from BinMDF
|
returns ADriverTable from BinMDF
|
||||||
is virtual;
|
is virtual;
|
||||||
@ -93,7 +91,6 @@ fields
|
|||||||
myPAtt : Persistent from BinObjMgt;
|
myPAtt : Persistent from BinObjMgt;
|
||||||
myDrivers : ADriverTable from BinMDF is protected;
|
myDrivers : ADriverTable from BinMDF is protected;
|
||||||
myRelocTable: SRelocationTable from BinObjMgt is protected;
|
myRelocTable: SRelocationTable from BinObjMgt is protected;
|
||||||
myIsError : Boolean from Standard is protected;
|
|
||||||
myMsgDriver : MessageDriver from CDM;
|
myMsgDriver : MessageDriver from CDM;
|
||||||
|
|
||||||
-- labels not having writable attributes on it-self and on children
|
-- labels not having writable attributes on it-self and on children
|
||||||
|
@ -55,7 +55,9 @@ void BinLDrivers_DocumentStorageDriver::Write
|
|||||||
(const Handle(CDM_Document)& theDocument,
|
(const Handle(CDM_Document)& theDocument,
|
||||||
const TCollection_ExtendedString& theFileName)
|
const TCollection_ExtendedString& theFileName)
|
||||||
{
|
{
|
||||||
myIsError = Standard_False;
|
SetIsError(Standard_False);
|
||||||
|
SetStoreStatus(PCDM_SS_OK);
|
||||||
|
|
||||||
myMsgDriver = theDocument -> Application() -> MessageDriver();
|
myMsgDriver = theDocument -> Application() -> MessageDriver();
|
||||||
myMapUnsupported.Clear();
|
myMapUnsupported.Clear();
|
||||||
|
|
||||||
@ -69,7 +71,8 @@ void BinLDrivers_DocumentStorageDriver::Write
|
|||||||
Handle(TDocStd_Document) aDoc =
|
Handle(TDocStd_Document) aDoc =
|
||||||
Handle(TDocStd_Document)::DownCast(theDocument);
|
Handle(TDocStd_Document)::DownCast(theDocument);
|
||||||
if (aDoc.IsNull()) {
|
if (aDoc.IsNull()) {
|
||||||
myIsError = Standard_True;
|
SetIsError(Standard_True);
|
||||||
|
SetStoreStatus(PCDM_SS_Doc_IsNull);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Open the file
|
// Open the file
|
||||||
@ -84,8 +87,11 @@ void BinLDrivers_DocumentStorageDriver::Write
|
|||||||
// 1. Write info section (including types table)
|
// 1. Write info section (including types table)
|
||||||
WriteInfoSection(theDocument, aFileName);
|
WriteInfoSection(theDocument, aFileName);
|
||||||
myTypesMap.Clear();
|
myTypesMap.Clear();
|
||||||
if (myIsError)
|
if (IsError())
|
||||||
return;
|
{
|
||||||
|
SetStoreStatus(PCDM_SS_Info_Section_Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(IRIX) // 10.10.2005
|
#if !defined(IRIX) // 10.10.2005
|
||||||
ofstream anOS (aFileName.ToCString(), ios::in | ios::binary | ios::ate);
|
ofstream anOS (aFileName.ToCString(), ios::in | ios::binary | ios::ate);
|
||||||
@ -140,7 +146,9 @@ void BinLDrivers_DocumentStorageDriver::Write
|
|||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
WriteMessage (aMethStr + "no objects written");
|
WriteMessage (aMethStr + "no objects written");
|
||||||
#endif
|
#endif
|
||||||
myIsError = Standard_True;
|
SetIsError(Standard_True);
|
||||||
|
SetStoreStatus(PCDM_SS_No_Obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
myRelocTable.Clear();
|
myRelocTable.Clear();
|
||||||
}
|
}
|
||||||
@ -156,7 +164,8 @@ void BinLDrivers_DocumentStorageDriver::Write
|
|||||||
anErrorStr + aMethStr + "Problem writing the file ";
|
anErrorStr + aMethStr + "Problem writing the file ";
|
||||||
WriteMessage (aStr + theFileName);
|
WriteMessage (aStr + theFileName);
|
||||||
#endif
|
#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
|
//function : AttributeDrivers
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -364,7 +363,7 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
|
|||||||
WriteMessage (TCollection_ExtendedString("Error: Cannot open file ") +
|
WriteMessage (TCollection_ExtendedString("Error: Cannot open file ") +
|
||||||
theFileName);
|
theFileName);
|
||||||
#endif
|
#endif
|
||||||
myIsError = Standard_True;
|
SetIsError(Standard_True);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +423,7 @@ void BinLDrivers_DocumentStorageDriver::WriteInfoSection
|
|||||||
WriteMessage(TCollection_ExtendedString("Error: Problem writing header "
|
WriteMessage(TCollection_ExtendedString("Error: Problem writing header "
|
||||||
"into file ") + theFileName);
|
"into file ") + theFileName);
|
||||||
#endif
|
#endif
|
||||||
myIsError = Standard_True;
|
SetIsError(Standard_True);
|
||||||
}
|
}
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
const Standard_Integer aP = (Standard_Integer) aFileDriver.Tell();
|
const Standard_Integer aP = (Standard_Integer) aFileDriver.Tell();
|
||||||
|
@ -22,22 +22,8 @@ is
|
|||||||
|
|
||||||
deferred class Application;
|
deferred class Application;
|
||||||
|
|
||||||
|
|
||||||
---Category: Store in Database related classes.
|
|
||||||
--
|
|
||||||
private class StoreList;
|
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
|
---Category: API for Store and retrieve
|
||||||
--
|
--
|
||||||
|
|
||||||
@ -46,30 +32,6 @@ is
|
|||||||
|
|
||||||
enumeration TryStoreStatus is TS_OK,TS_NoCurrentDocument,TS_NoDriver,TS_NoSubComponentDriver
|
enumeration TryStoreStatus is TS_OK,TS_NoCurrentDocument,TS_NoDriver,TS_NoSubComponentDriver
|
||||||
end TryStoreStatus;
|
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
|
enumeration SubComponentStatus is SCS_Consistent, SCS_Unconsistent,SCS_Stored,SCS_Modified
|
||||||
end SubComponentStatus;
|
end SubComponentStatus;
|
||||||
@ -105,4 +67,3 @@ is
|
|||||||
returns Boolean from Standard;
|
returns Boolean from Standard;
|
||||||
|
|
||||||
end CDF;
|
end CDF;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ uses
|
|||||||
Document from CDM,
|
Document from CDM,
|
||||||
Manager from Resource,
|
Manager from Resource,
|
||||||
MetaData from CDM,
|
MetaData from CDM,
|
||||||
RetrievableStatus from CDF,
|
ReaderStatus from PCDM,
|
||||||
GUID from Standard,
|
GUID from Standard,
|
||||||
Reader from PCDM,
|
Reader from PCDM,
|
||||||
Writer from PCDM,
|
Writer from PCDM,
|
||||||
@ -101,18 +101,18 @@ is
|
|||||||
|
|
||||||
CanRetrieve(me: mutable; aFolder, aName: ExtendedString from TCollection)
|
CanRetrieve(me: mutable; aFolder, aName: ExtendedString from TCollection)
|
||||||
---Purpose:
|
---Purpose:
|
||||||
returns RetrievableStatus from CDF;
|
returns ReaderStatus from PCDM;
|
||||||
|
|
||||||
CanRetrieve(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
|
CanRetrieve(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
|
||||||
---Purpose:
|
---Purpose:
|
||||||
returns RetrievableStatus from CDF;
|
returns ReaderStatus from PCDM;
|
||||||
|
|
||||||
Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
|
Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
|
||||||
is deferred;
|
is deferred;
|
||||||
---Category: CurrentDocument methods.
|
---Category: CurrentDocument methods.
|
||||||
--
|
--
|
||||||
|
|
||||||
GetRetrieveStatus(me) returns RetrievableStatus from CDF;
|
GetRetrieveStatus(me) returns ReaderStatus from PCDM;
|
||||||
---C++: inline
|
---C++: inline
|
||||||
---Purpose: Checks status after Retrieve
|
---Purpose: Checks status after Retrieve
|
||||||
|
|
||||||
@ -200,12 +200,12 @@ is
|
|||||||
is private;
|
is private;
|
||||||
|
|
||||||
CanRetrieve(me: mutable; aMetaData: MetaData from CDM)
|
CanRetrieve(me: mutable; aMetaData: MetaData from CDM)
|
||||||
returns RetrievableStatus from CDF
|
returns ReaderStatus from PCDM
|
||||||
is private;
|
is private;
|
||||||
fields
|
fields
|
||||||
|
|
||||||
myDefaultFolder: ExtendedString from TCollection;
|
myDefaultFolder: ExtendedString from TCollection;
|
||||||
myRetrievableStatus : RetrievableStatus from CDF is protected;
|
myRetrievableStatus : ReaderStatus from PCDM is protected;
|
||||||
|
|
||||||
friends
|
friends
|
||||||
class Session from CDF--,
|
class Session from CDF--,
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
#include <CDF_Session.hxx>
|
#include <CDF_Session.hxx>
|
||||||
#include <CDF_Directory.hxx>
|
#include <CDF_Directory.hxx>
|
||||||
#include <CDF_MetaDataDriver.hxx>
|
#include <CDF_MetaDataDriver.hxx>
|
||||||
#include <CDF_RetrievableStatus.hxx>
|
#include <PCDM_ReaderStatus.hxx>
|
||||||
#include <PCDM_ReadWriter.hxx>
|
#include <PCDM_ReadWriter.hxx>
|
||||||
#include <PCDM_RetrievalDriver.hxx>
|
#include <PCDM_RetrievalDriver.hxx>
|
||||||
#include <PCDM_StorageDriver.hxx>
|
#include <PCDM_StorageDriver.hxx>
|
||||||
#include <PCDM_ReaderStatus.hxx>
|
|
||||||
|
|
||||||
#include <Plugin.hxx>
|
#include <Plugin.hxx>
|
||||||
#include <UTL.hxx>
|
#include <UTL.hxx>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
//function :
|
//function :
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
CDF_Application::CDF_Application():myRetrievableStatus(CDF_RS_OK) {}
|
CDF_Application::CDF_Application():myRetrievableStatus(PCDM_RS_OK) {}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Load
|
//function : Load
|
||||||
@ -128,7 +128,7 @@ Handle(CDM_Document) CDF_Application::Retrieve(const TCollection_ExtendedString
|
|||||||
//function : CanRetrieve
|
//function : CanRetrieve
|
||||||
//purpose :
|
//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;
|
TCollection_ExtendedString aVersion;
|
||||||
return CanRetrieve(aFolder,aName,aVersion);
|
return CanRetrieve(aFolder,aName,aVersion);
|
||||||
}
|
}
|
||||||
@ -137,16 +137,16 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
|
|||||||
//function : CanRetrieve
|
//function : CanRetrieve
|
||||||
//purpose :
|
//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
|
#ifdef DEB
|
||||||
CDF_Timer theTimer;
|
CDF_Timer theTimer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!theMetaDataDriver->Find(aFolder,aName,aVersion))
|
if (!theMetaDataDriver->Find(aFolder,aName,aVersion))
|
||||||
return CDF_RS_UnknownDocument;
|
return PCDM_RS_UnknownDocument;
|
||||||
else if (!theMetaDataDriver->HasReadPermission(aFolder,aName,aVersion))
|
else if (!theMetaDataDriver->HasReadPermission(aFolder,aName,aVersion))
|
||||||
return CDF_RS_PermissionDenied;
|
return PCDM_RS_PermissionDenied;
|
||||||
else {
|
else {
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
theTimer.ShowAndRestart("theMetaDataDriver->Find: ");
|
theTimer.ShowAndRestart("theMetaDataDriver->Find: ");
|
||||||
@ -160,7 +160,7 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
|
|||||||
|
|
||||||
if(theMetaData->IsRetrieved()) {
|
if(theMetaData->IsRetrieved()) {
|
||||||
return theMetaData->Document()->IsModified()
|
return theMetaData->Document()->IsModified()
|
||||||
? CDF_RS_AlreadyRetrievedAndModified : CDF_RS_AlreadyRetrieved;
|
? PCDM_RS_AlreadyRetrievedAndModified : PCDM_RS_AlreadyRetrieved;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TCollection_ExtendedString theFileName=theMetaData->FileName();
|
TCollection_ExtendedString theFileName=theMetaData->FileName();
|
||||||
@ -172,12 +172,12 @@ CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedStr
|
|||||||
theFormat=UTL::Value(Resources(),ResourceName);
|
theFormat=UTL::Value(Resources(),ResourceName);
|
||||||
}
|
}
|
||||||
else
|
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);
|
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
|
//function : Retrieve
|
||||||
//purpose :
|
//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) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration, const Standard_Boolean IsComponent) {
|
||||||
|
|
||||||
Handle(CDM_Document) theDocumentToReturn;
|
Handle(CDM_Document) theDocumentToReturn;
|
||||||
myRetrievableStatus = CDF_RS_DriverFailure;
|
myRetrievableStatus = PCDM_RS_DriverFailure;
|
||||||
if(IsComponent) {
|
if(IsComponent) {
|
||||||
Standard_SStream aMsg;
|
Standard_SStream aMsg;
|
||||||
switch (CanRetrieve(aMetaData)) {
|
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;
|
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);
|
Standard_Failure::Raise(aMsg);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_PermissionDenied:
|
case PCDM_RS_PermissionDenied:
|
||||||
aMsg << "Could not find the referenced document: " << aMetaData->Path() << "; permission denied. " <<(char)0 << endl;
|
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);
|
Standard_Failure::Raise(aMsg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -326,9 +268,9 @@ Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMeta
|
|||||||
|
|
||||||
}
|
}
|
||||||
Standard_Boolean AlreadyRetrieved=aMetaData->IsRetrieved();
|
Standard_Boolean AlreadyRetrieved=aMetaData->IsRetrieved();
|
||||||
if(AlreadyRetrieved) myRetrievableStatus = CDF_RS_AlreadyRetrieved;
|
if(AlreadyRetrieved) myRetrievableStatus = PCDM_RS_AlreadyRetrieved;
|
||||||
Standard_Boolean Modified=AlreadyRetrieved && aMetaData->Document()->IsModified();
|
Standard_Boolean Modified=AlreadyRetrieved && aMetaData->Document()->IsModified();
|
||||||
if(Modified) myRetrievableStatus = CDF_RS_AlreadyRetrievedAndModified;
|
if(Modified) myRetrievableStatus = PCDM_RS_AlreadyRetrievedAndModified;
|
||||||
if(!AlreadyRetrieved || Modified) {
|
if(!AlreadyRetrieved || Modified) {
|
||||||
|
|
||||||
Handle(PCDM_Reader) theReader=Reader(aMetaData->FileName());
|
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);
|
theReader->Read(aMetaData->FileName(),theDocument,this);
|
||||||
}
|
}
|
||||||
catch (Standard_Failure) {
|
catch (Standard_Failure) {
|
||||||
PCDM_ReaderStatus aStatus = theReader->GetStatus();
|
myRetrievableStatus = theReader->GetStatus();
|
||||||
myRetrievableStatus = ConvertStatus(aStatus);
|
if(myRetrievableStatus > PCDM_RS_AlreadyRetrieved){
|
||||||
if(myRetrievableStatus > CDF_RS_AlreadyRetrieved){
|
|
||||||
Standard_SStream aMsg;
|
Standard_SStream aMsg;
|
||||||
aMsg << Standard_Failure::Caught() << endl;
|
aMsg << Standard_Failure::Caught() << endl;
|
||||||
Standard_Failure::Raise(aMsg);
|
Standard_Failure::Raise(aMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PCDM_ReaderStatus aStatus = theReader->GetStatus();
|
myRetrievableStatus = theReader->GetStatus();
|
||||||
myRetrievableStatus = ConvertStatus(aStatus);
|
|
||||||
|
|
||||||
theDocument->SetMetaData(aMetaData);
|
theDocument->SetMetaData(aMetaData);
|
||||||
|
|
||||||
theDocumentToReturn=theDocument;
|
theDocumentToReturn=theDocument;
|
||||||
@ -451,7 +390,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
|
|||||||
if(!FindReaderFromFormat(aFormat,thePluginId,UnfoundResourceName)) {
|
if(!FindReaderFromFormat(aFormat,thePluginId,UnfoundResourceName)) {
|
||||||
Standard_SStream aMsg;
|
Standard_SStream aMsg;
|
||||||
aMsg << "Could not found the item:" << UnfoundResourceName <<(char)0;
|
aMsg << "Could not found the item:" << UnfoundResourceName <<(char)0;
|
||||||
myRetrievableStatus = CDF_RS_WrongResource;
|
myRetrievableStatus = PCDM_RS_WrongResource;
|
||||||
Standard_NoSuchObject::Raise(aMsg);
|
Standard_NoSuchObject::Raise(aMsg);
|
||||||
}
|
}
|
||||||
Handle(PCDM_Reader) R;
|
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));
|
R = Handle(PCDM_Reader)::DownCast(Plugin::Load(thePluginId));
|
||||||
}
|
}
|
||||||
catch (Standard_Failure) {
|
catch (Standard_Failure) {
|
||||||
myRetrievableStatus = CDF_RS_WrongResource;
|
myRetrievableStatus = PCDM_RS_WrongResource;
|
||||||
Standard_SStream aMsg;
|
Standard_SStream aMsg;
|
||||||
aMsg << Standard_Failure::Caught() << endl;
|
aMsg << Standard_Failure::Caught() << endl;
|
||||||
Standard_Failure::Raise(aMsg);
|
Standard_Failure::Raise(aMsg);
|
||||||
@ -470,7 +409,7 @@ Handle(PCDM_Reader) CDF_Application::ReaderFromFormat(const TCollection_Extended
|
|||||||
RD->SetFormat(aFormat);
|
RD->SetFormat(aFormat);
|
||||||
return RD;
|
return RD;
|
||||||
} else
|
} else
|
||||||
myRetrievableStatus = CDF_RS_WrongResource;
|
myRetrievableStatus = PCDM_RS_WrongResource;
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +479,7 @@ Standard_Boolean CDF_Application::FindReaderFromFormat(const TCollection_Extende
|
|||||||
//function : CanRetrieve
|
//function : CanRetrieve
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
CDF_RetrievableStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
|
PCDM_ReaderStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
|
||||||
if(aMetaData->HasVersion())
|
if(aMetaData->HasVersion())
|
||||||
return CanRetrieve(aMetaData->Folder(),aMetaData->Name(),aMetaData->Version());
|
return CanRetrieve(aMetaData->Folder(),aMetaData->Name(),aMetaData->Version());
|
||||||
else
|
else
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// ! szy ! Creation !26-06-2003! 5.0-20-%L%!
|
// ! 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;
|
return myRetrievableStatus;
|
||||||
}
|
}
|
||||||
// @@SDM: begin
|
// @@SDM: begin
|
||||||
|
@ -12,7 +12,7 @@ uses Document from CDM,
|
|||||||
SubComponentStatus from CDF,
|
SubComponentStatus from CDF,
|
||||||
ExtendedString from TCollection,
|
ExtendedString from TCollection,
|
||||||
StoreList from CDF,
|
StoreList from CDF,
|
||||||
StoreStatus from CDF,
|
StoreStatus from PCDM,
|
||||||
ExtendedString from TCollection
|
ExtendedString from TCollection
|
||||||
|
|
||||||
is
|
is
|
||||||
@ -148,7 +148,7 @@ is
|
|||||||
-- be used just after Realize or Import -- method to know if
|
-- be used just after Realize or Import -- method to know if
|
||||||
-- thes methods worked correctly, and if not why.
|
-- 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;
|
AssociatedStatusText(me) returns ExtString from Standard;
|
||||||
|
|
||||||
---Category: Private methods
|
---Category: Private methods
|
||||||
@ -181,7 +181,7 @@ fields
|
|||||||
|
|
||||||
myPath: ExtendedString from TCollection;
|
myPath: ExtendedString from TCollection;
|
||||||
myText: ExtendedString from TCollection;
|
myText: ExtendedString from TCollection;
|
||||||
myStatus: StoreStatus from CDF;
|
myStatus: StoreStatus from PCDM;
|
||||||
|
|
||||||
|
|
||||||
end Store from CDF;
|
end Store from CDF;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <CDF_Store.ixx>
|
#include <CDF_Store.ixx>
|
||||||
#include <CDF_Session.hxx>
|
#include <CDF_Session.hxx>
|
||||||
#include <CDF_Application.hxx>
|
#include <CDF_Application.hxx>
|
||||||
#include <CDF_StoreStatus.hxx>
|
#include <PCDM_StoreStatus.hxx>
|
||||||
#include <CDF_StoreSetNameStatus.hxx>
|
#include <CDF_StoreSetNameStatus.hxx>
|
||||||
#include <Standard_ProgramError.hxx>
|
#include <Standard_ProgramError.hxx>
|
||||||
#include <CDF_MetaDataDriver.hxx>
|
#include <CDF_MetaDataDriver.hxx>
|
||||||
@ -160,7 +160,7 @@ void CDF_Store::Realize() {
|
|||||||
Handle(CDM_MetaData) m;
|
Handle(CDM_MetaData) m;
|
||||||
myText = "";
|
myText = "";
|
||||||
myStatus = myList->Store(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 {
|
Standard_ExtString CDF_Store::Path() const {
|
||||||
return myPath.ToExtString();
|
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;
|
return myStatus;
|
||||||
}
|
}
|
||||||
Standard_ExtString CDF_Store::AssociatedStatusText() const {
|
Standard_ExtString CDF_Store::AssociatedStatusText() const {
|
||||||
|
@ -6,7 +6,15 @@
|
|||||||
|
|
||||||
private class StoreList from CDF inherits Transient from Standard
|
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
|
raises NoSuchObject from Standard
|
||||||
is
|
is
|
||||||
@ -19,7 +27,7 @@ is
|
|||||||
|
|
||||||
Store(me: mutable; aMetaData: out MetaData from CDM;
|
Store(me: mutable; aMetaData: out MetaData from CDM;
|
||||||
aStatusAssociatedText: out ExtendedString from TCollection)
|
aStatusAssociatedText: out ExtendedString from TCollection)
|
||||||
returns StoreStatus from CDF
|
returns StoreStatus from PCDM
|
||||||
---Purpose: stores each object of the storelist in the reverse
|
---Purpose: stores each object of the storelist in the reverse
|
||||||
-- order of which they had been added.
|
-- order of which they had been added.
|
||||||
raises NoSuchObject from Standard;
|
raises NoSuchObject from Standard;
|
||||||
|
@ -65,61 +65,60 @@ void CDF_StoreList::Next() {
|
|||||||
Handle(CDM_Document) CDF_StoreList::Value() const {
|
Handle(CDM_Document) CDF_StoreList::Value() const {
|
||||||
return myIterator.Key();
|
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();
|
Handle(CDF_MetaDataDriver) theMetaDataDriver = CDF_Session::CurrentSession()->MetaDataDriver();
|
||||||
|
|
||||||
static CDF_StoreStatus status ;
|
PCDM_StoreStatus status = PCDM_SS_OK;
|
||||||
status = CDF_SS_OK;
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
for (; !myStack.IsEmpty(); myStack.Pop()) {
|
for (; !myStack.IsEmpty(); myStack.Pop()) {
|
||||||
|
|
||||||
Handle(CDM_Document) theDocument = myStack.Top();
|
|
||||||
if( theDocument == myMainDocument || theDocument->IsModified()) {
|
|
||||||
|
|
||||||
if(!PCDM::FindStorageDriver(theDocument)){
|
Handle(CDM_Document) theDocument = myStack.Top();
|
||||||
Standard_SStream aMsg;
|
if( theDocument == myMainDocument || theDocument->IsModified()) {
|
||||||
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);
|
|
||||||
|
|
||||||
CDF_Timer theTimer;
|
if(!PCDM::FindStorageDriver(theDocument)){
|
||||||
|
Standard_SStream aMsg;
|
||||||
PCDM::StorageDriver(theDocument)->Write(theDocument,theName);
|
aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
|
||||||
theTimer.ShowAndRestart("Driver->Write: ");
|
Standard_Failure::Raise(aMsg);
|
||||||
|
}
|
||||||
|
|
||||||
aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
|
if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
|
||||||
theTimer.ShowAndStop("metadata creating: ");
|
Standard_SStream aMsg; aMsg << "could not find the active dbunit";
|
||||||
|
aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
|
||||||
theDocument->SetMetaData(aMetaData);
|
Standard_NoSuchObject::Raise(aMsg);
|
||||||
|
}
|
||||||
|
TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
|
||||||
|
|
||||||
CDM_ReferenceIterator it(theDocument);
|
CDF_Timer theTimer;
|
||||||
for(; it.More();it.Next()) {
|
Handle(PCDM_StorageDriver) aDocumentStorageDriver = PCDM::StorageDriver(theDocument);
|
||||||
theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
|
|
||||||
}
|
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) {
|
catch (CDF_MetaDataDriverError) {
|
||||||
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("metadatadriver failed; reason:"));
|
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("metadatadriver failed; reason:"));
|
||||||
status = CDF_SS_DriverFailure;
|
status = PCDM_SS_DriverFailure;
|
||||||
}
|
}
|
||||||
catch (Standard_Failure) {
|
catch (Standard_Failure) {
|
||||||
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("driver failed; reason:"));
|
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("driver failed; reason:"));
|
||||||
status = CDF_SS_Failure;
|
status = PCDM_SS_Failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,38 +162,40 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
|
|||||||
di <<"document " << insession << " is already in session" << "\n";
|
di <<"document " << insession << " is already in session" << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CDF_RetrievableStatus theStatus = A->Open(path,D);
|
PCDM_ReaderStatus theStatus = A->Open(path,D);
|
||||||
if (theStatus == CDF_RS_OK && !D.IsNull()) {
|
if (theStatus == PCDM_RS_OK && !D.IsNull()) {
|
||||||
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(D);
|
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(D);
|
||||||
TDataStd_Name::Set(D->GetData()->Root(),a[2]);
|
TDataStd_Name::Set(D->GetData()->Root(),a[2]);
|
||||||
Draw::Set(a[2],DD);
|
Draw::Set(a[2],DD);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
switch ( theStatus ) {
|
switch ( theStatus ) {
|
||||||
case CDF_RS_AlreadyRetrieved:
|
case PCDM_RS_AlreadyRetrieved:
|
||||||
case CDF_RS_AlreadyRetrievedAndModified: {
|
case PCDM_RS_AlreadyRetrievedAndModified: {
|
||||||
di << " already retrieved " << "\n" ;
|
di << " already retrieved " << "\n" ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CDF_RS_NoDriver: {
|
case PCDM_RS_NoDriver: {
|
||||||
di << " could not retrieve , no Driver to make it " <<"\n" ;
|
di << " could not retrieve , no Driver to make it " <<"\n" ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case CDF_RS_UnknownDocument:
|
case PCDM_RS_UnknownDocument:
|
||||||
case CDF_RS_NoModel: {
|
case PCDM_RS_NoModel: {
|
||||||
di << " could not retrieve , Unknown Document or No Model " <<"\n";
|
di << " could not retrieve , Unknown Document or No Model " <<"\n";
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case CDF_RS_TypeNotFoundInSchema:
|
case PCDM_RS_TypeNotFoundInSchema:
|
||||||
case CDF_RS_UnrecognizedFileFormat: {
|
case PCDM_RS_UnrecognizedFileFormat: {
|
||||||
di << " could not retrieve , Type not found or Unrecognized File Format" <<"\n";
|
di << " could not retrieve , Type not found or Unrecognized File Format" <<"\n";
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case CDF_RS_PermissionDenied: {
|
case PCDM_RS_PermissionDenied: {
|
||||||
di << " could not retrieve , permission denied " << "\n" ;
|
di << " could not retrieve , permission denied " << "\n" ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
di << " could not retrieve " << "\n" ;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
di << "DDocStd_Open : Error" << "\n";
|
di << "DDocStd_Open : Error" << "\n";
|
||||||
}
|
}
|
||||||
@ -241,18 +243,18 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
|
|||||||
TCollection_ExtendedString path (a[2]);
|
TCollection_ExtendedString path (a[2]);
|
||||||
Handle(TDocStd_Application) A;
|
Handle(TDocStd_Application) A;
|
||||||
if (!DDocStd::Find(A)) return 1;
|
if (!DDocStd::Find(A)) return 1;
|
||||||
CDF_StoreStatus theStatus = A->SaveAs(D,path);
|
PCDM_StoreStatus theStatus = A->SaveAs(D,path);
|
||||||
if (theStatus != CDF_SS_OK ) {
|
if (theStatus != PCDM_SS_OK ) {
|
||||||
switch ( theStatus ) {
|
switch ( theStatus ) {
|
||||||
case CDF_SS_DriverFailure: {
|
case PCDM_SS_DriverFailure: {
|
||||||
di << " could not store , no driver found to make it " <<"\n" ;
|
di << " could not store , no driver found to make it " <<"\n" ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case CDF_SS_WriteFailure: {
|
case PCDM_SS_WriteFailure: {
|
||||||
di << " Write access failure " << "\n" ;
|
di << " Write access failure " << "\n" ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CDF_SS_Failure: {
|
case PCDM_SS_Failure: {
|
||||||
di << " Write failure " << "\n" ;
|
di << " Write failure " << "\n" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,25 @@ is
|
|||||||
RS_UnrecognizedFileFormat,
|
RS_UnrecognizedFileFormat,
|
||||||
RS_MakeFailure,
|
RS_MakeFailure,
|
||||||
RS_PermissionDenied,
|
RS_PermissionDenied,
|
||||||
RS_DriverFailure
|
RS_DriverFailure,
|
||||||
|
RS_AlreadyRetrievedAndModified,
|
||||||
|
RS_AlreadyRetrieved,
|
||||||
|
RS_UnknownDocument,
|
||||||
|
RS_WrongResource,
|
||||||
|
RS_NoModel
|
||||||
end ReaderStatus;
|
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;
|
deferred class Document;
|
||||||
class SequenceOfDocument instantiates Sequence from TCollection(Document from PCDM);
|
class SequenceOfDocument instantiates Sequence from TCollection(Document from PCDM);
|
||||||
@ -84,4 +100,3 @@ is
|
|||||||
returns TypeOfFileDriver from PCDM
|
returns TypeOfFileDriver from PCDM
|
||||||
is private;
|
is private;
|
||||||
end PCDM;
|
end PCDM;
|
||||||
|
|
||||||
|
@ -23,7 +23,15 @@ deferred class StorageDriver from PCDM inherits Writer from PCDM
|
|||||||
--
|
--
|
||||||
---Category: persistent implemention of storage.
|
---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
|
raises NoSuchObject from Standard,DriverError from PCDM
|
||||||
is
|
is
|
||||||
@ -62,9 +70,17 @@ is
|
|||||||
|
|
||||||
GetFormat (me)
|
GetFormat (me)
|
||||||
returns ExtendedString from TCollection;
|
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
|
fields
|
||||||
|
|
||||||
myFormat : ExtendedString from TCollection;
|
myFormat : ExtendedString from TCollection;
|
||||||
|
myIsError: Boolean from Standard;
|
||||||
|
myStoreStatus: StoreStatus from PCDM;
|
||||||
|
|
||||||
end StorageDriver from PCDM;
|
end StorageDriver from PCDM;
|
||||||
|
@ -133,3 +133,40 @@ TCollection_ExtendedString PCDM_StorageDriver::GetFormat () const
|
|||||||
{
|
{
|
||||||
return myFormat;
|
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;
|
||||||
|
}
|
||||||
|
@ -2003,8 +2003,8 @@ static int BUC60867(Draw_Interpretor& di, Standard_Integer argc, const char ** a
|
|||||||
di<<2;
|
di<<2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CDF_RetrievableStatus Result = A->Open(path,D);
|
PCDM_ReaderStatus Result = A->Open(path,D);
|
||||||
if(Result==CDF_RS_OK){
|
if(Result==PCDM_RS_OK){
|
||||||
di<<0;
|
di<<0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -788,7 +788,7 @@ static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/,
|
|||||||
|
|
||||||
#include <TDocStd_Document.hxx>
|
#include <TDocStd_Document.hxx>
|
||||||
#include <DDocStd.hxx>
|
#include <DDocStd.hxx>
|
||||||
#include <CDF_StoreStatus.hxx>
|
#include <PCDM_StoreStatus.hxx>
|
||||||
#include <TDocStd_Application.hxx>
|
#include <TDocStd_Application.hxx>
|
||||||
|
|
||||||
static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
|
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";
|
di << "this document has never been saved" << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CDF_StoreStatus theStatus = A->Save(D, theStatusMessage);
|
PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
|
||||||
if (theStatus != CDF_SS_OK ) {
|
if (theStatus != PCDM_SS_OK ) {
|
||||||
switch ( theStatus ) {
|
switch ( theStatus ) {
|
||||||
case CDF_SS_DriverFailure: {
|
case PCDM_SS_DriverFailure: {
|
||||||
di << " Could not store , no driver found to make it " <<"\n" ;
|
di << " Could not store , no driver found to make it " <<"\n" ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case CDF_SS_WriteFailure: {
|
case PCDM_SS_WriteFailure: {
|
||||||
di << " Write access failure " << "\n" ;
|
di << " Write access failure " << "\n" ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CDF_SS_Failure: {
|
case PCDM_SS_Failure: {
|
||||||
di << " Write failure " << "\n" ;
|
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;
|
if (!DDocStd::Find(A)) return 1;
|
||||||
|
|
||||||
TCollection_ExtendedString theStatusMessage;
|
TCollection_ExtendedString theStatusMessage;
|
||||||
CDF_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
|
PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
|
||||||
if (theStatus != CDF_SS_OK ) {
|
if (theStatus != PCDM_SS_OK ) {
|
||||||
switch ( theStatus ) {
|
switch ( theStatus ) {
|
||||||
case CDF_SS_DriverFailure: {
|
case PCDM_SS_DriverFailure: {
|
||||||
di << " Could not store , no driver found to make it " <<"\n" ;
|
di << " Could not store , no driver found to make it " <<"\n" ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case CDF_SS_WriteFailure: {
|
case PCDM_SS_WriteFailure: {
|
||||||
di << " Write access failure " << "\n" ;
|
di << " Write access failure " << "\n" ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CDF_SS_Failure: {
|
case PCDM_SS_Failure: {
|
||||||
di << " Write failure " << "\n" ;
|
di << " Write failure " << "\n" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1104,7 +1104,7 @@ static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, con
|
|||||||
// 3. Open document
|
// 3. Open document
|
||||||
TCollection_ExtendedString name(argv[2]);
|
TCollection_ExtendedString name(argv[2]);
|
||||||
Handle(TDocStd_Document) Doc;
|
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);
|
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
|
||||||
TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
|
TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
|
||||||
Draw::Set(argv[1],DD);
|
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);
|
Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
|
||||||
//
|
//
|
||||||
// Save
|
// Save
|
||||||
//if (app->SaveAs(doc_std, "W:\\doc.std") != CDF_SS_OK)
|
//if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
|
||||||
if (app->SaveAs(doc_std, aFile1) != CDF_SS_OK)
|
if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
|
||||||
return 1;
|
return 1;
|
||||||
intlist.Nullify();
|
intlist.Nullify();
|
||||||
dbllist.Nullify();
|
dbllist.Nullify();
|
||||||
@ -4230,8 +4230,8 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
|
|||||||
ref.Nullify();
|
ref.Nullify();
|
||||||
app->Close(doc_std);
|
app->Close(doc_std);
|
||||||
doc_std.Nullify();
|
doc_std.Nullify();
|
||||||
//if (app->Open("W:\\doc.std", 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) != CDF_RS_OK)
|
if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
|
||||||
return 2;
|
return 2;
|
||||||
if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
|
if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
|
||||||
return 3;
|
return 3;
|
||||||
@ -4364,15 +4364,15 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
|
|||||||
ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
|
ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
|
||||||
//
|
//
|
||||||
// Save
|
// Save
|
||||||
//if (app->SaveAs(doc_xml, "W:\\doc.xml") != CDF_SS_OK)
|
//if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
|
||||||
if (app->SaveAs(doc_xml, aFile2) != CDF_SS_OK)
|
if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
|
||||||
return 1;
|
return 1;
|
||||||
intlist.Nullify();
|
intlist.Nullify();
|
||||||
ref.Nullify();
|
ref.Nullify();
|
||||||
app->Close(doc_xml);
|
app->Close(doc_xml);
|
||||||
doc_xml.Nullify();
|
doc_xml.Nullify();
|
||||||
//if (app->Open("W:\\doc.xml", 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) != CDF_RS_OK)
|
if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
|
||||||
return 2;
|
return 2;
|
||||||
if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
|
if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
|
||||||
return 3;
|
return 3;
|
||||||
@ -4525,15 +4525,15 @@ int TestOpenSave(TCollection_ExtendedString aFile1,
|
|||||||
ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
|
ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
|
||||||
//
|
//
|
||||||
// Save
|
// Save
|
||||||
//if (app->SaveAs(doc_bin, "W:\\doc.cbf") != CDF_SS_OK)
|
//if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
|
||||||
if (app->SaveAs(doc_bin, aFile3) != CDF_SS_OK)
|
if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
|
||||||
return 1;
|
return 1;
|
||||||
intlist.Nullify();
|
intlist.Nullify();
|
||||||
ref.Nullify();
|
ref.Nullify();
|
||||||
app->Close(doc_bin);
|
app->Close(doc_bin);
|
||||||
doc_bin.Nullify();
|
doc_bin.Nullify();
|
||||||
//if (app->Open("W:\\doc.cbf", 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) != CDF_RS_OK)
|
if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
|
||||||
return 2;
|
return 2;
|
||||||
if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
|
if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
|
||||||
return 3;
|
return 3;
|
||||||
|
@ -117,11 +117,11 @@ static Standard_Integer OCC267 (Draw_Interpretor& di, Standard_Integer argc, con
|
|||||||
Handle(TDocStd_Application) A;
|
Handle(TDocStd_Application) A;
|
||||||
if (!DDocStd::Find(A)) return 1;
|
if (!DDocStd::Find(A)) return 1;
|
||||||
|
|
||||||
CDF_StoreStatus theStatus = A->SaveAs(D,path);
|
PCDM_StoreStatus theStatus = A->SaveAs(D,path);
|
||||||
if (theStatus == CDF_SS_OK ) {
|
if (theStatus == PCDM_SS_OK ) {
|
||||||
di << "OCC267 : CDF_StoreStatus = CDF_SS_OK" << "\n";
|
di << "OCC267 : PCDM_StoreStatus = PCDM_SS_OK" << "\n";
|
||||||
} else {
|
} else {
|
||||||
di << "OCC267 : CDF_StoreStatus = Bad_Store_Status" << "\n";
|
di << "OCC267 : PCDM_StoreStatus = Bad_Store_Status" << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -43,6 +43,7 @@ uses
|
|||||||
Standard,
|
Standard,
|
||||||
CDF,
|
CDF,
|
||||||
CDM,
|
CDM,
|
||||||
|
PCDM,
|
||||||
MDF,
|
MDF,
|
||||||
TDF,
|
TDF,
|
||||||
TColStd,
|
TColStd,
|
||||||
|
@ -43,8 +43,8 @@ uses Manager from Resource,
|
|||||||
CString from Standard,
|
CString from Standard,
|
||||||
ExtendedString from TCollection,
|
ExtendedString from TCollection,
|
||||||
SequenceOfExtendedString from TColStd,
|
SequenceOfExtendedString from TColStd,
|
||||||
RetrievableStatus from CDF,
|
ReaderStatus from PCDM,
|
||||||
StoreStatus from CDF
|
StoreStatus from PCDM
|
||||||
|
|
||||||
raises NoSuchObject from Standard
|
raises NoSuchObject from Standard
|
||||||
|
|
||||||
@ -182,13 +182,13 @@ is
|
|||||||
-- In order not to override a version of aDoc which
|
-- In order not to override a version of aDoc which
|
||||||
-- is already in memory, this method can be made
|
-- is already in memory, this method can be made
|
||||||
-- to depend on the value returned by IsInSession.
|
-- to depend on the value returned by IsInSession.
|
||||||
returns RetrievableStatus from CDF;
|
returns ReaderStatus from PCDM;
|
||||||
|
|
||||||
SaveAs (me : mutable; aDoc : Document from TDocStd;
|
SaveAs (me : mutable; aDoc : Document from TDocStd;
|
||||||
path : ExtendedString from TCollection)
|
path : ExtendedString from TCollection)
|
||||||
---Purpose: Save the active document in the file <name> in the
|
---Purpose: Save the active document in the file <name> in the
|
||||||
-- path <path> ; o verwrites the file if it already exists.
|
-- 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)
|
Save (me : mutable; aDoc : Document from TDocStd)
|
||||||
@ -196,7 +196,7 @@ is
|
|||||||
-- Exceptions:
|
-- Exceptions:
|
||||||
-- Standard_NotImplemented if the document
|
-- Standard_NotImplemented if the document
|
||||||
-- was not retrieved in the applicative session by using Open.
|
-- 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;
|
SaveAs (me : mutable; aDoc : Document from TDocStd;
|
||||||
path : ExtendedString from TCollection;
|
path : ExtendedString from TCollection;
|
||||||
@ -204,12 +204,12 @@ is
|
|||||||
---Purpose: Save the active document in the file <name> in the
|
---Purpose: Save the active document in the file <name> in the
|
||||||
-- path <path> . overwrite the file if it
|
-- path <path> . overwrite the file if it
|
||||||
-- already exist.
|
-- already exist.
|
||||||
returns StoreStatus from CDF;
|
returns StoreStatus from PCDM;
|
||||||
|
|
||||||
Save (me : mutable; aDoc : Document from TDocStd;
|
Save (me : mutable; aDoc : Document from TDocStd;
|
||||||
theStatusMessage: out ExtendedString from TCollection)
|
theStatusMessage: out ExtendedString from TCollection)
|
||||||
---Purpose: Save the document overwriting the previous file
|
---Purpose: Save the document overwriting the previous file
|
||||||
returns StoreStatus from CDF;
|
returns StoreStatus from PCDM;
|
||||||
|
|
||||||
--Exit (me)
|
--Exit (me)
|
||||||
-- to quit the application. the applicative documents must be closed before.
|
-- to quit the application. the applicative documents must be closed before.
|
||||||
@ -235,4 +235,3 @@ friends
|
|||||||
class Document from TDocStd
|
class Document from TDocStd
|
||||||
|
|
||||||
end Application;
|
end Application;
|
||||||
|
|
||||||
|
@ -174,8 +174,8 @@ Standard_Integer TDocStd_Application::IsInSession (const TCollection_ExtendedStr
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
|
PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
|
||||||
CDF_RetrievableStatus status = CDF_RS_DriverFailure;
|
PCDM_ReaderStatus status = PCDM_RS_DriverFailure;
|
||||||
TDocStd_PathParser tool (path);
|
TDocStd_PathParser tool (path);
|
||||||
TCollection_ExtendedString directory = tool.Trek();
|
TCollection_ExtendedString directory = tool.Trek();
|
||||||
TCollection_ExtendedString file = tool.Name();
|
TCollection_ExtendedString file = tool.Name();
|
||||||
@ -183,7 +183,7 @@ CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString
|
|||||||
file+=tool.Extension();
|
file+=tool.Extension();
|
||||||
#ifdef BUC60867
|
#ifdef BUC60867
|
||||||
status = CanRetrieve(directory,file);
|
status = CanRetrieve(directory,file);
|
||||||
if (status != CDF_RS_OK) return status;
|
if (status != PCDM_RS_OK) return status;
|
||||||
#endif
|
#endif
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
@ -215,7 +215,7 @@ CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString
|
|||||||
//purpose :
|
//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);
|
TDocStd_PathParser tool (path);
|
||||||
TCollection_ExtendedString directory = tool.Trek();
|
TCollection_ExtendedString directory = tool.Trek();
|
||||||
TCollection_ExtendedString file = tool.Name();
|
TCollection_ExtendedString file = tool.Name();
|
||||||
@ -246,7 +246,7 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,co
|
|||||||
MessageDriver()->Write(aString.ToExtString());
|
MessageDriver()->Write(aString.ToExtString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(storer.StoreStatus() == CDF_SS_OK)
|
if(storer.StoreStatus() == PCDM_SS_OK)
|
||||||
D->SetSaved();
|
D->SetSaved();
|
||||||
#ifdef BUC60867
|
#ifdef BUC60867
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
@ -261,9 +261,9 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,co
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
|
PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
|
||||||
#ifdef BUC60867
|
#ifdef BUC60867
|
||||||
CDF_StoreStatus status = CDF_SS_OK;
|
PCDM_StoreStatus status = PCDM_SS_OK;
|
||||||
#endif
|
#endif
|
||||||
if (D->IsSaved()) {
|
if (D->IsSaved()) {
|
||||||
CDF_Store storer (D);
|
CDF_Store storer (D);
|
||||||
@ -278,18 +278,17 @@ CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
|
|||||||
MessageDriver()->Write(aString.ToExtString());
|
MessageDriver()->Write(aString.ToExtString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(storer.StoreStatus() == CDF_SS_OK)
|
if(storer.StoreStatus() == PCDM_SS_OK)
|
||||||
D->SetSaved();
|
D->SetSaved();
|
||||||
#ifdef BUC60867
|
#ifdef BUC60867
|
||||||
status = storer.StoreStatus();
|
status = storer.StoreStatus();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Standard_DomainError::Raise ("TDocStd_Application::Save document is not already saved");
|
|
||||||
if(!MessageDriver().IsNull()) {
|
if(!MessageDriver().IsNull()) {
|
||||||
TCollection_ExtendedString aMsg("Document is already saved");
|
TCollection_ExtendedString aMsg("Document has not been saved yet");
|
||||||
MessageDriver()->Write(aMsg.ToExtString());
|
MessageDriver()->Write(aMsg.ToExtString());
|
||||||
}
|
}
|
||||||
status = CDF_SS_Failure;
|
status = PCDM_SS_Failure;
|
||||||
}
|
}
|
||||||
#ifdef BUC60867
|
#ifdef BUC60867
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
@ -330,12 +329,12 @@ CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
|
|||||||
//purpose :
|
//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,
|
const TCollection_ExtendedString& path,
|
||||||
TCollection_ExtendedString& theStatusMessage)
|
TCollection_ExtendedString& theStatusMessage)
|
||||||
{
|
{
|
||||||
TDocStd_PathParser tool (path);
|
TDocStd_PathParser tool (path);
|
||||||
CDF_StoreStatus aStatus = CDF_SS_Failure;
|
PCDM_StoreStatus aStatus = PCDM_SS_Failure;
|
||||||
TCollection_ExtendedString directory = tool.Trek();
|
TCollection_ExtendedString directory = tool.Trek();
|
||||||
TCollection_ExtendedString file = tool.Name();
|
TCollection_ExtendedString file = tool.Name();
|
||||||
file+=".";
|
file+=".";
|
||||||
@ -355,7 +354,7 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
|
|||||||
MessageDriver()->Write(aString.ToExtString());
|
MessageDriver()->Write(aString.ToExtString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(storer.StoreStatus() == CDF_SS_OK)
|
if(storer.StoreStatus() == PCDM_SS_OK)
|
||||||
D->SetSaved();
|
D->SetSaved();
|
||||||
theStatusMessage = storer.AssociatedStatusText();
|
theStatusMessage = storer.AssociatedStatusText();
|
||||||
aStatus = storer.StoreStatus();
|
aStatus = storer.StoreStatus();
|
||||||
@ -363,7 +362,7 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
|
|||||||
theStatusMessage =
|
theStatusMessage =
|
||||||
TCollection_ExtendedString("TDocStd_Application::SaveAs"
|
TCollection_ExtendedString("TDocStd_Application::SaveAs"
|
||||||
": No such directory ") + directory;
|
": No such directory ") + directory;
|
||||||
aStatus = CDF_SS_Failure;
|
aStatus = PCDM_SS_Failure;
|
||||||
}
|
}
|
||||||
return aStatus;
|
return aStatus;
|
||||||
}
|
}
|
||||||
@ -373,10 +372,10 @@ CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
|
PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
|
||||||
TCollection_ExtendedString& theStatusMessage)
|
TCollection_ExtendedString& theStatusMessage)
|
||||||
{
|
{
|
||||||
CDF_StoreStatus status = CDF_SS_OK;
|
PCDM_StoreStatus status = PCDM_SS_OK;
|
||||||
if (D->IsSaved()) {
|
if (D->IsSaved()) {
|
||||||
CDF_Store storer (D);
|
CDF_Store storer (D);
|
||||||
try {
|
try {
|
||||||
@ -390,14 +389,13 @@ CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
|
|||||||
MessageDriver()->Write(aString.ToExtString());
|
MessageDriver()->Write(aString.ToExtString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(storer.StoreStatus() == CDF_SS_OK)
|
if(storer.StoreStatus() == PCDM_SS_OK)
|
||||||
D->SetSaved();
|
D->SetSaved();
|
||||||
status = storer.StoreStatus();
|
status = storer.StoreStatus();
|
||||||
theStatusMessage = storer.AssociatedStatusText();
|
theStatusMessage = storer.AssociatedStatusText();
|
||||||
} else {
|
} else {
|
||||||
Standard_DomainError::Raise ("TDocStd_Application::Save"
|
theStatusMessage = "TDocStd_Application::the document has not been saved yet";
|
||||||
" document is not already saved");
|
status = PCDM_SS_Failure;
|
||||||
theStatusMessage = "TDocStd_Application::the document is not already saved";
|
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,21 @@
|
|||||||
|
|
||||||
.TObj_Appl_SWriteFailure
|
.TObj_Appl_SWriteFailure
|
||||||
Error saving document %s : write failure
|
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
|
.TObj_Appl_SUnknownFailure
|
||||||
Error saving document %s : unknown failure
|
Error saving document %s : unknown failure
|
||||||
|
@ -73,19 +73,33 @@ Standard_Boolean TObj_Application::SaveDocument
|
|||||||
myIsError = Standard_False;
|
myIsError = Standard_False;
|
||||||
TCollection_ExtendedString aPath ((const Standard_CString)theTargetFile);
|
TCollection_ExtendedString aPath ((const Standard_CString)theTargetFile);
|
||||||
|
|
||||||
CDF_StoreStatus aStatus = SaveAs (theSourceDoc, aPath);
|
PCDM_StoreStatus aStatus = SaveAs (theSourceDoc, aPath);
|
||||||
myIsError = aStatus != CDF_SS_OK;
|
myIsError = aStatus != PCDM_SS_OK;
|
||||||
if (myIsError)
|
if (myIsError)
|
||||||
{
|
{
|
||||||
switch (aStatus)
|
switch (aStatus)
|
||||||
{
|
{
|
||||||
case CDF_SS_DriverFailure:
|
case PCDM_SS_DriverFailure:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_SDriverFailure") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_SDriverFailure") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_SS_WriteFailure:
|
case PCDM_SS_WriteFailure:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_SWriteFailure") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_SWriteFailure") << aPath);
|
||||||
break;
|
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:
|
default:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_SUnknownFailure") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_SUnknownFailure") << aPath);
|
||||||
break;
|
break;
|
||||||
@ -109,7 +123,7 @@ Standard_Boolean TObj_Application::LoadDocument
|
|||||||
myIsError = Standard_False;
|
myIsError = Standard_False;
|
||||||
TCollection_ExtendedString aPath ((const Standard_CString)theSourceFile);
|
TCollection_ExtendedString aPath ((const Standard_CString)theSourceFile);
|
||||||
|
|
||||||
CDF_RetrievableStatus aStatus = (CDF_RetrievableStatus) -1;
|
PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -123,54 +137,54 @@ Standard_Boolean TObj_Application::LoadDocument
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myIsError = aStatus != CDF_RS_OK;
|
myIsError = aStatus != PCDM_RS_OK;
|
||||||
if (myIsError)
|
if (myIsError)
|
||||||
{
|
{
|
||||||
switch (aStatus)
|
switch (aStatus)
|
||||||
{
|
{
|
||||||
case CDF_RS_UnknownDocument:
|
case PCDM_RS_UnknownDocument:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RUnknownDocument") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RUnknownDocument") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_AlreadyRetrieved:
|
case PCDM_RS_AlreadyRetrieved:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrieved") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrieved") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_AlreadyRetrievedAndModified:
|
case PCDM_RS_AlreadyRetrievedAndModified:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrievedAndModified") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrievedAndModified") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_NoDriver:
|
case PCDM_RS_NoDriver:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_UnknownFileDriver:
|
case PCDM_RS_UnknownFileDriver:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_OpenError:
|
case PCDM_RS_OpenError:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_ROpenError") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_ROpenError") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_NoVersion:
|
case PCDM_RS_NoVersion:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RNoVersion") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RNoVersion") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_NoModel:
|
case PCDM_RS_NoModel:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RNoModel") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RNoModel") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_NoDocument:
|
case PCDM_RS_NoDocument:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RNoDocument") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RNoDocument") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_FormatFailure:
|
case PCDM_RS_FormatFailure:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RFormatFailure") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RFormatFailure") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_TypeNotFoundInSchema:
|
case PCDM_RS_TypeNotFoundInSchema:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RTypeNotFound") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RTypeNotFound") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_UnrecognizedFileFormat:
|
case PCDM_RS_UnrecognizedFileFormat:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RBadFileFormat") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RBadFileFormat") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_MakeFailure:
|
case PCDM_RS_MakeFailure:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RMakeFailure") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RMakeFailure") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_PermissionDenied:
|
case PCDM_RS_PermissionDenied:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RPermissionDenied") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RPermissionDenied") << aPath);
|
||||||
break;
|
break;
|
||||||
case CDF_RS_DriverFailure:
|
case PCDM_RS_DriverFailure:
|
||||||
ErrorMessage (Message_Msg("TObj_Appl_RDriverFailure") << aPath);
|
ErrorMessage (Message_Msg("TObj_Appl_RDriverFailure") << aPath);
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
|
@ -45,8 +45,6 @@ is
|
|||||||
AddNamespace (me:mutable; thePrefix, theURI: AsciiString)
|
AddNamespace (me:mutable; thePrefix, theURI: AsciiString)
|
||||||
is protected;
|
is protected;
|
||||||
|
|
||||||
IsError (me) returns Boolean from Standard;
|
|
||||||
|
|
||||||
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
|
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
|
||||||
returns ADriverTable from XmlMDF
|
returns ADriverTable from XmlMDF
|
||||||
is virtual;
|
is virtual;
|
||||||
@ -60,6 +58,5 @@ fields
|
|||||||
mySeqOfNS : SequenceOfNamespaceDef from XmlLDrivers;
|
mySeqOfNS : SequenceOfNamespaceDef from XmlLDrivers;
|
||||||
myCopyright : ExtendedString from TCollection;
|
myCopyright : ExtendedString from TCollection;
|
||||||
myRelocTable: SRelocationTable from XmlObjMgt is protected;
|
myRelocTable: SRelocationTable from XmlObjMgt is protected;
|
||||||
myIsError : Boolean from Standard is protected;
|
|
||||||
|
|
||||||
end DocumentStorageDriver;
|
end DocumentStorageDriver;
|
||||||
|
@ -120,7 +120,7 @@ void XmlLDrivers_DocumentStorageDriver::Write
|
|||||||
::take_time (0, " +++++ Fin formatting to XML : ", aMessageDriver);
|
::take_time (0, " +++++ Fin formatting to XML : ", aMessageDriver);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
myIsError = Standard_True;
|
SetIsError (Standard_True);
|
||||||
TCollection_ExtendedString aMsg =
|
TCollection_ExtendedString aMsg =
|
||||||
TCollection_ExtendedString("Error: the file ") + aFileName +
|
TCollection_ExtendedString("Error: the file ") + aFileName +
|
||||||
" cannot be opened for writing";
|
" cannot be opened for writing";
|
||||||
@ -143,7 +143,7 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
|||||||
XmlObjMgt_Element& theElement,
|
XmlObjMgt_Element& theElement,
|
||||||
const TCollection_ExtendedString& theFileName)
|
const TCollection_ExtendedString& theFileName)
|
||||||
{
|
{
|
||||||
myIsError = Standard_False;
|
SetIsError(Standard_False);
|
||||||
Handle(CDM_MessageDriver) aMessageDriver =
|
Handle(CDM_MessageDriver) aMessageDriver =
|
||||||
theDocument -> Application() -> MessageDriver();
|
theDocument -> Application() -> MessageDriver();
|
||||||
// 1. Write header information
|
// 1. Write header information
|
||||||
@ -289,13 +289,13 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
|||||||
}
|
}
|
||||||
catch (Standard_Failure)
|
catch (Standard_Failure)
|
||||||
{
|
{
|
||||||
myIsError = Standard_True;
|
SetIsError (Standard_True);
|
||||||
TCollection_ExtendedString anErrorString (Standard_Failure::Caught()->GetMessageString());
|
TCollection_ExtendedString anErrorString (Standard_Failure::Caught()->GetMessageString());
|
||||||
aMessageDriver -> Write (anErrorString.ToExtString());
|
aMessageDriver -> Write (anErrorString.ToExtString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (anObjNb <= 0 && myIsError == Standard_False) {
|
if (anObjNb <= 0 && IsError() == Standard_False) {
|
||||||
myIsError = Standard_True;
|
SetIsError (Standard_True);
|
||||||
TCollection_ExtendedString anErrorString ("error occurred");
|
TCollection_ExtendedString anErrorString ("error occurred");
|
||||||
aMessageDriver -> Write (anErrorString.ToExtString());
|
aMessageDriver -> Write (anErrorString.ToExtString());
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
|||||||
// 4. Write Shapes section
|
// 4. Write Shapes section
|
||||||
if(WriteShapeSection(theElement))
|
if(WriteShapeSection(theElement))
|
||||||
::take_time (0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
|
::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
|
return -1; // error
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : IsError
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
Standard_Boolean XmlLDrivers_DocumentStorageDriver::IsError () const
|
|
||||||
{
|
|
||||||
return myIsError;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AttributeDrivers
|
//function : AttributeDrivers
|
||||||
//purpose :
|
//purpose :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user