1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

20
src/FWOSDriver/FWOSDriver.cdl Executable file
View File

@@ -0,0 +1,20 @@
-- File: FWOSDriver.cdl
-- Created: Wed Jan 22 16:22:16 1997
-- Author: Mister rmi
-- <rmi@frilox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
package FWOSDriver
uses
CDM,CDF,TCollection
is
class Driver;
class DriverFactory;
Factory(aGUID: GUID from Standard)
returns Transient from Standard;
---Purpose: returns a DriverFactory.
end FWOSDriver;

23
src/FWOSDriver/FWOSDriver.cxx Executable file
View File

@@ -0,0 +1,23 @@
// File: FWOSDriver.cxx
// Created: Tue Mar 4 16:38:53 1997
// Author: Mister rmi
// <rmi@frilox.paris1.matra-dtv.fr>
#include <FWOSDriver.ixx>
#include <FWOSDriver_DriverFactory.hxx>
#include <Plugin_Macro.hxx>
// avoid warnings on 'extern "C"' functions returning C++ classes
#ifdef WNT
#pragma warning(4:4190)
#endif
PLUGIN(FWOSDriver)
Handle(Standard_Transient) FWOSDriver::Factory(const Standard_GUID& aGUID) {
static Handle(FWOSDriver_DriverFactory) f;
if(f.IsNull()) f = new FWOSDriver_DriverFactory;
return f;
}

View File

