OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
ocstorag.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright 1994, 1996 by Borland International, All Rights Reserved
4/// \file
5/// Definition of TOcStorage & TOcStream classes
6//----------------------------------------------------------------------------
7
8#if !defined(OCF_OCSTORAG_H)
9#define OCF_OCSTORAG_H
10
11#include <owl/private/defs.h>
12#include <owl/private/number.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <ocf/defs.h>
18#include <ocf/ocbocole.h>
19
20
21//
22// Classes referenced
23//
25interface _ICLASS IStorage;
26interface _ICLASS IStream;
29
30namespace ocf {
31
32//
33// Classes defined
34//
37
38//
39// class TOcStream
40// ~~~~~ ~~~~~~~~~
42 public:
43 TOcStream(TOcStorage& storage, LPCTSTR name, bool create,
44 owl::uint32 mode = STGM_READWRITE);
45 TOcStream(TOcStream& stream);
46 TOcStream(IStream* stream);
47 ~TOcStream();
48
49 IStream* GetIStream();
50
51 HRESULT Read(void * pv, owl::ulong cb, owl::ulong * read = 0);
52 HRESULT Write(void const * pv, owl::ulong cb, owl::ulong * written = 0);
53 HRESULT Seek(owl::int64 move, owl::uint32 origin= STREAM_SEEK_SET,
54 owl::uint64 * newPosition = 0);
55 HRESULT SetSize(owl::uint64 newSize);
56 HRESULT CopyTo(TOcStream& stream, owl::uint64 cb, owl::uint64 * read = 0,
57 owl::uint64 * written = 0);
58 HRESULT Commit(owl::uint32 commitFlags);
59 HRESULT Revert();
60 HRESULT LockRegion(owl::uint64 offset, owl::uint64 cb, owl::uint32 lockType);
61 HRESULT UnlockRegion(owl::uint64 offset, owl::uint64 cb, owl::uint32 lockType);
62 HRESULT Stat(STATSTG * statstg, owl::uint32 statFlag);
63
64 protected:
65 HRESULT Clone(IStream * * ppstm);
66
68};
69
70//
71// class TOcStorage
72// ~~~~~ ~~~~~~~~~~
74 public:
75 TOcStorage(LPCTSTR fileName, bool create,
76 owl::uint32 mode = STGM_READWRITE|STGM_TRANSACTED);
77 TOcStorage(ILockBytes * lkbyt, bool create,
78 owl::uint32 mode = STGM_READWRITE|STGM_TRANSACTED);
79 TOcStorage(TOcStorage& parent, LPCTSTR name, bool create,
80 owl::uint32 mode = STGM_READWRITE);
81 TOcStorage(IStorage* storage);
83
84 IStorage* GetIStorage();
85
86 HRESULT CopyTo(owl::uint32 ciidExclude, IID const * rgiidExclude,
87 SNB snbExclude, TOcStorage& dest);
88 HRESULT MoveElementTo(LPCTSTR name, TOcStorage& dest,
89 LPCTSTR newName, owl::uint32 grfFlags);
90 HRESULT Commit(owl::uint32 grfCommitFlags);
91 HRESULT Revert();
92 HRESULT EnumElements(owl::uint32 reserved1, void * reserved2,
93 owl::uint32 reserved3, IEnumSTATSTG ** ppenm);
94 HRESULT DestroyElement(LPCTSTR name);
95 HRESULT RenameElement(LPCTSTR oldName, LPCTSTR newName);
96 HRESULT SetElementTimes(LPCTSTR name, FILETIME const * pctime,
97 FILETIME const * patime,
98 FILETIME const * pmtime);
99 HRESULT SetClass(const IID & clsid);
100 HRESULT SetStateBits(owl::uint32 grfStateBits, owl::uint32 grfMask);
101 HRESULT Stat(STATSTG *pstatstg, owl::uint32 grfStatFlag);
102
103 HRESULT SwitchToFile(LPCTSTR newPath);
104
105 static HRESULT IsStorageFile(LPCTSTR pwcsName);
106 static HRESULT IsStorageILockBytes(ILockBytes * plkbyt);
107 static HRESULT SetTimes(LPCTSTR lpszName,
108 FILETIME const * pctime,
109 FILETIME const * patime,
110 FILETIME const * pmtime);
111
112 protected:
113 HRESULT CreateStream(LPCTSTR name, owl::uint32 mode, owl::uint32 rsrvd1,
114 owl::uint32 rsrvd2, IStream * * stream);
115 HRESULT OpenStream(LPCTSTR name, void *rsrvd1, owl::uint32 grfMode,
116 owl::uint32 rsrvd2, IStream * *stream);
117 HRESULT CreateStorage(LPCTSTR name, owl::uint32 mode, owl::uint32 rsrvd1,
118 owl::uint32 rsrvd2, IStorage ** storage);
119 HRESULT OpenStorage(LPCTSTR name, IStorage * stgPriority,
120 owl::uint32 mode, SNB snbExclude, owl::uint32 rsrvd,
121 IStorage ** storage);
122 owl::ulong AddRef();
123 owl::ulong Release();
124
125#if 0 // not currently implemented
126// TOcStorage* GetParent() const {return Parent;}
127// int GetOpenMode() const {return OpenMode;}
128// void SetOpenMode(int mode) const {OpenMode = mode;}
129
130 protected:
131// int ThisOpen; // actual mode bits used for opening storage
132
133 private:
134// int OpenMode; // mode and protection flags
135// int OpenCount;
136// TOcStorage* Parent;
137#endif
139
140 friend TOcStream;
141};
142
143} // OCF namespace
144
145#endif // OCF_OCSTORAG_H
IStorage * StorageI
Definition ocstorag.h:138
friend TOcStream
Definition ocstorag.h:140
IStream * StreamI
Definition ocstorag.h:67
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
__int64 int64
Definition number.h:36
unsigned long ulong
Definition number.h:26
unsigned long uint32
Definition number.h:34
unsigned __int64 uint64
Definition number.h:43
ObjectComponents BOcOle engine linking & embedding interfaces.
interface _ICLASS IStorage
Definition ocdoc.h:25
ObjectComponents fundamental definitions.
#define _OCFCLASS
Definition defs.h:45
interface _ICLASS ILockBytes
Definition ocstorag.h:27
interface _ICLASS IRootStorage
Definition ocstorag.h:24
interface _ICLASS IStream
Definition ocstorag.h:26
interface _ICLASS IStorage
Definition ocstorag.h:25
interface _ICLASS IEnumSTATSTG
Definition ocstorag.h:28
#define _ICLASS
Definition oleutil.h:25