Url Class Reference

URL Class, works with file urls, and also with rtsp or http. <short description="">. More...

#include <Url.hpp>

List of all members.


Public Member Functions

 Url (const char *url)
int getPort () const
void setPort (int port)
const char * getPath () const
 returns the path of the url incl.
const char * getFileName () const
const char * getServerName () const
const char * getProtocol () const
 returns the protocol without the ://, e.g.
const char * toString () const
 builds an url.
bool isEqual (const Url *url, bool ignoreServerName=false) const
 an url is equal if servername and path are equal
bool hasServerName () const
bool hasPort () const
bool hasPath () const
bool hasProtocol () const

Static Public Member Functions

char * transformUrlToLocalFile (const Url *)
char * transformPathToLocalFile (const Url *)
bool convertUrlToSocket (const char *serverName, const int port, struct sockaddr_in *outSockStruct, int &outSocket)
 converts an url to an already connected UDP socket
void doTest ()
 automatically tests Url class for bugs, throws assertion if any is found

Detailed Description

URL Class, works with file urls, and also with rtsp or http. <short description="">.

Note that NO RELATIVE PATHS are allowed in a file url, this must be a full path in the form of e:\ or e:/ or /path An Url is composed of several fields: protocol://serverName[:port][/][path] port and path are optional. If no protocol is specified, file:// is assumed

Author:
Michael Kropfberger and Peter Schojer
Version:
Id
Url.hpp,v 1.10 2006/02/24 13:24:39 mkropfbe Exp

Definition at line 63 of file Url.hpp.


Member Function Documentation

const char * Url::getPath  )  const
 

returns the path of the url incl.

a filename or NULL if none was found Definition at line 246 of file Url.cpp.

Referenced by doTest(), and isEqual().

00246 { 00247 return path; 00248 };

const char * Url::getProtocol  )  const
 

returns the protocol without the ://, e.g.

"file", "rtsp" Definition at line 271 of file Url.cpp.

Referenced by ContainerFile::loadContainerInfo().

00271 { 00272 return protocol; 00273 };

bool Url::isEqual const Url url,
bool  ignoreServerName = false
const
 

an url is equal if servername and path are equal

Parameters:
ignoreServerName is useful when we have a server
Definition at line 441 of file Url.cpp.

References getPath(), getServerName(), and hasPath().

Referenced by MetaObject::addMP4Stream().

00442 { 00443 if(hasPath() && uri->hasPath() && 00444 getServerName() && uri->getServerName()) { 00445 bool ret=true; 00446 ret= (strcmp(uri->getPath(),getPath())==0); 00447 if(!ignoreServerName) 00448 ret&=(strcmp(getServerName(),uri->getServerName())==0); 00449 return ret; 00450 } 00451 00452 return false; 00453 };

const char * Url::toString  )  const
 

builds an url.

If the url has no path, it is guaranteed that the url will end with / (e.g.: "rtsp://127.0.0.1:3128/" Definition at line 292 of file Url.cpp.

Referenced by ContainerInfo::clone(), doTest(), CacheManagerLRU::getVideo(), ContainerFile::loadContainerInfo(), ContainerInfo::loadFromCfgFile(), MetaObject::MetaObject(), SemiProxySession::play(), CacheManagerLRU::putVideo(), ContainerInfo::saveToCfgFile(), ServerSession::setUrl(), and ProxySession::setUrl().

00293 { 00294 return url; 00295 };


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