Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / ACEXML / common / ZipCharStream.h
blob3940583088eef400e7f9caec490b7fcbf4d7524e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file ZipCharStream.h
7 * @author Krishnakumar B <kitty@cs.wustl.edu>
8 */
9 //=============================================================================
11 #ifndef _ACEXML_ZIPCHARSTREAM_H_
12 #define _ACEXML_ZIPCHARSTREAM_H_
14 #ifdef USE_ZZIP
16 #include /**/ "ace/pre.h"
17 #include "ACEXML/common/ACEXML_Export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #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...
28 #ifdef read
29 #undef read
30 #endif
32 /**
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
39 public:
40 /// Default constructor.
41 ACEXML_ZipCharStream ();
43 /// Destructor
44 virtual ~ACEXML_ZipCharStream ();
46 /// Open a file.
47 int open (const ACEXML_Char *name);
49 /**
50 * Returns the available ACEXML_Char in the buffer. -1
51 * if the object is not initialized properly.
53 virtual int available ();
55 /**
56 * Close this stream and release all resources used by it.
58 virtual int close ();
60 /**
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);
66 /**
67 * Read the next batch of ACEXML_Char strings
69 virtual int read (ACEXML_Char *str, size_t len);
71 /**
72 * Determine the encoding of the file.
74 virtual int determine_encoding ();
77 /**
78 * Peek the next ACEXML_Char in the CharStream. Return the
79 * character if success, -1 if EOF is reached.
81 virtual int peek ();
83 /**
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 ();
98 protected:
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);
110 private:
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
121 * character.
123 int peek_i ();
125 #endif /* ACE_USES_WCHAR */
127 ACEXML_Char* filename_;
128 ACEXML_Char* encoding_;
129 ACE_OFF_T size_;
130 ZZIP_FILE* infile_;
131 char buf_[80];
132 int pos_;
133 int limit_;
136 #include /**/ "ace/post.h"
138 #endif /* USE_ZZIP */
140 #endif /* _ACEXML_ZIPCHARSTREAM_H_ */