1 /*  NAME:
2         E3IO.h
3 
4     DESCRIPTION:
5         Header file for E3IO.c.
6 
7     COPYRIGHT:
8         Copyright (c) 1999-2005, Quesa Developers. All rights reserved.
9 
10         For the current release of Quesa, please see:
11 
12             <http://www.quesa.org/>
13 
14         Redistribution and use in source and binary forms, with or without
15         modification, are permitted provided that the following conditions
16         are met:
17 
18             o Redistributions of source code must retain the above copyright
19               notice, this list of conditions and the following disclaimer.
20 
21             o Redistributions in binary form must reproduce the above
22               copyright notice, this list of conditions and the following
23               disclaimer in the documentation and/or other materials provided
24               with the distribution.
25 
26             o Neither the name of Quesa nor the names of its contributors
27               may be used to endorse or promote products derived from this
28               software without specific prior written permission.
29 
30         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31         "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32         LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33         A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34         OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
36         TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37         PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38         LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39         NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40         SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41     ___________________________________________________________________________
42 */
43 #ifndef E3IO_HDR
44 #define E3IO_HDR
45 //=============================================================================
46 //      Include files
47 //-----------------------------------------------------------------------------
48 #include "QuesaIO.h"
49 #include "E3Main.h"
50 
51 
52 
53 
54 //=============================================================================
55 //		C++ preamble
56 //-----------------------------------------------------------------------------
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 
62 
63 
64 
65 //=============================================================================
66 //      Constants
67 //-----------------------------------------------------------------------------
68 enum TE3FileStatus {
69 	kE3_File_Status_Closed     = 0L,
70 	kE3_File_Status_Reading,
71 	kE3_File_Status_Writing
72 };
73 
74 typedef enum TE3FileStatus TE3FileStatus;
75 
76 enum TE3FileReason {
77 	kE3_File_Reason_OK         = 0L,
78 	kE3_File_Reason_Cancelled
79 };
80 
81 typedef enum TE3FileReason TE3FileReason;
82 
83 
84 
85 
86 
87 //=============================================================================
88 //      Types
89 //-----------------------------------------------------------------------------
90 // NB - the mode field is really the format type. For the 3DMF format
91 // the type is hard-coded.
92 typedef struct TE3FileData {
93 	TQ3StorageObject		storage;
94 	TQ3FileFormatObject		format;
95 	TQ3FileMode				mode;
96 
97 	TE3FileStatus			status;
98 	TE3FileReason			reason;
99 
100 	TQ3FileIdleMethod		idleMethod;
101 	const void*				idleData;
102 } TE3FileData;
103 
104 
105 
106 
107 class E3File : public E3Shared
108 	{
109 Q3_CLASS_ENUMS ( kQ3SharedTypeFile, E3File, E3Shared )
110 
111 	TE3FileData				instanceData ;
112 
113 public :
114 	void					CallIdle ( void ) ;
115 
116 	TQ3Status				GetStorage ( TQ3StorageObject* storage ) ;
117 	TQ3Status				SetStorage ( TQ3StorageObject storage ) ;
118 	TQ3Status				OpenRead ( TQ3FileMode* mode ) ;
119 	TQ3Status				OpenWrite ( TQ3FileMode mode ) ;
120 	TQ3Status				IsOpen ( TQ3Boolean* isOpen ) ;
121 	TQ3Status				GetMode ( TQ3FileMode* mode ) ;
122 	TQ3Status				GetVersion ( TQ3FileVersion *version ) ;
123 	TQ3Status				Close ( void ) ;
124 	TQ3Status				Cancel ( void ) ;
125 	TQ3ObjectType			GetNextObjectType ( void ) ;
126 	TQ3Boolean				IsNextObjectOfType ( TQ3ObjectType ofType ) ;
127 	TQ3Object				ReadObject ( void ) ;
128 	TQ3Status				SkipObject ( void ) ;
129 	TQ3Boolean				IsEndOfData ( void ) ;
130 	TQ3Boolean				IsEndOfContainer ( TQ3Object rootObject ) ;
131 	TQ3Boolean				IsEndOfFile ( void ) ;
132 	TQ3Status				SetReadInGroup ( TQ3FileReadGroupState readGroupState ) ;
133 	TQ3Status				GetReadInGroup ( TQ3FileReadGroupState* readGroupState ) ;
134 	TQ3Status				SetIdleMethod ( TQ3FileIdleMethod idle, const void* idleData ) ;
135 	TQ3FileFormatObject		GetFileFormat ( void ) ;
136 	TE3FileStatus			GetFileStatus ( void ) ;
137 
138 	friend TQ3Status		e3file_format_attach ( E3File* theFile,TQ3FileFormatObject theFileFormat ) ;
139 	} ;
140 
141 
142 
143 
144 //=============================================================================
145 //      Function prototypes
146 //-----------------------------------------------------------------------------
147 TQ3Status			E3File_RegisterClass(void);
148 TQ3Status			E3File_UnregisterClass(void);
149 
150 TQ3FileObject		E3File_New(void);
151 
152 TQ3Status			E3File_MarkAsExternalReference(TQ3FileObject theFile, TQ3SharedObject sharedObject);
153 TQ3GroupObject		E3File_GetExternalReferences(TQ3FileObject theFile);
154 
155 
156 
157 
158 
159 //=============================================================================
160 //		C++ postamble
161 //-----------------------------------------------------------------------------
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif
167 
168