CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
RxSystemServices.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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
38class OdTimeStamp;
39class OdRxModule;
40class OdRxDictionary;
42
43#include "TD_PackPush.h"
44
49namespace 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 kNoFlushWhenClosed = 0x08000000 //do NOT call FlushFileBuffers when closing file (tremendously accelerates writing small files)
62 };
63
65 {
66 kShareDenyReadWrite = 0x10, // deny read/write mode
67 kShareDenyWrite = 0x20, // deny write mode
68 kShareDenyRead = 0x30, // deny read mode
69 kShareDenyNo = 0x40 // deny none mode
70 };
71
72
74 {
75 kCreateNew = 1, // Creates a new file; fails if the specified file already exists.
76 kCreateAlways = 2, // Creates a new file; overwrites any existing file.
77 kOpenExisting = 3, // Opens the file; fails if the file does not exist.
78 kOpenAlways = 4, // Opens the file; creates the file if it does not exist.
79 kTruncateExisting = 5 // Truncates the file; fails if the file does not exist. The file must be open at least kFileWrite.
80 };
81
83 {
84 kUserId = 1, //Current user id
85 kUserName = 2 //A "friendly" user name (for example, Jeff Smith).
86 };
87}
88
97{
98public:
102 OdError_FileException(OdResult code, const OdString& filename, const OdString& extended = OdString::kEmpty);
107};
108
117{
118public:
122};
123
132{
133public:
137};
138
147{
148public:
152};
153
161{
162public:
164};
165
173{
174public:
176};
177
187{
188public:
189
191 {
192#if defined _WIN32_WCE
193 srand(GetTickCount());
194#else
195 Od_srand((unsigned int) time(0));
196#endif
197 }
199
240 const OdString& filename,
244
262 virtual bool accessFile(const OdString& filename, int accessMode);
263
271 virtual OdInt64 getFileCTime(const OdString& filename) = 0;
272
280 virtual OdInt64 getFileMTime(const OdString& filename) = 0;
281
289 virtual OdInt64 getFileSize(const OdString& filename) = 0;
290
291
297 virtual OdString formatMessage(unsigned int formatId, va_list* argList= 0) = 0;
298
305 virtual OdString formatMsg(unsigned int formatId, ...);
306
310 virtual OdCodePageId systemCodePage() const = 0;
311
316
321
333 virtual OdRxModule* loadModule(const OdString& moduleFileName, bool silent);
334
340 virtual void unloadModule(OdRxModule* pModuleObj);
341
347 virtual OdString findModule(const OdString& applicationName);
348
354 virtual void warning(const OdString& message);
355
362 virtual void warning(const char* warnVisGroup, const OdString& message);
363
374 static OdRxModule* loadModuleLib(const OdString& moduleFileName, bool silent);
375
388
395 virtual OdResult getEnvVar(const OdString &varName, OdString &value) = 0;
396
403 virtual OdResult setEnvVar(const OdString &varName, const OdString &newValue) = 0;
404
408 virtual OdString getTemporaryPath() const;
409
414
419
420#if defined(_DEBUG) && defined(_WIN32)
421 static void dontFreeLibrary(std::vector<HMODULE>* notFreedDlls) { s_notFreedDlls = notFreedDlls; }
422private:
423 FIRSTDLL_EXPORT_STATIC static std::vector<HMODULE>* s_notFreedDlls;
424#endif
425};
430
432
433#include "TD_PackPop.h"
434
435#endif // #ifndef _ODRXSYSTEMSERVICES_INCLUDED_
OdCodePageId
Definition: OdCodePage.h:31
#define Od_srand
Definition: OdPlatform.h:147
OdResult
Definition: OdResult.h:29
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
#define FIRSTDLL_EXPORT_STATIC
Definition: RootExport.h:40
OdSmartPtr< OdRxSystemServices > OdRxSystemServicesPtr
FIRSTDLL_EXPORT OdRxSystemServices * odrxSystemServices()
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:33
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)
virtual OdString formatMessage(unsigned int formatId, va_list *argList=0)=0
virtual OdResult getEnvVar(const OdString &varName, OdString &value)=0
virtual void warning(const char *warnVisGroup, const OdString &message)
virtual OdString getUserName(Oda::UserNameFormat unFormat=Oda::kUserId)
virtual OdRxModule * loadModule(const OdString &moduleFileName, bool silent)
virtual OdInt64 getFileSize(const OdString &filename)=0
virtual void unloadModule(OdRxModule *pModuleObj)
virtual OdGUID createOdGUID()
virtual OdResult uninitModelerLibrary(OdRxDictionary *pDict)
virtual OdString getTemporaryPath() const
static OdRxModule * loadModuleLib(const OdString &moduleFileName, bool silent)
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 OdString createGuid()
virtual OdString formatMsg(unsigned int formatId,...)
virtual OdString findModule(const OdString &applicationName)
virtual OdString getTempFileName()
virtual OdInt64 getFileCTime(const OdString &filename)=0
virtual OdResult setEnvVar(const OdString &varName, const OdString &newValue)=0
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
Definition: TxDefs.h:49
@ kShareDenyRead
@ kShareDenyWrite
@ kShareDenyNo
@ kShareDenyReadWrite
FileCreationDisposition
@ kCreateNew
@ kOpenAlways
@ kCreateAlways
@ kTruncateExisting
@ kOpenExisting
@ kFileDelete
@ kFileWrite
@ kNoFlushWhenClosed