DABC (Data Acquisition Backbone Core)  2.9.9
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
dabc::Url Class Reference

Uniform Resource Locator interpreter. More...

#include <dabc/Url.h>

Public Member Functions

std::string GetFileName () const
 
std::string GetFullName () const
 
std::string GetHostName () const
 
std::string GetHostNameWithPort (int dfltport=0) const
 
bool GetOptionBool (const std::string &optname, bool dflt=false) const
 
double GetOptionDouble (const std::string &optname, double dflt=0.) const
 
int GetOptionInt (const std::string &optname, int dflt=0) const
 
std::string GetOptions () const
 
std::string GetOptionsPart (int number=0) const
 
std::string GetOptionStr (const std::string &optname, const std::string &dflt="") const
 
int GetPort () const
 
std::string GetPortStr () const
 
std::string GetProtocol () const
 
std::string GetUrl () const
 
bool HasOption (const std::string &optname) const
 
bool IsValid () const
 
void Reset ()
 
void SetOptions (const std::string &opt)
 Method allows to set URL options directly to be able use all Get methods. More...
 
bool SetUrl (const std::string &url, bool showerr=true)
 
 Url ()
 
 Url (const char *url)
 
 Url (const std::string &url)
 
virtual ~Url ()
 

Static Public Member Functions

static std::string ComposeItemName (int nodeid, const std::string &itemname="")
 ! More...
 
static std::string ComposePortName (int nodeid, const std::string &fullportname, int portid=-1)
 ! Method creates url string with port address, which includes nodeid and full portname If optional parameter portid is specified, it added as last symbols of the address Like call dabc::Url::ComposePortName(1, "MyModule/Output", 2) will produce string "dabc://node1/MyModule/Output2" More...
 
static bool DecomposeItemName (const std::string &url, int &nodeid, std::string &itemtname)
 Method decompose from url nodeid and full item name, which includes all parents. More...
 
static void ReplaceSpecialSymbols (std::string &opt)
 ! More...
 

Protected Member Functions

bool GetOption (const std::string &optname, int optionnumber=-1, std::string *value=nullptr) const
 

Protected Attributes

std::string fFileName
 file name More...
 
std::string fHostName
 host name More...
 
std::string fOptions
 list of options More...
 
int fPort
 port number More...
 
std::string fProtocol
 protocol More...
 
std::string fUrl
 Full URL. More...
 
bool fValid
 Is URL valid. More...
 

Detailed Description

Uniform Resource Locator interpreter.