@@ -0,0 +1,58 @@
-- File: FWOSDriver_Driver.cdl
-- Created: Wed Jan 22 16:22:48 1997
-- Author: Mister rmi
-- <rmi@frilox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class Driver from FWOSDriver inherits MetaDataDriver from CDF
uses
MetaData from CDM,Document from CDM,
ExtendedString from TCollection,
ExtendedString from TCollection
is
Create
returns mutable Driver from FWOSDriver;
---Purpose: initializes the MetaDatadriver with its specific name.
Find(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
returns Boolean from Standard;
---Purpose: indicate whether a file exists corresponding to the folder and the name
HasReadPermission(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
returns Boolean from Standard;
MetaData(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
returns MetaData from CDM
is private;
CreateMetaData(me: mutable; aDocument: Document from CDM;
aFileName: ExtendedString from TCollection)
returns MetaData from CDM
is private;
FindFolder(me: mutable; aFolder: ExtendedString from TCollection)
returns Boolean from Standard;
DefaultFolder(me: mutable) returns ExtendedString from TCollection;
BuildFileName(me: mutable; aDocument: Document from CDM)
returns ExtendedString from TCollection;
Concatenate(myclass; aFolder,aName: ExtendedString from TCollection)
returns ExtendedString from TCollection
is private;
BuildMetaData(me: mutable; aFileName: ExtendedString from TCollection)
returns MetaData from CDM
is private;
SetName(me: mutable; aDocument: Document from CDM; aName: ExtendedString from TCollection)
returns ExtendedString from TCollection
is redefined;
end Driver from FWOSDriver;

View File

@@ -0,0 +1,155 @@
#include <FWOSDriver_Driver.ixx>
#include <TCollection_ExtendedString.hxx>
#include <OSD_Path.hxx>
#include <OSD_Directory.hxx>
#include <OSD_Protection.hxx>
#include <OSD_SingleProtection.hxx>
#include <OSD_File.hxx>
#include <OSD_FileNode.hxx>
#include <UTL.hxx>
#include <TCollection_ExtendedString.hxx>
#ifdef WNT
#include <tchar.h>
#endif // WNT
static void PutSlash (TCollection_ExtendedString& anXSTRING) {
#ifdef WNT
anXSTRING+="\\";
#else
anXSTRING+="/";
#endif // WNT
}
FWOSDriver_Driver::FWOSDriver_Driver() {}
Standard_Boolean FWOSDriver_Driver::Find(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
OSD_Path thePath=UTL::Path(aFolder);
OSD_Directory theDirectory(thePath);
if(theDirectory.Exists()) {
TCollection_ExtendedString f(aFolder);
PutSlash(f);
f+=aName;
OSD_Path p2 = UTL::Path(f);
OSD_File theFile(p2);
return theFile.Exists();
}
return Standard_False;
}
Standard_Boolean FWOSDriver_Driver::HasReadPermission(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
OSD_SingleProtection theProtection=OSD_File(UTL::Path(Concatenate(aFolder,aName))).Protection().User();
switch (theProtection) {
case OSD_None:
case OSD_R:
case OSD_RW:
case OSD_RX:
case OSD_WX:
case OSD_RWX:
case OSD_RD:
case OSD_RWD:
case OSD_RXD:
case OSD_RWXD:
return Standard_True;
default:
return Standard_False;
}
return Standard_False;
}
Handle(CDM_MetaData) FWOSDriver_Driver::MetaData(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
TCollection_ExtendedString p = Concatenate(aFolder,aName);
return CDM_MetaData::LookUp(aFolder,aName,p,p,UTL::IsReadOnly(p));
}
Handle(CDM_MetaData) FWOSDriver_Driver::CreateMetaData(const Handle(CDM_Document)& aDocument,const TCollection_ExtendedString& aFileName) {
return CDM_MetaData::LookUp(aDocument->RequestedFolder(),aDocument->RequestedName(),Concatenate(aDocument->RequestedFolder(),aDocument->RequestedName()),aFileName,UTL::IsReadOnly(aFileName));
}
TCollection_ExtendedString FWOSDriver_Driver::BuildFileName(const Handle(CDM_Document)& aDocument) {
TCollection_ExtendedString retstr = TCollection_ExtendedString(aDocument->RequestedFolder());
PutSlash(retstr);
retstr += aDocument->RequestedName();
return retstr;
}
Standard_Boolean FWOSDriver_Driver::FindFolder(const TCollection_ExtendedString& aFolder) {
OSD_Path thePath=UTL::Path(aFolder);
OSD_Directory theDirectory(thePath);
return theDirectory.Exists();
}
TCollection_ExtendedString FWOSDriver_Driver::Concatenate(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
TCollection_ExtendedString ff(aFolder);
ff = "";
ff += aFolder;
PutSlash(ff);
ff+=aName;
return ff;
}
TCollection_ExtendedString FWOSDriver_Driver::DefaultFolder() {
TCollection_ExtendedString theDefaultFolder;
if (theDefaultFolder.Length() == 0) {
#ifdef WNT
TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE");
if(hd.Length() != NULL) {
theDefaultFolder=hd;
theDefaultFolder+=UTL::xgetenv("HOMEPATH");
}
else {
theDefaultFolder=UTL::xgetenv("TEMP");
if(theDefaultFolder.Length()==0) Standard_Failure::Raise("cannot determine default folder; HOMEDRIVE and TEMP are undefined");
}
#else
TCollection_ExtendedString home=UTL::xgetenv("HOME");
if(home.Length() !=0)
theDefaultFolder = home;
else
theDefaultFolder= TCollection_ExtendedString("/tmp");
#endif
}
return theDefaultFolder;
}
Handle(CDM_MetaData) FWOSDriver_Driver::BuildMetaData(const TCollection_ExtendedString& aFileName) {
OSD_Path p = UTL::Path(aFileName);
TCollection_ExtendedString f = UTL::Trek(p);
TCollection_ExtendedString n = UTL::Name(p);
n +=".";
n += UTL::Extension(p);
return CDM_MetaData::LookUp(f,n,aFileName,aFileName,UTL::IsReadOnly(aFileName));
}
TCollection_ExtendedString FWOSDriver_Driver::SetName(const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aName) {
TCollection_ExtendedString xn(aName);
TCollection_ExtendedString n(xn);
// file name may have spaces
//n.RemoveAll(' ');
TCollection_ExtendedString e (aDocument->FileExtension());
if (e.Length() > 0) {
e.Insert(1, '.');
Standard_Integer ln = n.Length();
Standard_Integer le = e.Length();
Standard_Boolean ExtensionIsAlreadyThere = Standard_False;
if(ln>=le) {
Standard_Integer ind=n.SearchFromEnd(e);
ExtensionIsAlreadyThere = ind+le-1==ln;
}
if(!ExtensionIsAlreadyThere) n+=e;
}
return n;
}

View File

@@ -0,0 +1,17 @@
-- File: OSDriver_DriverFactory.cdl
-- Created: Tue Mar 4 14:35:56 1997
-- Author: Mister rmi
-- <rmi@frilox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
class DriverFactory from FWOSDriver inherits MetaDataDriverFactory from CDF
uses MetaDataDriver from CDF, ExtendedString from TCollection
is
Create returns mutable DriverFactory from FWOSDriver;
Build(me)
returns MetaDataDriver from CDF;
end DriverFactory from FWOSDriver;

View File

@@ -0,0 +1,16 @@
// File: FWOSDriver_DriverFactory.cxx
// Created: Tue Mar 4 14:39:45 1997
// Author: Mister rmi
// <rmi@frilox.paris1.matra-dtv.fr>
#include <FWOSDriver_DriverFactory.ixx>
#include <FWOSDriver_Driver.hxx>
FWOSDriver_DriverFactory::FWOSDriver_DriverFactory(){}
Handle(CDF_MetaDataDriver) FWOSDriver_DriverFactory::Build() const {
static Handle(FWOSDriver_Driver) d = new FWOSDriver_Driver();
return d;
}