GammaLib
2.0.0
|
String URL class. More...
#include <GUrlString.hpp>
Public Member Functions | |
GUrlString (void) | |
Void constructor. More... | |
GUrlString (const std::string &string) | |
Text string constructor. More... | |
GUrlString (const GUrlString &url) | |
Copy constructor. More... | |
virtual | ~GUrlString (void) |
Destructor. More... | |
GUrlString & | operator= (const GUrlString &url) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear string URL. More... | |
virtual GUrlString * | clone (void) const |
Clone string URL. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual void | open (const std::string &string, const std::string &mode="") |
Open string URL. More... | |
virtual void | close (void) |
Close file. More... | |
virtual int | read (void *buffer, const int &nbyte) |
Read block of data from string buffer. More... | |
virtual int | write (const void *buffer, const int &nbyte) |
Write block of data buffer into string. More... | |
virtual int | get_char (void) const |
Return next character from string. More... | |
virtual void | put_char (const int &character) |
Write character into string. More... | |
virtual void | scanf (const char *format,...) |
Read formatted data from string. More... | |
virtual void | printf (const char *format,...) |
Write formatted data into string. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print URL information. More... | |
const std::string & | string (void) const |
void | rewind (void) |
Public Member Functions inherited from GUrl | |
GUrl (void) | |
Void constructor. More... | |
GUrl (const GUrl &url) | |
Copy constructor. More... | |
virtual | ~GUrl (void) |
Destructor. More... | |
GUrl & | operator= (const GUrl &url) |
Assignment operator. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GUrlString &url) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GUrl | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GUrl &url) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
int | m_index |
String position indicator. More... | |
std::string | m_buffer |
Text string. More... | |
String URL class.
This class implements the URL interface for a string.
Definition at line 42 of file GUrlString.hpp.
GUrlString::GUrlString | ( | void | ) |
Void constructor.
Definition at line 57 of file GUrlString.cpp.
References init_members().
Referenced by clone().
GUrlString::GUrlString | ( | const std::string & | string | ) |
Text string constructor.
[in] | string | Text string. |
Constructs GUrlString object by assigning a text string
to the object's buffer.
Definition at line 75 of file GUrlString.cpp.
References init_members(), and open().
GUrlString::GUrlString | ( | const GUrlString & | url | ) |
Copy constructor.
[in] | url | Unified Resource Locator. |
Definition at line 93 of file GUrlString.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GUrl.
Definition at line 90 of file GUrlString.hpp.
|
virtual |
Clear string URL.
Implements GUrl.
Definition at line 164 of file GUrlString.cpp.
References GUrl::free_members(), free_members(), GUrl::init_members(), and init_members().
|
virtual |
Clone string URL.
Implements GUrl.
Definition at line 184 of file GUrlString.cpp.
References GUrlString().
|
virtual |
Close file.
Implements GUrl.
Definition at line 214 of file GUrlString.cpp.
References m_buffer, and m_index.
Referenced by free_members(), GXml::GXml(), and open().
|
protected |
Copy class members.
[in] | url | URL. |
Definition at line 543 of file GUrlString.cpp.
References m_buffer, and m_index.
Referenced by GUrlString(), and operator=().
|
protected |
Delete class members.
Definition at line 557 of file GUrlString.cpp.
References close().
Referenced by clear(), operator=(), and ~GUrlString().
|
virtual |
Return next character from string.
Returns the character currently pointed by the internal position indicator. The internal position indicator is then advanced to the next character.
If the indicator is at the end of the string when called, the function returns EOF.
If no string exists, the method returns EOF.
Implements GUrl.
Definition at line 351 of file GUrlString.cpp.
|
protected |
Initialise class members.
Definition at line 527 of file GUrlString.cpp.
References m_buffer, and m_index.
Referenced by clear(), GUrlString(), and operator=().
|
virtual |
Open string URL.
[in] | string | Text string. |
[in] | mode | Mode parameter (ignored). |
Implements GUrl.
Definition at line 197 of file GUrlString.cpp.
References close(), m_buffer, m_index, and string().
Referenced by GUrlString().
GUrlString & GUrlString::operator= | ( | const GUrlString & | url | ) |
Assignment operator.
[in] | url | Unified Resource Locator. |
Definition at line 131 of file GUrlString.cpp.
References copy_members(), free_members(), init_members(), and GUrl::operator=().
Print URL information.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GUrl.
Definition at line 492 of file GUrlString.cpp.
References m_buffer, m_index, gammalib::parformat(), SILENT, and gammalib::str().
|
virtual |
Write formatted data into string.
[in] | format | Format. |
[in] | ... | Optional parameters. |
Writes the C string pointed by format to the string. If format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers.
After the format parameter, the function expects at least as many additional arguments as specified by format.
Implements GUrl.
Definition at line 451 of file GUrlString.cpp.
|
virtual |
Write character into string.
[in] | character | Character. |
Writes a character to the string and advances the position indicator.
Implements GUrl.
Definition at line 380 of file GUrlString.cpp.
|
virtual |
Read block of data from string buffer.
[in] | buffer | Data buffer. |
[in] | nbyte | Number of Bytes to be read. |
Reads nbyte
Bytes from the string into a buffer
. The position indicator of the string is advanced by the total amount of bytes read.
The total number of Bytes successfully read is returned. If this number differs from the nbyte
parameter, the end of the string was reached. The proper indicator is set.
If either buffer
is NULL or nbyte
is zero, the method returns zero and both the string state and the content pointed by buffer
remain unchanged.
If no string exists, the method returns zero and both the string state and the content pointed by buffer
remain unchanged.
Implements GUrl.
Definition at line 248 of file GUrlString.cpp.
|
inline |
Definition at line 70 of file GUrlString.hpp.
References m_index.
|
virtual |
Read formatted data from string.
[in] | format | Format. |
[in] | ... | Optional parameters. |
Reads data from a string and stores them according to the parameter format into the locations pointed by the additional arguments. The additional arguments should point to already allocated objects of the type specified by their corresponding format specifier within the format string.
If no string exists, the method does nothing.
Implements GUrl.
Definition at line 409 of file GUrlString.cpp.
|
inline |
|
virtual |
Write block of data buffer into string.
[in] | buffer | Data buffer. |
[in] | nbyte | Number of Bytes to be written. |
Writes nbyte
Bytes from a buffer
into the string. The position indicator of the string is advanced by the total amount of bytes written.
The total number of Bytes successfully written is returned.
If either buffer
is NULL or nbyte
is zero, the method returns zero and both the string state and the content pointed by buffer
remain unchanged.
Implements GUrl.
Definition at line 305 of file GUrlString.cpp.
|
protected |
Text string.
Definition at line 80 of file GUrlString.hpp.
Referenced by close(), copy_members(), get_char(), init_members(), open(), print(), printf(), put_char(), read(), scanf(), string(), and write().
|
mutableprotected |
String position indicator.
Definition at line 79 of file GUrlString.hpp.
Referenced by close(), copy_members(), get_char(), init_members(), open(), print(), printf(), put_char(), read(), rewind(), scanf(), and write().