//
// This file is part of Open CASCADE Technology software library.
//
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// Modified by rmi, Tue Nov 18 08:17:41 1997
-
-#include <CDM_Document.ixx>
-
+#include <CDM_Application.hxx>
+#include <CDM_DataMapIteratorOfMetaDataLookUpTable.hxx>
+#include <CDM_Document.hxx>
+#include <CDM_ListIteratorOfListOfDocument.hxx>
+#include <CDM_ListOfDocument.hxx>
+#include <CDM_MetaData.hxx>
+#include <CDM_NamesDirectory.hxx>
+#include <CDM_PresentationDirectory.hxx>
+#include <CDM_Reference.hxx>
+#include <CDM_ReferenceIterator.hxx>
+#include <Resource_Manager.hxx>
+#include <Standard_DomainError.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_GUID.hxx>
+#include <Standard_NoSuchObject.hxx>
#include <Standard_NullObject.hxx>
-
-#include <TCollection_ExtendedString.hxx>
#include <Standard_ProgramError.hxx>
-
-#include <CDM_PresentationDirectory.hxx>
-#include <CDM_NamesDirectory.hxx>
-
-#include <CDM_ListOfDocument.hxx>
-#include <CDM_ListIteratorOfListOfDocument.hxx>
-
+#include <Standard_Type.hxx>
+#include <TCollection_ExtendedString.hxx>
#include <UTL.hxx>
-#include <CDM_DataMapIteratorOfMetaDataLookUpTable.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(CDM_Document,Standard_Transient)
static CDM_PresentationDirectory& getPresentations() {
static CDM_PresentationDirectory thePresentations;
myRequestedNameIsDefined (Standard_False),
myRequestedPreviousVersionIsDefined(Standard_False),
myFileExtensionWasFound (Standard_False),
- myDataTypeWasFound (Standard_False),
- myVersionDataTypeWasFound (Standard_False),
- myDescriptionWasFound (Standard_False),
- myDomainWasFound (Standard_False),
- myStoragePluginWasFound (Standard_False),
- myDefaultPresentationWasFound (Standard_False)
+ myDescriptionWasFound (Standard_False)
{}
//=======================================================================
-//function : Destroy
+//function : ~CDM_Document
//purpose :
//=======================================================================
-void CDM_Document::Destroy() {
+CDM_Document::~CDM_Document()
+{
if(!myMetaData.IsNull()) myMetaData->UnsetDocument();
}
Standard_ExtString CDM_Document::Comment() const
{
if (myComments.Length() < 1)
- return TCollection_ExtendedString().ToExtString();
+ return 0;
return myComments(1).ToExtString();
}
TCollection_ExtendedString presentation("");
static Standard_Integer theUnnamedDocuments(0);
static CDM_NamesDirectory theNames;
- static CDM_NamesDirectory theTypes;
if(!myMetaData.IsNull()) {
presentation += myMetaData->Name();
}
}
else {
- LoadResources();
- if(myDefaultPresentationWasFound) {
-// presentation += "$";
- presentation += myDefaultPresentation;
- if(!theTypes.IsBound(presentation)) theTypes.Bind(presentation,0);
- Standard_Integer range = theTypes(presentation);
- range +=1;
- theTypes(presentation) = range;
- presentation += "_";
- presentation += range;
- }
- else {
- presentation += TCollection_ExtendedString("Document_");
- presentation += ++theUnnamedDocuments;
- }
+ presentation = "Document_";
+ presentation += ++theUnnamedDocuments;
}
if(getPresentations().IsBound(presentation)) {
FIND(theDocumentResource,
theResourceName,myFileExtensionWasFound,myFileExtension);
- theResourceName=theFormat;
- theResourceName+="DataType";
- FIND(theDocumentResource,theResourceName,myDataTypeWasFound,myDataType);
-
-
- theResourceName=theFormat;
- theResourceName+="VersionDataType";
- FIND(theDocumentResource,
- theResourceName,myVersionDataTypeWasFound,myVersionDataType);
-
theResourceName=theFormat;
theResourceName+="Description";
FIND(theDocumentResource,theResourceName,myDescriptionWasFound,myDescription);
- theResourceName=theFormat;
- theResourceName+="Domain";
- FIND(theDocumentResource,theResourceName,myDomainWasFound,myDomain);
-
- theResourceName=theFormat;
- theResourceName+="Presentation";
- FIND(theDocumentResource,
- theResourceName,myDefaultPresentationWasFound,myDefaultPresentation);
-
- theResourceName=theFormat;
- theResourceName+="StoragePlugin";
- TCollection_ExtendedString thePluginId;
- FIND(theDocumentResource,theResourceName,myStoragePluginWasFound,thePluginId);
- if(myStoragePluginWasFound) myStoragePlugin=UTL::GUID(thePluginId);
myResourcesAreLoaded=Standard_True;
-// cout << "resource Loaded: " << "Format: " << theFormat << ", FileExtension:" << myFileExtension << ", DataType:" << myDataType << ", VersionDataType:" << myVersionDataType << ", Description:" << myDescription << ", Domain:" << myDomain << endl;
+// cout << "resource Loaded: Format: " << theFormat << ", FileExtension:" << myFileExtension << ", Description:" << myDescription << endl;
}
return;
}
return myFileExtension;
}
-//=======================================================================
-//function : FindDataType
-//purpose :
-//=======================================================================
-
-Standard_Boolean CDM_Document::FindDataType ()
-{
- LoadResources();
- return myDataTypeWasFound;
-}
-
-//=======================================================================
-//function : DataType
-//purpose :
-//=======================================================================
-
-TCollection_ExtendedString CDM_Document::DataType()
-{
- LoadResources();
- return myDataType;
-}
-
-//=======================================================================
-//function : FindVersionDataType
-//purpose :
-//=======================================================================
-
-Standard_Boolean CDM_Document::FindVersionDataType ()
-{
- LoadResources();
- return myVersionDataTypeWasFound;
-}
-
-//=======================================================================
-//function : VersionDataType
-//purpose :
-//=======================================================================
-
-TCollection_ExtendedString CDM_Document::VersionDataType()
-{
- LoadResources();
- return myVersionDataType;
-}
-
//=======================================================================
//function : FindDescription
//purpose :
return myDescription;
}
-//=======================================================================
-//function : FindDomain
-//purpose :
-//=======================================================================
-
-Standard_Boolean CDM_Document::FindDomain ()
-{
- LoadResources();
- return myDomainWasFound;
-}
-
-//=======================================================================
-//function : Domain
-//purpose :
-//=======================================================================
-
-TCollection_ExtendedString CDM_Document::Domain()
-{
- LoadResources();
- return myDomain;
-}
-
-//=======================================================================
-//function : FindStoragePlugin
-//purpose :
-//=======================================================================
-
-Standard_Boolean CDM_Document::FindStoragePlugin()
-{
- LoadResources();
- return myStoragePluginWasFound;
-}
-
-//=======================================================================
-//function : StoragePlugin
-//purpose :
-//=======================================================================
-
-Standard_GUID CDM_Document::StoragePlugin()
-{
- LoadResources();
- return myStoragePlugin;
-}
-
//=======================================================================
//function : IsReadOnly
//purpose :