]> OCCT Git - occt-copy.git/commitdiff
FWOSDriver modified and moved from CDF to FWOSDriver package.
authorstv <stv@opencascade.com>
Wed, 27 May 2015 09:14:54 +0000 (12:14 +0300)
committerstv <stv@opencascade.com>
Wed, 27 May 2015 09:14:54 +0000 (12:14 +0300)
src/CDF/CDF_FWOSDriver.cdl [deleted file]
src/CDF/CDF_FWOSDriver.cxx [deleted file]
src/FWOSDriver/FWOSDriver_Driver.cdl
src/FWOSDriver/FWOSDriver_Driver.cxx

diff --git a/src/CDF/CDF_FWOSDriver.cdl b/src/CDF/CDF_FWOSDriver.cdl
deleted file mode 100644 (file)
index 70ee295..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
--- Created on: 1997-01-22
--- Created by: Mister rmi
--- Copyright (c) 1997-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- 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 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.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class FWOSDriver from CDF  inherits MetaDataDriver from CDF
-uses
-    MetaData from CDM,
-    Document from CDM,
-    ExtendedString from TCollection,
-    IODevice from Storage
-    
-is
-    Create
-    returns FWOSDriver from CDF;
-    ---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; aDevice: IODevice from Storage; aVersion: ExtendedString from TCollection)
-    returns MetaData from CDM
-    is  private;
-    
-    CreateMetaData(me: mutable; aDocument: Document from CDM)
-    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; aDevice: IODevice from Storage)
-   returns MetaData from CDM
-   is private;
-
-   SetName(me: mutable; aDocument: Document from CDM; aName: ExtendedString from TCollection)
-   returns ExtendedString from TCollection
-   is redefined;
-   
-end FWOSDriver from CDF;
diff --git a/src/CDF/CDF_FWOSDriver.cxx b/src/CDF/CDF_FWOSDriver.cxx
deleted file mode 100644 (file)
index 75a63b1..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// 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 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <CDF_FWOSDriver.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
-
-
-//==============================================================================
-//function : PutSlash
-//purpose  :
-//==============================================================================
-static void PutSlash (TCollection_ExtendedString& anXSTRING) {
-#ifdef WNT
-  anXSTRING+="\\";
-#else
-  anXSTRING+="/";
-#endif  // WNT
-}
-
-//==============================================================================
-//function : CDF_FWOSDriver
-//purpose  :
-//==============================================================================
-CDF_FWOSDriver::CDF_FWOSDriver() {}
-
-//==============================================================================
-//function : Find
-//purpose  :
-//==============================================================================
-Standard_Boolean CDF_FWOSDriver::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;
-}
-
-//==============================================================================
-//function : HasReadPermission
-//purpose  :
-//==============================================================================
-Standard_Boolean CDF_FWOSDriver::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;
-    }
-}
-
-//==============================================================================
-//function : MetaData
-//purpose  :
-//==============================================================================
-Handle(CDM_MetaData) CDF_FWOSDriver::MetaData(const Handle(Storage_IODevice)& aDevice,
-                                              const TCollection_ExtendedString& /*aVersion*/)
-{
-  //  TCollection_ExtendedString p = Concatenate(aFolder,aName);
-  return CDM_MetaData::LookUp(aDevice,!aDevice->CanWrite());
-}
-
-//==============================================================================
-//function : CreateMetaData
-//purpose  :
-//==============================================================================
-Handle(CDM_MetaData) CDF_FWOSDriver::CreateMetaData(const Handle(CDM_Document)& aDocument)
-{
-  return CDM_MetaData::LookUp(aDocument->RequestedDevice(),!aDocument->RequestedDevice()->CanWrite());
-}
-
-//==============================================================================
-//function : BuildFileName
-//purpose  :
-//==============================================================================
-TCollection_ExtendedString CDF_FWOSDriver::BuildFileName(const Handle(CDM_Document)& aDocument)
-{
-/*
-  TCollection_ExtendedString retstr = TCollection_ExtendedString(aDocument->RequestedFolder());
-  PutSlash(retstr);
-  retstr += aDocument->RequestedName();
-  return retstr;
-*/
-  return aDocument->RequestedDevice()->Name();
-}
-
-//==============================================================================
-//function : FindFolder
-//purpose  :
-//==============================================================================
-Standard_Boolean CDF_FWOSDriver::FindFolder(const TCollection_ExtendedString& aFolder)
-{
-  
-  OSD_Path thePath=UTL::Path(aFolder);
-  OSD_Directory theDirectory(thePath);
-  return theDirectory.Exists();
-}
-
-//==============================================================================
-//function : Concatenate
-//purpose  :
-//==============================================================================
-TCollection_ExtendedString CDF_FWOSDriver::Concatenate(const TCollection_ExtendedString& aFolder,
-                                                          const TCollection_ExtendedString& aName)
-{
-  TCollection_ExtendedString ff(aFolder);
-  ff = "";
-  ff += aFolder;
-  PutSlash(ff);
-  ff+=aName;
-  return ff;
-}
-
-//==============================================================================
-//function : DefaultFolder
-//purpose  :
-//==============================================================================
-TCollection_ExtendedString CDF_FWOSDriver::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;
-}
-
-//==============================================================================
-//function : BuildMetaData
-//purpose  :
-//==============================================================================
-Handle(CDM_MetaData) CDF_FWOSDriver::BuildMetaData(const Handle(Storage_IODevice)& aDevice)
-{
-/*
-  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));
-*/
-  return CDM_MetaData::LookUp(aDevice,!aDevice->CanWrite());
-}
-
-//==============================================================================
-//function : SetName
-//purpose  :
-//==============================================================================
-TCollection_ExtendedString CDF_FWOSDriver::SetName(const Handle(CDM_Document)& aDocument,
-                                                      const TCollection_ExtendedString& aName)
-{
-  
-  TCollection_ExtendedString xn(aName), n(aName);
-
-#ifdef WNT
-  //windows is not case sensitive
-  Standard_ExtCharacter   echar;
-  //make the extension lower case
-  for(int i = 1; i <= xn.Length(); i++)
-  {
-       echar = xn.Value(i);
-       echar = towlower(echar);
-       xn.SetValue(i, echar);
-  }
-#endif
-  
-  TCollection_ExtendedString e (aDocument->FileExtension());
-  TCollection_ExtendedString xe(e);
-  if (e.Length() > 0) {
-#ifdef WNT
-    //windows is not case sensitive
-    Standard_ExtCharacter   echar;
-    //make the extension lower case
-    for(int i = 1; i <= xe.Length(); i++)
-    {
-         echar = xe.Value(i);
-         echar = towlower(echar);
-         xe.SetValue(i, echar);
-    }
-#endif
-    xe.Insert(1, '.');
-    e.Insert(1, '.');
-    Standard_Integer ln = xn.Length();
-    Standard_Integer le = xe.Length();
-    Standard_Boolean ExtensionIsAlreadyThere = Standard_False;
-    if(ln>=le) {
-      Standard_Integer ind=xn.SearchFromEnd(xe);
-      ExtensionIsAlreadyThere = ind+le-1==ln;
-    }
-    if(!ExtensionIsAlreadyThere) n+=e;
-  }
-  return n;
-}
index 43c6ef7977a2cf5483b87381fc8e2d8737afe2fa..506ed8bd277930f16907fa536a163fe988a491b2 100644 (file)
 
 class Driver from FWOSDriver  inherits MetaDataDriver from CDF
 uses
