CFx SDK Documentation  2020SP3
RxSystemServices.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 #ifndef _ODRXSYSTEMSERVICES_INCLUDED_
26 #define _ODRXSYSTEMSERVICES_INCLUDED_
27 
28 #include <stdarg.h>
29 
30 #include "RxObject.h"
31 #include "OdStreamBuf.h"
32 #include "OdCodePage.h"
33 #if defined(_DEBUG) && defined(_WIN32)
34 #define STL_USING_VECTOR
35 #include "OdaSTL.h"
36 #endif
37 
38 class OdTimeStamp;
39 class OdRxModule;
40 class OdRxDictionary;
42 
43 #include "TD_PackPush.h"
44 
49 namespace Oda
50 {
52 
53 
54  enum FileAccessMode // Access
55  {
56  kFileRead = (long)
57  0x80000000, // Read access. Use kFileRead | kFileWrite for read/write access.
58  kFileWrite = 0x40000000, // Write access. Use kFileRead | kFileWrite for read/write access.
59  kFileTmp = 0x20000000, // hint to use FILE_ATTRIBUTE_TEMPORARY for 'FlagsAndAttributes'
60  kFileDelete = 0x10000000 // hint to use FILE_FLAG_DELETE_ON_CLOSE for 'FlagsAndAttributes'
61  };
62 
64  {
65  kShareDenyReadWrite = 0x10, // deny read/write mode
66  kShareDenyWrite = 0x20, // deny write mode
67  kShareDenyRead = 0x30, // deny read mode
68  kShareDenyNo = 0x40 // deny none mode
69  };
70 
71 
73  {
74  kCreateNew = 1, // Creates a new file; fails if the specified file already exists.
75  kCreateAlways = 2, // Creates a new file; overwrites any existing file.
76  kOpenExisting = 3, // Opens the file; fails if the file does not exist.
77  kOpenAlways = 4, // Opens the file; creates the file if it does not exist.
78  kTruncateExisting = 5 // Truncates the file; fails if the file does not exist. The file must be open at least kFileWrite.
79  };
80 }
81 
90 {
91 public:
95  OdError_FileException(OdResult code, const OdString& filename, const OdString& extended = OdString::kEmpty);
100 };
101 
110 {
111 public:
114  OdError_FileNotFound(const OdString& filename);
115 };
116 
125 {
126 public:
129  OdError_CantOpenFile(const OdString& filename);
130 };
131 
140 {
141 public:
145 };
146 
154 {
155 public:
157 };
158 
166 {
167 public:
169 };
170 
180 {
181 public:
182 
184  {
185 #if defined _WIN32_WCE
186  srand(GetTickCount());
187 #else
188  Od_srand((unsigned int) time(0));
189 #endif
190  }
192 
233  const OdString& filename,
234  Oda::FileAccessMode accessMode = Oda::kFileRead,
236  Oda::FileCreationDisposition creationDisposition = Oda::kOpenExisting);
237 
255  virtual bool accessFile(const OdString& filename, int accessMode);
256 
264  virtual OdInt64 getFileCTime(const OdString& filename) = 0;
265 
273  virtual OdInt64 getFileMTime(const OdString& filename) = 0;
274 
282  virtual OdInt64 getFileSize(const OdString& filename) = 0;
283 
284 
290  virtual OdString formatMessage(unsigned int formatId, va_list* argList= 0) = 0;
291 
298  virtual OdString formatMsg(unsigned int formatId, ...);
299 
303  virtual OdCodePageId systemCodePage() const = 0;
304 
308  virtual OdString createGuid();
309 
313  virtual OdGUID createOdGUID();
314 
326  virtual OdRxModule* loadModule(const OdString& moduleFileName, bool silent);
327 
333  virtual void unloadModule(OdRxModule* pModuleObj);
334 
340  virtual OdString findModule(const OdString& applicationName);
341 
347  virtual void warning(const OdString& message);
348 
355  virtual void warning(const char* warnVisGroup, const OdString& message);
356 
367  static OdRxModule* loadModuleLib(const OdString& moduleFileName, bool silent);
368 
381 
382 #if defined(_DEBUG) && defined(_WIN32)
383  static void dontFreeLibrary(std::vector<HMODULE>* notFreedDlls) { s_notFreedDlls = notFreedDlls; }
384 private:
385  FIRSTDLL_EXPORT_STATIC static std::vector<HMODULE>* s_notFreedDlls;
386 #endif
387 };
392 
394 
395 #include "TD_PackPop.h"
396 
397 #endif // #ifndef _ODRXSYSTEMSERVICES_INCLUDED_
OdError_FileNotFound
Definition: RxSystemServices.h:110
FIRSTDLL_EXPORT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
OdRxSystemServices::loadModuleLib
static OdRxModule * loadModuleLib(const OdString &moduleFileName, bool silent)
OdResult
OdResult
Definition: OdResult.h:29
OdError_InvalidKey
Definition: RxSystemServices.h:166
OdString
Definition: OdString.h:95
Oda::kOpenExisting
@ kOpenExisting
Definition: RxSystemServices.h:76
OdRxSystemServices::createFile
virtual OdStreamBufPtr createFile(const OdString &filename, Oda::FileAccessMode accessMode=Oda::kFileRead, Oda::FileShareMode shareMode=Oda::kShareDenyNo, Oda::FileCreationDisposition creationDisposition=Oda::kOpenExisting)
OdTimeStamp
Definition: OdTimeStamp.h:42
Oda::kOpenAlways
@ kOpenAlways
Definition: RxSystemServices.h:77
OdInt64
Definition: Int64.h:43
OdRxSystemServices::formatMsg
virtual OdString formatMsg(unsigned int formatId,...)
OdRxSystemServices::createOdGUID
virtual OdGUID createOdGUID()
OdRxObject
Definition: RxObject.h:564
Oda
Definition: TxDefs.h:48
OdaSTL.h
Od_srand
#define Od_srand
Definition: OdPlatform.h:136
OdRxSystemServicesPtr
OdSmartPtr< OdRxSystemServices > OdRxSystemServicesPtr
Definition: RxSystemServices.h:391
OdCodePageId
OdCodePageId
Definition: OdCodePage.h:31
Oda::kCreateNew
@ kCreateNew
Definition: RxSystemServices.h:74
OdCodePage.h
TD_PackPop.h
Oda::kFileRead
@ kFileRead
Definition: RxSystemServices.h:56
Oda::kFileDelete
@ kFileDelete
Definition: RxSystemServices.h:60
OdError_FileException
Definition: RxSystemServices.h:90
OdError_FileWriteError
Definition: RxSystemServices.h:140
OdRxSystemServices::accessFile
virtual bool accessFile(const OdString &filename, int accessMode)
RxObject.h
Oda::kShareDenyNo
@ kShareDenyNo
Definition: RxSystemServices.h:68
OdRxSystemServices::unloadModule
virtual void unloadModule(OdRxModule *pModuleObj)
Oda::kFileWrite
@ kFileWrite
Definition: RxSystemServices.h:58
OdStreamBuf.h
OdRxSystemServices::systemCodePage
virtual OdCodePageId systemCodePage() const =0
OdSmartPtr< OdRxDictionary >
OdRxSystemServices::getFileMTime
virtual OdInt64 getFileMTime(const OdString &filename)=0
FIRSTDLL_EXPORT_STATIC
#define FIRSTDLL_EXPORT_STATIC
Definition: RootExport.h:40
OdRxSystemServices::getFileSize
virtual OdInt64 getFileSize(const OdString &filename)=0
Oda::kShareDenyReadWrite
@ kShareDenyReadWrite
Definition: RxSystemServices.h:65
OdError_CantOpenFile::OdError_CantOpenFile
OdError_CantOpenFile(const OdString &filename)
OdRxSystemServices::findModule
virtual OdString findModule(const OdString &applicationName)
Oda::kShareDenyRead
@ kShareDenyRead
Definition: RxSystemServices.h:67
odrxSystemServices
FIRSTDLL_EXPORT OdRxSystemServices * odrxSystemServices()
OdError_InvalidIndex
Definition: RxSystemServices.h:154
OdError_FileWriteError::OdError_FileWriteError
OdError_FileWriteError(const OdString &filename)
OdError_FileException::OdError_FileException
OdError_FileException(OdResult code, const OdString &filename, const OdString &extended=OdString::kEmpty)
OdError_CantOpenFile
Definition: RxSystemServices.h:125
OdError_FileNotFound::OdError_FileNotFound
OdError_FileNotFound(const OdString &filename)
OdError_InvalidKey::OdError_InvalidKey
OdError_InvalidKey()
OdRxDictionary
Definition: RxDictionary.h:114
TD_PackPush.h
OdRxSystemServices::OdRxSystemServices
OdRxSystemServices()
Definition: RxSystemServices.h:183
OdError_FileException::getFileName
OdString getFileName() const
OdRxSystemServices::formatMessage
virtual OdString formatMessage(unsigned int formatId, va_list *argList=0)=0
OdRxSystemServices::getFileCTime
virtual OdInt64 getFileCTime(const OdString &filename)=0
Oda::FileCreationDisposition
FileCreationDisposition
Definition: RxSystemServices.h:73
OdRxSystemServices::loadModule
virtual OdRxModule * loadModule(const OdString &moduleFileName, bool silent)
OdError
Definition: OdError.h:43
OdRxSystemServices::warning
virtual void warning(const char *warnVisGroup, const OdString &message)
OdRxSystemServices::uninitModelerLibrary
virtual OdResult uninitModelerLibrary(OdRxDictionary *pDict)
OdRxModule
Definition: RxModule.h:45
Oda::kShareDenyWrite
@ kShareDenyWrite
Definition: RxSystemServices.h:66
OdGUID
Definition: OdGUID.h:29
OdString::kEmpty
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
Oda::kFileTmp
@ kFileTmp
Definition: RxSystemServices.h:59
OdRxSystemServices::createGuid
virtual OdString createGuid()
OdError_InvalidIndex::OdError_InvalidIndex
OdError_InvalidIndex()
OdRxSystemServices
Definition: RxSystemServices.h:180
Oda::kTruncateExisting
@ kTruncateExisting
Definition: RxSystemServices.h:78
Oda::FileShareMode
FileShareMode
Definition: RxSystemServices.h:64
OdRxDictionaryPtr
OdSmartPtr< OdRxDictionary > OdRxDictionaryPtr
Definition: RxSystemServices.h:40
OdRxSystemServices::warning
virtual void warning(const OdString &message)
Oda::FileAccessMode
FileAccessMode
Definition: RxSystemServices.h:55
OdRxSystemServices::initModelerLibrary
virtual OdResult initModelerLibrary(OdRxDictionary *pDict)
Oda::kCreateAlways
@ kCreateAlways
Definition: RxSystemServices.h:75