#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 36 of file StrCharStream.cpp.
|
|
Close this stream and release all resources used by it. Implements ACEXML_CharStream. Definition at line 44 of file StrCharStream.cpp. Referenced by ~ACEXML_StrCharStream().
|
|
Determine the encoding of the file. Definition at line 56 of file StrCharStream.cpp. References ACEXML_Char, ACEXML_Encoding::get_encoding(), and ACE::strnew(). Referenced by open(), and rewind().
00057 { 00058 if (this->start_ == 0) 00059 return -1; 00060 char input[4] = {0,0,0,0}; 00061 char* sptr = (char*)this->start_; 00062 int i = 0; 00063 for ( ; i < 4 && sptr != (char*)this->end_; ++sptr, ++i) 00064 input[i] = *sptr; 00065 const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input); 00066 if (!temp) 00067 return -1; 00068 else 00069 { 00070 if (this->encoding_) 00071 delete [] this->encoding_; 00072 this->encoding_ = ACE::strnew (temp); 00073 // ACE_DEBUG ((LM_DEBUG, "String's encoding is %s\n", this->encoding_)); 00074 } 00075 return 0; 00076 } |
|
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 86 of file StrCharStream.cpp. References ACEXML_Char.
|
|
Implements ACEXML_CharStream. Definition at line 120 of file StrCharStream.cpp.
00121 { 00122 return this->encoding_; 00123 } |
|
Implements ACEXML_CharStream. Definition at line 126 of file StrCharStream.cpp.
00127 { 00128 return this->name_; 00129 } |
|
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 && (this->start_ = ACE::strnew (str)) != 0 00026 && (this->name_ = ACE::strnew (name)) != 0) 00027 { 00028 this->ptr_ = this->start_; 00029 this->end_ = this->start_ + ACE_OS::strlen (this->start_); 00030 return this->determine_encoding(); 00031 } 00032 return -1; // Invalid string passed. 00033 } |
|
Peek the next ACEXML_Char in the CharStream. Return the character if succeess, -1 if EOS is reached. Implements ACEXML_CharStream. Definition at line 112 of file StrCharStream.cpp.
|
|
Read the next batch of ACEXML_Char strings Implements ACEXML_CharStream. Definition at line 97 of file StrCharStream.cpp. References ACEXML_Char, and ACE_OS::strncpy().
00098 { 00099 if (this->start_ != 0 && 00100 this->ptr_ != this->end_) 00101 { 00102 if (len * sizeof (ACEXML_Char) > (size_t) (this->end_ - this->ptr_)) 00103 len = this->end_ - this->ptr_; 00104 ACE_OS::strncpy (str, this->ptr_, len); 00105 this->ptr_ += len; 00106 return static_cast<int> (len); 00107 } 00108 return 0; 00109 } |
|
Resets the pointer to the beginning of the stream. Implements ACEXML_CharStream. Definition at line 79 of file StrCharStream.cpp. References determine_encoding().
00080 { 00081 this->ptr_ = this->start_; 00082 this->determine_encoding(); 00083 } |
|
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. |