-    MetaData from CDM,Document from CDM,
+    MetaData from CDM,
+    Document from CDM,
     ExtendedString from TCollection,
-    ExtendedString from TCollection
+    IODevice from Storage
+    
 is
     Create
     returns mutable Driver from FWOSDriver;
@@ -34,14 +36,13 @@ is
     returns Boolean from Standard;
 
     
-    MetaData(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
+    MetaData(me: mutable; aDevice: IODevice from Storage; 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;
+    CreateMetaData(me: mutable; aDocument: Document from CDM)
+    returns MetaData from CDM
+    is private;
     
     FindFolder(me: mutable; aFolder: ExtendedString from TCollection)
     returns Boolean from Standard;
@@ -57,9 +58,9 @@ is
    is private;
 
 
-   BuildMetaData(me: mutable; aFileName: ExtendedString from TCollection)
+   BuildMetaData(me: mutable; aDevice: IODevice from Storage)
    returns MetaData from CDM
-   is  private;
+   is private;
 
    SetName(me: mutable; aDocument: Document from CDM; aName: ExtendedString from TCollection)
    returns ExtendedString from TCollection
index e4e915072c9c50112e5db58907aaa66cbeff7895..7d21d776788f8027b67cc730b5a81438dba8adda 100644 (file)
@@ -96,37 +96,35 @@ Standard_Boolean FWOSDriver_Driver::HasReadPermission(const TCollection_Extended
 //function : MetaData
 //purpose  :
 //==============================================================================
-Handle(CDM_MetaData) FWOSDriver_Driver::MetaData(const TCollection_ExtendedString& aFolder,
-                                                 const TCollection_ExtendedString& aName,
-                                                 const TCollection_ExtendedString& /*aVersion*/)
+Handle(CDM_MetaData) FWOSDriver_FWOSDriver::MetaData(const Handle(Storage_IODevice)& aDevice,
+                                                     const TCollection_ExtendedString& /*aVersion*/)
 {
-  TCollection_ExtendedString p = Concatenate(aFolder,aName);
-  return CDM_MetaData::LookUp(aFolder,aName,p,p,UTL::IsReadOnly(p));
+  //  TCollection_ExtendedString p = Concatenate(aFolder,aName);
+  return CDM_MetaData::LookUp(aDevice,!aDevice->CanWrite());
 }
 
 //==============================================================================
 //function : CreateMetaData
 //purpose  :
 //==============================================================================
-Handle(CDM_MetaData) FWOSDriver_Driver::CreateMetaData(const Handle(CDM_Document)& aDocument,
-                                                       const TCollection_ExtendedString& aFileName)
+Handle(CDM_MetaData) FWOSDriver_FWOSDriver::CreateMetaData(const Handle(CDM_Document)& aDocument)
 {
-  return CDM_MetaData::LookUp(aDocument->RequestedFolder(),aDocument->RequestedName(),
-                              Concatenate(aDocument->RequestedFolder(),aDocument->RequestedName()),
-                              aFileName,UTL::IsReadOnly(aFileName));
+  return CDM_MetaData::LookUp(aDocument->RequestedDevice(),!aDocument->RequestedDevice()->CanWrite());
 }
 
 //==============================================================================
 //function : BuildFileName
 //purpose  :
 //==============================================================================
-TCollection_ExtendedString FWOSDriver_Driver::BuildFileName(const Handle(CDM_Document)& aDocument)
+TCollection_ExtendedString FWOSDriver_FWOSDriver::BuildFileName(const Handle(CDM_Document)& aDocument)
 {
-
+/*
   TCollection_ExtendedString retstr = TCollection_ExtendedString(aDocument->RequestedFolder());
   PutSlash(retstr);
   retstr += aDocument->RequestedName();
   return retstr;
+*/
+  return aDocument->RequestedDevice()->Name();
 }
 
 //==============================================================================
@@ -191,9 +189,9 @@ TCollection_ExtendedString FWOSDriver_Driver::DefaultFolder()
 //function : BuildMetaData
 //purpose  :
 //==============================================================================
-Handle(CDM_MetaData) FWOSDriver_Driver::BuildMetaData(const TCollection_ExtendedString& aFileName)
+Handle(CDM_MetaData) FWOSDriver_FWOSDriver::BuildMetaData(const Handle(Storage_IODevice)& aDevice)
 {
-
+/*
   OSD_Path p = UTL::Path(aFileName);
   
   TCollection_ExtendedString f = UTL::Trek(p);
@@ -202,13 +200,15 @@ Handle(CDM_MetaData) FWOSDriver_Driver::BuildMetaData(const TCollection_Extended
   n += UTL::Extension(p);
 
   return CDM_MetaData::LookUp(f,n,aFileName,aFileName,UTL::IsReadOnly(aFileName));
+*/
+  return CDM_MetaData::LookUp(aDevice,!aDevice->CanWrite());
 }
 
 //==============================================================================
 //function : SetName
 //purpose  :
 //==============================================================================
-TCollection_ExtendedString FWOSDriver_Driver::SetName(const Handle(CDM_Document)& aDocument,
+TCollection_ExtendedString FWOSDriver_FWOSDriver::SetName(const Handle(CDM_Document)& aDocument,
                                                       const TCollection_ExtendedString& aName)
 {