CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
OdStreamBuf.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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
26
27#ifndef ODSTREAMBUF_DEFINED
28#define ODSTREAMBUF_DEFINED
29
30#if !defined( FX_PREVIEW )
31#include "RxObject.h"
32
33#include "TD_PackPush.h"
34
35class OdString;
36#else
37#include <stdio.h>
38#include <string>
39#include "OdPlatformSettings.h"
40#endif
41
42namespace Oda
43{
45
46
47 enum FileAccessMode // Access
48 {
49 kFileRead = (long)
50 0x80000000, // Read access. Use kFileRead | kFileWrite for read/write access.
51 kFileWrite = 0x40000000, // Write access. Use kFileRead | kFileWrite for read/write access.
52 kFileTmp = 0x20000000, // hint to use FILE_ATTRIBUTE_TEMPORARY for 'FlagsAndAttributes'
53 kFileDelete = 0x10000000, // hint to use FILE_FLAG_DELETE_ON_CLOSE for 'FlagsAndAttributes'
54 kNoFlushWhenClosed = 0x08000000, //do NOT call FlushFileBuffers when closing file (tremendously accelerates writing small files)
55 kFileReadWrite = kFileRead | kFileWrite // Read/Write access.
56 };
57
58#if !defined( FX_PREVIEW )
60#else
62#endif
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}
82
87namespace OdDb
88{
90 {
91 kSeekFromStart = SEEK_SET, // Start of file.
92 kSeekFromCurrent = SEEK_CUR, // Current position of file pointer.
93 kSeekFromEnd = SEEK_END // End of file.
94 };
95}
96
103#if !defined( FX_PREVIEW )
104class FIRSTDLL_EXPORT OdStreamBuf : public OdRxObject
105#else
106class OdStreamBuf
107#endif
108{
109protected:
111public:
112#if !defined( FX_PREVIEW )
114#endif
115
119#if !defined( FX_PREVIEW )
121#else
122 virtual std::wstring fileName();
123#endif
124
129 virtual bool isEof();
134 virtual OdUInt64 tell();
139 virtual OdUInt64 length();
140
145 virtual void truncate();
150 virtual void rewind();
169
174 virtual OdUInt8 getByte();
181 virtual void getBytes(void* buffer, OdUInt32 numBytes);
182
188 virtual void putByte(OdUInt8 value);
195 virtual void putBytes(const void* buffer, OdUInt32 numBytes);
196
205 virtual void copyDataTo(OdStreamBuf* pDestination, OdUInt64 sourceStart = 0, OdUInt64 sourceEnd = 0);
221
237};
238
241#if !defined( FX_PREVIEW )
243
244#include "TD_PackPop.h"
245#endif
246
247#endif //ODSTREAMBUF_DEFINED
248
OdSmartPtr< OdStreamBuf > OdStreamBufPtr
unsigned int OdUInt32
unsigned char OdUInt8
#define FIRSTDLL_EXPORT
Definition RootExport.h:39
virtual OdUInt8 getByte()
ODRX_DECLARE_MEMBERS(OdStreamBuf)
virtual void rewind()
virtual OdUInt64 tell()
virtual Oda::FileShareMode getShareMode() const
virtual OdString fileName()
virtual OdUInt64 length()
virtual void getBytes(void *buffer, OdUInt32 numBytes)
virtual void truncate()
virtual bool isEof()
virtual void copyDataTo(OdStreamBuf *pDestination, OdUInt64 sourceStart=0, OdUInt64 sourceEnd=0)
virtual OdUInt32 getShareMode()
virtual OdUInt64 seek(OdInt64 offset, OdDb::FilerSeekType seekType)
virtual void putByte(OdUInt8 value)
virtual void putBytes(const void *buffer, OdUInt32 numBytes)
GLuint buffer
Definition gles2_ext.h:178
GLintptr offset
Definition gles2_ext.h:183
GLsizei const GLfloat * value
Definition gles2_ext.h:302
FilerSeekType
Definition OdStreamBuf.h:90
@ kSeekFromCurrent
Definition OdStreamBuf.h:92
@ kSeekFromStart
Definition OdStreamBuf.h:91
@ kSeekFromEnd
Definition OdStreamBuf.h:93
Definition TxDefs.h:49
FileShareMode
Definition OdStreamBuf.h:65
@ kShareDenyRead
Definition OdStreamBuf.h:68
@ kShareDenyWrite
Definition OdStreamBuf.h:67
@ kShareDenyNo
Definition OdStreamBuf.h:69
@ kShareDenyReadWrite
Definition OdStreamBuf.h:66
FileAccessMode FIRSTDLL_EXPORT operator|(const FileAccessMode &a, const FileAccessMode &b)
FileCreationDisposition
Definition OdStreamBuf.h:74
@ kCreateNew
Definition OdStreamBuf.h:75
@ kOpenAlways
Definition OdStreamBuf.h:78
@ kCreateAlways
Definition OdStreamBuf.h:76
@ kTruncateExisting
Definition OdStreamBuf.h:79
@ kOpenExisting
Definition OdStreamBuf.h:77
FileAccessMode
Definition OdStreamBuf.h:48
@ kFileDelete
Definition OdStreamBuf.h:53
@ kFileReadWrite
Definition OdStreamBuf.h:55
@ kFileWrite
Definition OdStreamBuf.h:51
@ kNoFlushWhenClosed
Definition OdStreamBuf.h:54
@ kFileRead
Definition OdStreamBuf.h:49
@ kFileTmp
Definition OdStreamBuf.h:52