1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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

55
src/UTL/UTL.cdl Executable file
View File

@@ -0,0 +1,55 @@
-- File: UTL.cdl
-- Created: Fri Nov 21 17:29:01 1997
-- Author: Mister rmi
-- <rmi@frilox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1997
package UTL
uses Resource, TCollection,Storage, OSD
is
xgetenv(aCString: CString from Standard)
returns ExtendedString from TCollection;
OpenFile(aFile: in out BaseDriver from Storage; aName: ExtendedString from TCollection; aMode : OpenMode from Storage)
returns Error from Storage;
AddToUserInfo(aData: mutable Data from Storage; anInfo: ExtendedString from TCollection);
Path(aFileName: ExtendedString from TCollection) returns Path from OSD;
Disk(aPath: Path from OSD) returns ExtendedString from TCollection;
Trek(aPath: Path from OSD) returns ExtendedString from TCollection;
Name(aPath: Path from OSD) returns ExtendedString from TCollection;
Extension(aPath: Path from OSD) returns ExtendedString from TCollection;
FileIterator(aPath: Path from OSD; aMask:ExtendedString from TCollection) returns FileIterator from OSD;
Extension(aFileName: ExtendedString from TCollection) returns ExtendedString from TCollection;
LocalHost returns ExtendedString from TCollection;
ExtendedString(anAsciiString: AsciiString from TCollection)
returns ExtendedString from TCollection;
GUID(anXString: ExtendedString from TCollection)
returns GUID from Standard;
Find(aResourceManager: Manager from Resource; aResourceName: ExtendedString from TCollection)
returns Boolean from Standard;
Value(aResourceManager: Manager from Resource; aResourceName: ExtendedString from TCollection)
returns ExtendedString from TCollection;
IntegerValue(anExtendedString: ExtendedString from TCollection)
returns Integer from Standard;
CString(anExtendedString: ExtendedString from TCollection)
returns CString from Standard;
IsReadOnly(aFileName: ExtendedString from TCollection)
returns Boolean from Standard;
end UTL;

126
src/UTL/UTL.cxx Executable file
View File

@@ -0,0 +1,126 @@
// File: UTL.cxx
// Created: Mon Nov 24 07:53:49 1997
// Author: Mister rmi
// <rmi@frilox.paris1.matra-dtv.fr>
#include <UTL.ixx>
#include <OSD_Host.hxx>
#include <OSD_Path.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TCollection_AsciiString.hxx>
#include <Resource_Unicode.hxx>
#include <OSD_Environment.hxx>
#include <OSD_FileIterator.hxx>
#include <OSD_File.hxx>
#include <OSD_Protection.hxx>
#include <OSD_SingleProtection.hxx>
#define MaxChar 10000
static Standard_Character longtc[MaxChar];
static Standard_PCharacter aLongCString = longtc;
static TCollection_ExtendedString outExtendedString;
static TCollection_AsciiString ASCII(const TCollection_ExtendedString& anXString) {
Resource_Unicode::ConvertUnicodeToFormat(anXString,aLongCString,MaxChar);
return TCollection_AsciiString(aLongCString);
}
static TCollection_ExtendedString UNICODE(const TCollection_AsciiString& aCString) {
Resource_Unicode::ConvertFormatToUnicode(aCString.ToCString(),outExtendedString);
return outExtendedString;
}
TCollection_ExtendedString UTL::xgetenv(const Standard_CString aCString) {
TCollection_ExtendedString x;
OSD_Environment theEnv(aCString);
TCollection_AsciiString theValue=theEnv.Value();
if( ! theValue.IsEmpty()) x=UNICODE(theValue);
return x;
}
TCollection_ExtendedString UTL::Extension(const TCollection_ExtendedString& aFileName) {
OSD_Path p = OSD_Path(ASCII(aFileName));
TCollection_AsciiString theExtension=p.Extension();
TCollection_AsciiString theGoodExtension=theExtension;;
if(TCollection_AsciiString(theExtension.Value(1))==".")
theGoodExtension=theExtension.Split(1);
return UNICODE(theGoodExtension);
}
Storage_Error UTL::OpenFile(Storage_BaseDriver& aDriver, const TCollection_ExtendedString& aFileName, const Storage_OpenMode aMode) {
return aDriver.Open(ASCII(aFileName),aMode);
}
void UTL::AddToUserInfo(const Handle(Storage_Data)& aData, const TCollection_ExtendedString& anInfo) {
aData->AddToUserInfo(ASCII(anInfo));
}
OSD_Path UTL::Path(const TCollection_ExtendedString& aFileName) {
// cout << "Path : " << aFileName << endl;
// TCollection_AsciiString theAciiString=ASCII(aFileName);
// OSD_Path p = OSD_Path(theAciiString);
OSD_Path p = OSD_Path(ASCII(aFileName));
return p;
}
TCollection_ExtendedString UTL::Disk(const OSD_Path& aPath) {
return UNICODE(aPath.Disk());
}
TCollection_ExtendedString UTL::Trek(const OSD_Path& aPath) {
return UNICODE(aPath.Trek());
}
TCollection_ExtendedString UTL::Name(const OSD_Path& aPath) {
return UNICODE(aPath.Name());
}
TCollection_ExtendedString UTL::Extension(const OSD_Path& aPath) {
return UNICODE(aPath.Extension());
}
OSD_FileIterator UTL::FileIterator(const OSD_Path& aPath, const TCollection_ExtendedString& aMask) {
OSD_FileIterator it = OSD_FileIterator(aPath,ASCII(aMask));
return it;
}
TCollection_ExtendedString UTL::LocalHost() {
OSD_Host h;
return UNICODE(h.HostName());
}
TCollection_ExtendedString UTL::ExtendedString(const TCollection_AsciiString& anAsciiString) {
return UNICODE(anAsciiString);
}
Standard_GUID UTL::GUID(const TCollection_ExtendedString& anXString) {
return Standard_GUID(TCollection_AsciiString(anXString,'?').ToCString());
}
Standard_Boolean UTL::Find(const Handle(Resource_Manager)& aResourceManager, const TCollection_ExtendedString& aResourceName) {
return aResourceManager->Find(ASCII(aResourceName).ToCString());
}
TCollection_ExtendedString UTL::Value(const Handle(Resource_Manager)& aResourceManager, const TCollection_ExtendedString& aResourceName) {
return UNICODE(aResourceManager->Value(ASCII(aResourceName).ToCString()));
}
Standard_Integer UTL::IntegerValue(const TCollection_ExtendedString& anExtendedString) {
TCollection_AsciiString a=ASCII(anExtendedString);
return a.IntegerValue();
}
Standard_CString UTL::CString(const TCollection_ExtendedString& anExtendedString) {
static TCollection_AsciiString theValue;
theValue=ASCII(anExtendedString);
return theValue.ToCString();
}
Standard_Boolean UTL::IsReadOnly(const TCollection_ExtendedString& aFileName) {
switch (OSD_File(UTL::Path(aFileName)).Protection().User()) {
case OSD_W:
case OSD_RW:
case OSD_WX:
case OSD_RWX:
case OSD_RWD:
case OSD_WXD:
case OSD_RWXD:
return Standard_False;
default:
return Standard_True;
}
}