CFx SDK Documentation  2022 SP0
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_
OdCodePageId
Definition: OdCodePage.h:31
#define Od_srand
Definition: OdPlatform.h:136
OdResult
Definition: OdResult.h:29
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
#define FIRSTDLL_EXPORT_STATIC
Definition: RootExport.h:40
FIRSTDLL_EXPORT OdRxSystemServices * odrxSystemServices()
OdSmartPtr< OdRxSystemServices > OdRxSystemServicesPtr
OdSmartPtr< OdRxDictionary > OdRxDictionaryPtr
OdError_CantOpenFile(const OdString &filename)
OdString getFileName() const
OdError_FileException(OdResult code, const OdString &filename, const OdString &extended=OdString::kEmpty)
OdError_FileNotFound(const OdString &filename)
OdError_FileWriteError(const OdString &filename)
Definition: OdGUID.h:29
Definition: Int64.h:43
virtual OdCodePageId systemCodePage() const =0
virtual OdStreamBufPtr createFile(const OdString &filename, Oda::FileAccessMode accessMode=Oda::kFileRead, Oda::FileShareMode shareMode=Oda::kShareDenyNo, Oda::FileCreationDisposition creationDisposition=Oda::kOpenExisting)
static OdRxModule * loadModuleLib(const OdString &moduleFileName, bool silent)
virtual OdString formatMessage(unsigned int formatId, va_list *argList=0)=0
virtual void warning(const char *warnVisGroup, const OdString &message)
virtual OdInt64 getFileSize(const OdString &filename)=0
virtual void unloadModule(OdRxModule *pModuleObj)
virtual OdGUID createOdGUID()
virtual OdResult uninitModelerLibrary(OdRxDictionary *pDict)
virtual void warning(const OdString &message)
virtual bool accessFile(const OdString &filename, int accessMode)
virtual OdResult initModelerLibrary(OdRxDictionary *pDict)
virtual OdInt64 getFileMTime(const OdString &filename)=0
virtual OdRxModule * loadModule(const OdString &moduleFileName, bool silent)
virtual OdString createGuid()
virtual OdString formatMsg(unsigned int formatId,...)
virtual OdString findModule(const OdString &applicationName)
virtual OdInt64 getFileCTime(const OdString &filename)=0
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
Definition: TxDefs.h:48
@ kShareDenyRead
@ kShareDenyWrite
@ kShareDenyNo
@ kShareDenyReadWrite
FileCreationDisposition
@ kCreateNew
@ kOpenAlways
@ kCreateAlways
@ kTruncateExisting
@ kOpenExisting
@ kFileDelete
@ kFileWrite