3 //=============================================================================
5 * @file ZipCharStream.h
7 * @author Krishnakumar B <kitty@cs.wustl.edu>
9 //=============================================================================
11 #ifndef _ACEXML_ZIPCHARSTREAM_H_
12 #define _ACEXML_ZIPCHARSTREAM_H_
16 #include /**/ "ace/pre.h"
17 #include "ACEXML/common/ACEXML_Export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ACEXML/common/CharStream.h"
24 #include "ACEXML/common/Encoding.h"
25 #include "zzip/zzip.h"
27 // Ugly wart to get aroung a macro version of read defined in zzip.h. Evil...
33 * @class ACEXML_ZipCharStream
35 * An implementation of ACEXML_CharStream for reading input from a ZIP archive.
37 class ACEXML_Export ACEXML_ZipCharStream
: public ACEXML_CharStream
40 /// Default constructor.
41 ACEXML_ZipCharStream ();
44 virtual ~ACEXML_ZipCharStream ();
47 int open (const ACEXML_Char
*name
);
50 * Returns the available ACEXML_Char in the buffer. -1
51 * if the object is not initialized properly.
53 virtual int available ();
56 * Close this stream and release all resources used by it.
61 * Read the next ACEXML_Char. Return -1 if we are not able to
62 * return an ACEXML_Char, 0 if EOF is reached, or 1 if succeed.
64 virtual int get (ACEXML_Char
& ch
);
67 * Read the next batch of ACEXML_Char strings
69 virtual int read (ACEXML_Char
*str
, size_t len
);
72 * Determine the encoding of the file.
74 virtual int determine_encoding ();
78 * Peek the next ACEXML_Char in the CharStream. Return the
79 * character if success, -1 if EOF is reached.
84 * Resets the file pointer to the beginning of the stream.
86 virtual void rewind ();
89 * Get the character encoding for a byte stream or URI.
91 virtual const ACEXML_Char
*getEncoding ();
94 * Get the systemId for the underlying CharStream
96 virtual const ACEXML_Char
* getSystemId ();
99 /** Read the next character as a normal character. Return -1 if EOF is
100 * reached, else return 0.
102 virtual int getchar_i (char& ch
);
105 * Peek @c offset bytes into the stream and return the character at @c
106 * offset. If EOF is reached, return -1.
108 virtual int peekchar_i (ACE_OFF_T offset
= 0);
111 #if defined (ACE_USES_WCHAR)
113 * Read the next character from the stream taking into account the
114 * encoding of the file.
116 int get_i (ACEXML_Char
& ch
);
119 * Return the next character from the stream taking into account the
120 * encoding of the file. Subsequent call to get() returns this
125 #endif /* ACE_USES_WCHAR */
127 ACEXML_Char
* filename_
;
128 ACEXML_Char
* encoding_
;
136 #include /**/ "ace/post.h"
138 #endif /* USE_ZZIP */
140 #endif /* _ACEXML_ZIPCHARSTREAM_H_ */