1 //---------------------------------------------------------------
2 //
3 // For conditions of distribution and use, see copyright notice
4 // in Flashpix.h
5 //
6 // Copyright (c) 1999 Digital Imaging Group, Inc.
7 //
8 // Contents: Implementations of CDocFile stream methods
9 //
10 //---------------------------------------------------------------
11
12 #include "dfhead.cxx"
13 #include "h/sstream.hxx"
14
15 //+--------------------------------------------------------------
16 //
17 // Method: CDocFile::CreateStream, public
18 //
19 // Synopsis: Creates a named stream in a DocFile
20 //
21 // Arguments: [pwcsName] - Name of the stream
22 // [df] - Transactioning flags
23 // [dlSet] - LUID to set or DF_NOLUID
24 // [ppstStream] - Pointer to storage for the stream pointer
25 //
26 // Returns: Appropriate error code
27 //
28 // Modifies: [ppstStream]
29 //
30 //---------------------------------------------------------------
31
32
CreateStream(CDfName const * pdfn,DFLAGS const df,DFLUID dlSet,CDirectStream ** ppstStream)33 SCODE CDocFile::CreateStream(CDfName const *pdfn,
34 DFLAGS const df,
35 DFLUID dlSet,
36 CDirectStream **ppstStream)
37 {
38 SCODE sc;
39 CDirectStream *pstm;
40
41 olDebugOut((DEB_ITRACE, "In CDocFile::CreateStream("
42 "%ws, %X, %lu, %p)\n",
43 pdfn, df, dlSet, ppstStream));
44 UNREFERENCED_PARM(df);
45
46 if (dlSet == DF_NOLUID)
47 dlSet = CDirectStream::GetNewLuid();
48 olMem(pstm = new CDirectStream(dlSet));
49 olChkTo(EH_pstm, pstm->Init(&_stgh, pdfn, TRUE));
50
51 *ppstStream = pstm;
52 olDebugOut((DEB_ITRACE, "Out CDocFile::CreateStream => %p\n",
53 *ppstStream));
54 return S_OK;
55
56 EH_pstm:
57 delete pstm;
58 EH_Err:
59 return sc;
60 }
61
62 //+--------------------------------------------------------------
63 //
64 // Method: CDocFile::GetStream, public
65 //
66 // Synopsis: Retrieves an existing stream from a DocFile
67 //
68 // Arguments: [pwcsName] - Name of the stream
69 // [df] - Transactioning flags
70 // [dwType] - Type of entry
71 // [ppstStream] - Pointer to storage for the stream pointer
72 //
73 // Returns: Appropriate error code
74 //
75 // Modifies: [ppstStream]
76 //
77 //---------------------------------------------------------------
78
79
80
GetStream(CDfName const * pdfn,DFLAGS const df,CDirectStream ** ppstStream)81 SCODE CDocFile::GetStream(CDfName const *pdfn,
82 DFLAGS const df,
83 CDirectStream **ppstStream)
84 {
85 SCODE sc;
86 CDirectStream *pstm;
87
88 olDebugOut((DEB_ITRACE, "In CDocFile::GetStream(%ws, %X, %p)\n",
89 pdfn, df, ppstStream));
90 UNREFERENCED_PARM(df);
91
92 DFLUID dl = CDirectStream::GetNewLuid();
93 olMem(pstm = new CDirectStream(dl));
94
95 olChkTo(EH_pstm, pstm->Init(&_stgh, pdfn, FALSE));
96 *ppstStream = pstm;
97 olDebugOut((DEB_ITRACE, "Out CDocFile::GetStream => %p\n",
98 *ppstStream));
99 return S_OK;
100
101 EH_pstm:
102 delete pstm;
103 EH_Err:
104 return sc;
105 }
106
107
108
109