LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::url::serviceHandler Class Reference

This is an abstract base class for handling a kind of data service. More...

#include <ltiURL.h>

Inheritance diagram for lti::url::serviceHandler:
Inheritance graph
[legend]
Collaboration diagram for lti::url::serviceHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual bool getDate (std::string &date)=0
virtual bool getContentType (std::string &type)=0
virtual bool getContentLength (int &size)=0
virtual bool getDataStream (std::ifstream *&i)=0
const char * getStatusString () const
bool isOk ()

Protected Member Functions

 serviceHandler (url &u)
std::ifstream * getIn ()
std::ofstream * getOut ()
SOCKET getSocket ()
void setStatusString (const char *msg, const char *msg2=0)

Detailed Description

This is an abstract base class for handling a kind of data service.

It contains methods for initiating a connection given an url and get the most important meta data. A certain service handler is created by subclassing this class. At present, there is only a HTTP handler which is buried in the implementation.


Constructor & Destructor Documentation

lti::url::serviceHandler::serviceHandler ( url u  )  [protected]

Constructor.

Subclasses must call this constructor in order to set the URL for which this handler is used.


Member Function Documentation

virtual bool lti::url::serviceHandler::getContentLength ( int &  size  )  [pure virtual]

Gets the length of the document which is described by the URL.

Parameters:
size will receive the size of the document in bytes. If this value is below zero, it means that the size is unknown.
Returns:
true if the size could be retrieved successfully, false otherwise.
virtual bool lti::url::serviceHandler::getContentType ( std::string &  type  )  [pure virtual]

Gets the MIME type description of the document which is described by the URL.

Parameters:
type will receive the type description in standard MIME notation
Returns:
true if the type could be retrieved successfully, false otherwise.
virtual bool lti::url::serviceHandler::getDataStream ( std::ifstream *&  i  )  [pure virtual]

Gets a pointer to an input stream which can be used for retrieving the data.

Returns:
true if the stream could be created successfully, false otherwise.
virtual bool lti::url::serviceHandler::getDate ( std::string &  date  )  [pure virtual]

Gets the date of the server reply, may be empty.

Parameters:
date will receive the date in standard ASCII notation
Returns:
true if the date could be retrieved successfully, false otherwise.
std::ifstream* lti::url::serviceHandler::getIn (  )  [inline, protected]

Returns the input stream for the URL which is handled by this object.

std::ofstream* lti::url::serviceHandler::getOut (  )  [inline, protected]

Returns the output stream for the URL which is handled by this object.

SOCKET lti::url::serviceHandler::getSocket (  )  [inline, protected]

Returns the socket used to send/receive bytes (only for windows).

const char* lti::url::serviceHandler::getStatusString (  )  const

return the last message set with setStatusString().

This will never return 0. If no status-string has been set yet an empty string (pointer to a string with only the char(0)) will be returned.

bool lti::url::serviceHandler::isOk (  )  [inline]

Returns true if the handler's state is in order and meta-data can be inquired.

void lti::url::serviceHandler::setStatusString ( const char *  msg,
const char *  msg2 = 0 
) [protected]

set a status string.

Parameters:
msg the const string to be reported next time by getStatusString(). The given string will be copied. This message will be usually set within the apply methods to indicate an error cause.
msg2 another message string, which is simply appended to the first one.

The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:28:53 2010 for LTI-Lib by Doxygen 1.6.1