#include <common/StrCharStream.h>
Inheritance diagram for ACEXML_StrCharStream:
Public Member Functions | |
ACEXML_StrCharStream (void) | |
Default constructor. | |
virtual | ~ACEXML_StrCharStream (void) |
Destructor. | |
int | open (const ACEXML_Char *str, const ACEXML_Char *name) |
Initializing StrCharStream with str and name. | |
virtual int | available (void) |
virtual int | close (void) |
virtual int | determine_encoding (void) |
virtual int | get (ACEXML_Char &ch) |
virtual int | read (ACEXML_Char *str, size_t len) |
virtual int | peek (void) |
virtual const ACEXML_Char * | getEncoding (void) |
virtual const ACEXML_Char * | getSystemId (void) |
virtual void | rewind (void) |
Private Attributes | |
ACEXML_Char * | start_ |
ACEXML_Char * | ptr_ |
ACEXML_Char * | end_ |
ACEXML_Char * | encoding_ |
ACEXML_Char * | name_ |
Definition at line 31 of file StrCharStream.h.
|
Default constructor.
Definition at line 9 of file StrCharStream.cpp.
|
|
Destructor.
Definition at line 15 of file StrCharStream.cpp. References close().
00016 { 00017 this->close(); 00018 } |
|
Returns the available ACEXML_Char in the buffer. -1 if the object is not initialized properly. Implements ACEXML_CharStream. Definition at line 40 of file StrCharStream.cpp.
|
|
Close this stream and release all resources used by it. Implements ACEXML_CharStream. Definition at line 48 of file StrCharStream.cpp. Referenced by ~ACEXML_StrCharStream().
|
|
Determine the encoding of the file. Definition at line 60 of file StrCharStream.cpp. References ACEXML_Char, ACEXML_Encoding::get_encoding(), and ACE::strnew(). Referenced by open(), and rewind().
00061 { 00062 if (this->start_ == 0) 00063 return -1; 00064 char input[4] = {0,0,0,0}; 00065 char* sptr = (char*)this->start_; 00066 int i = 0; 00067 for ( ; i < 4 && sptr != (char*)this->end_; ++sptr, ++i) 00068 input[i] = *sptr; 00069 const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input); 00070 if (!temp) 00071 return -1; 00072 else 00073 { 00074 delete [] this->encoding_; 00075 this->encoding_ = ACE::strnew (temp); 00076 // ACE_DEBUG ((LM_DEBUG, "String's encoding is %s\n", this->encoding_)); 00077 } 00078 return 0; 00079 } |
|
Read the next ACEXML_Char. Return -1 if we are not able to return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed. Implements ACEXML_CharStream. Definition at line 89 of file StrCharStream.cpp. References ACEXML_Char.
|
|
Implements ACEXML_CharStream. Definition at line 123 of file StrCharStream.cpp.
00124 { 00125 return this->encoding_; 00126 } |
|
Implements ACEXML_CharStream. Definition at line 129 of file StrCharStream.cpp.
00130 { 00131 return this->name_; 00132 } |
|
Initializing StrCharStream with str and name.
Definition at line 21 of file StrCharStream.cpp. References ACEXML_Char, determine_encoding(), ACE_OS::strlen(), and ACE::strnew(). Referenced by ACEXML_Parser::parse_entity_reference(), and ACEXML_Parser::parse_PE_reference().
00022 { 00023 00024 if (str != 0 && name != 0) 00025 { 00026 delete [] this->start_; 00027 if ((this->start_ = ACE::strnew (str)) == 0) 00028 return -1; 00029 delete [] this->name_; 00030 if ((this->name_ = ACE::strnew (name)) == 0) 00031 return -1; 00032 this->ptr_ = this->start_; 00033 this->end_ = this->start_ + ACE_OS::strlen (this->start_); 00034 return this->determine_encoding(); 00035 } 00036 return -1; // Invalid string passed. 00037 } |
|
Peek the next ACEXML_Char in the CharStream. Return the character if succeess, -1 if EOS is reached. Implements ACEXML_CharStream. Definition at line 115 of file StrCharStream.cpp.
|
|
Read the next batch of ACEXML_Char strings Implements ACEXML_CharStream. Definition at line 100 of file StrCharStream.cpp. References ACEXML_Char, and ACE_OS::strncpy().
00101 { 00102 if (this->start_ != 0 && 00103 this->ptr_ != this->end_) 00104 { 00105 if (len * sizeof (ACEXML_Char) > (size_t) (this->end_ - this->ptr_)) 00106 len = this->end_ - this->ptr_; 00107 ACE_OS::strncpy (str, this->ptr_, len); 00108 this->ptr_ += len; 00109 return static_cast<int> (len); 00110 } 00111 return 0; 00112 } |
|
Resets the pointer to the beginning of the stream. Implements ACEXML_CharStream. Definition at line 82 of file StrCharStream.cpp. References determine_encoding().
00083 { 00084 this->ptr_ = this->start_; 00085 this->determine_encoding(); 00086 } |
|
Definition at line 95 of file StrCharStream.h. |
|
Definition at line 94 of file StrCharStream.h. |
|
Definition at line 96 of file StrCharStream.h. |
|
Definition at line 93 of file StrCharStream.h. |
|
Definition at line 92 of file StrCharStream.h. |