Class dabc::Url supports following format: [protocol://][hostname[:port]][/filename.ext][?options[&moreoptions]]

Definition at line 33 of file Url.h.

Constructor & Destructor Documentation

◆ Url() [1/3]

dabc::Url::Url ( )

Definition at line 21 of file Url.cxx.

◆ Url() [2/3]

dabc::Url::Url ( const char *  url)

Definition at line 26 of file Url.cxx.

◆ Url() [3/3]

dabc::Url::Url ( const std::string &  url)

Definition at line 31 of file Url.cxx.

◆ ~Url()

dabc::Url::~Url ( )
virtual

Definition at line 36 of file Url.cxx.

Member Function Documentation

◆ GetOption()

bool dabc::Url::GetOption ( const std::string &  optname,
int  optionnumber = -1,
std::string *  value = nullptr 
) const
protected

Definition at line 203 of file Url.cxx.

◆ Reset()

void dabc::Url::Reset ( )

Definition at line 40 of file Url.cxx.

◆ SetUrl()

bool dabc::Url::SetUrl ( const std::string &  url,
bool  showerr = true 
)

Definition at line 46 of file Url.cxx.

◆ GetUrl()

std::string dabc::Url::GetUrl ( ) const
inline

Definition at line 54 of file Url.h.

◆ IsValid()

bool dabc::Url::IsValid ( ) const
inline

Definition at line 55 of file Url.h.

◆ GetProtocol()

std::string dabc::Url::GetProtocol ( ) const
inline

Definition at line 57 of file Url.h.

◆ GetHostName()

std::string dabc::Url::GetHostName ( ) const
inline

Definition at line 58 of file Url.h.

◆ GetPort()

int dabc::Url::GetPort ( ) const
inline

Definition at line 59 of file Url.h.

◆ GetPortStr()

std::string dabc::Url::GetPortStr ( ) const

Definition at line 132 of file Url.cxx.

◆ GetHostNameWithPort()

std::string dabc::Url::GetHostNameWithPort ( int  dfltport = 0) const

Definition at line 139 of file Url.cxx.

◆ GetFileName()

std::string dabc::Url::GetFileName ( ) const
inline

Definition at line 62 of file Url.h.

◆ GetOptions()

std::string dabc::Url::GetOptions ( ) const
inline

Definition at line 63 of file Url.h.

◆ GetFullName()

std::string dabc::Url::GetFullName ( ) const

Definition at line 124 of file Url.cxx.

◆ SetOptions()

void dabc::Url::SetOptions ( const std::string &  opt)

Method allows to set URL options directly to be able use all Get methods.

Definition at line 102 of file Url.cxx.

◆ GetOptionsPart()

std::string dabc::Url::GetOptionsPart ( int  number = 0) const

Definition at line 195 of file Url.cxx.

◆ HasOption()

bool dabc::Url::HasOption ( const std::string &  optname) const
inline

Definition at line 70 of file Url.h.

◆ GetOptionStr()

std::string dabc::Url::GetOptionStr ( const std::string &  optname,
const std::string &  dflt = "" 
) const

Definition at line 281 of file Url.cxx.

◆ GetOptionInt()

int dabc::Url::GetOptionInt ( const std::string &  optname,
int  dflt = 0 
) const

Definition at line 290 of file Url.cxx.

◆ GetOptionDouble()

double dabc::Url::GetOptionDouble ( const std::string &  optname,
double  dflt = 0. 
) const

Definition at line 302 of file Url.cxx.

◆ GetOptionBool()

bool dabc::Url::GetOptionBool ( const std::string &  optname,
bool  dflt = false 
) const

Definition at line 314 of file Url.cxx.

◆ ComposeItemName()

std::string dabc::Url::ComposeItemName ( int  nodeid,
const std::string &  itemname = "" 
)
static

!

Produces url string with unique address of specified item

Definition at line 147 of file Url.cxx.

◆ ComposePortName()

std::string dabc::Url::ComposePortName ( int  nodeid,
const std::string &  fullportname,
int  portid = -1 
)
static

! Method creates url string with port address, which includes nodeid and full portname If optional parameter portid is specified, it added as last symbols of the address Like call dabc::Url::ComposePortName(1, "MyModule/Output", 2) will produce string "dabc://node1/MyModule/Output2"

Definition at line 154 of file Url.cxx.

◆ DecomposeItemName()

bool dabc::Url::DecomposeItemName ( const std::string &  url,
int &  nodeid,
std::string &  itemtname 
)
static

Method decompose from url nodeid and full item name, which includes all parents.

Definition at line 167 of file Url.cxx.

◆ ReplaceSpecialSymbols()

void dabc::Url::ReplaceSpecialSymbols ( std::string &  opt)
static

!

Replace all special symbols which could appear in URL, especially in query

Definition at line 109 of file Url.cxx.

Field Documentation

◆ fUrl

std::string dabc::Url::fUrl
protected

Full URL.

Definition at line 35 of file Url.h.

◆ fValid

bool dabc::Url::fValid
protected

Is URL valid.

Definition at line 36 of file Url.h.

◆ fProtocol

std::string dabc::Url::fProtocol
protected

protocol

Definition at line 37 of file Url.h.

◆ fHostName

std::string dabc::Url::fHostName
protected

host name

Definition at line 38 of file Url.h.

◆ fPort

int dabc::Url::fPort
protected

port number

Definition at line 39 of file Url.h.

◆ fFileName

std::string dabc::Url::fFileName
protected

file name

Definition at line 40 of file Url.h.

◆ fOptions

std::string dabc::Url::fOptions
protected

list of options

Definition at line 41 of file Url.h.


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