Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cNetURL Class Reference

#include <cNetURL.h>

Public Member Functions

 cNetURL (void)
 
 cNetURL (const char *pszURL, DWORD dwFlags=0, NETSERVICE_TYPE eServiceType=NETSERVICE_UNDEF, NET_PORT_t wPort=k_NET_PORT_INVALID)
 
 ~cNetURL (void)
 
NET_PORT_t get_Port () const
 
void SetEmpty ()
 
HRESULT SetURL (const char *pszURL, DWORD dwFlags=0)
 
HRESULT SetObject (const char *pszObject)
 
cStringA get_URL () const
 
 UNITTEST_FRIEND (cNetURL)
 

Static Public Member Functions

static StrLen_t GRAYCALL DeCode (char *pszDst, StrLen_t iDstMaxSize, const char *pszSrc, StrLen_t iSrcMaxSize=k_StrLen_UNK)
 
static StrLen_t GRAYCALL EnCode (char *pszDst, StrLen_t iDstMaxSize, const char *pszSrc, StrLen_t iSrcMaxSize=k_StrLen_UNK)
 
static cStringA GRAYCALL EnCode (const char *pszSrc, StrLen_t iSrcMaxSize=k_StrLen_UNK)
 
static cStringA GRAYCALL DeCode (const char *pszSrc, StrLen_t iSrcMaxSize=k_StrLen_UNK)
 

Public Attributes

NETSERVICE_TYPE m_eServiceType
 known prefix for service. AKA resource_type. e.g. NETSERVICE_http More...
 
cStringA m_sUsername
 if supplied as part of the URL. More...
 
cStringA m_sPassword
 if supplied as part of the URL. More...
 
cStringA m_sServer
 domain/Hostname or IP. cNetAddrName::IsValidHostNameChar() More...
 
NET_PORT_t m_wPort
 the port (ex.80 = default HTTP). k_NET_PORT_INVALID = 0 =use default for m_eServiceType. More...
 
cStringA m_sObject
 "/dir/dir/object/object.ext" More...
 
cStringA m_sExtra
 extra information/arguments (e.g. "?foo" or "#foo") More...
 

Static Public Attributes

static const StrLen_t k_SizeMax = (k_NET_HOSTNAME_MAX + 1024)
 arbitrary max size. NI_MAXHOST + X More...
 
static const char k_DirSep = '/'
 for URL's More...
 
static const char k_ServiceSep [4] = "://"
 for URL's "://" More...
 
static const char k_NetURLSafe [] = "$-_.+!*'()," "&:;?=/@"
 Known safe chars. NOTE: '+' has unknown compatibility status. More...
 
static const char k_NetURLUnsafe [] = " <>\"#%{}|\\^~[]`"
 Known UNSAFE chars. More...
 

Protected Member Functions

void SetObject2 (const char *pszObj)
 

Detailed Description

Parse/decompose a URL for all the known parts. Like: AfxParseURLEx( "service://user:password@server:port/dir/dir/object.ext?foo" ) similar to InternetCrackUrl( URL_COMPONENTS ) and .NET System.Uri

Constructor & Destructor Documentation

◆ cNetURL() [1/2]

GrayLib::cNetURL::cNetURL ( void  )

◆ cNetURL() [2/2]

GrayLib::cNetURL::cNetURL ( const char *  pszURL,
DWORD  dwFlags = 0,
NETSERVICE_TYPE  eServiceType = NETSERVICE_UNDEF,
NET_PORT_t  wPort = k_NET_PORT_INVALID 
)

◆ ~cNetURL()

GrayLib::cNetURL::~cNetURL ( void  )

Member Function Documentation

◆ DeCode() [1/2]

StrLen_t GRAYCALL GrayLib::cNetURL::DeCode ( char *  pszDst,
StrLen_t  iDstMaxSize,
const char *  pszSrc,
StrLen_t  iSrcMaxSize = k_StrLen_UNK 
)
static

Decode the odd HTML URL % encoding back to a normal string. iDstMaxSize includes room for '\0'

◆ DeCode() [2/2]

cStringA GRAYCALL GrayLib::cNetURL::DeCode ( const char *  pszSrc,
StrLen_t  iSrcMaxSize = k_StrLen_UNK 
)
static

◆ EnCode() [1/2]

StrLen_t GRAYCALL GrayLib::cNetURL::EnCode ( char *  pszDst,
StrLen_t  iDstMaxSize,
const char *  pszSrc,
StrLen_t  iSrcMaxSize = k_StrLen_UNK 
)
static

(RFC 1738, Dec. '94) Encode the odd HTML URL % encoding from a string. space = %20 etc. upper and lower case are the same. always ASCII 8 bit characters like "::InternetCanonicalizeUrl()"

◆ EnCode() [2/2]

cStringA GRAYCALL GrayLib::cNetURL::EnCode ( const char *  pszSrc,
StrLen_t  iSrcMaxSize = k_StrLen_UNK 
)
static

◆ get_Port()

NET_PORT_t GrayLib::cNetURL::get_Port ( ) const

◆ get_URL()

cStringA GrayLib::cNetURL::get_URL ( ) const

RE-Compose the URL from its parts.

◆ SetEmpty()

void GrayLib::cNetURL::SetEmpty ( )

◆ SetObject()

HRESULT GrayLib::cNetURL::SetObject ( const char *  pszObject)

Set just the name of the object on the current m_sServer Allow setting of new server if it has a k_ServiceSep prefix

◆ SetObject2()

void GrayLib::cNetURL::SetObject2 ( const char *  pszObj)
protected

Set just the name of the object on the current m_sServer

◆ SetURL()

HRESULT GrayLib::cNetURL::SetURL ( const char *  pszURL,
DWORD  dwFlags = 0 
)

decompose/parse a URL string to its URL parts. Like: AfxParseURLEx( "service://user:password@server:port/dir/dir/object.ext" )

  • dwFlags = encoded?

◆ UNITTEST_FRIEND()

GrayLib::cNetURL::UNITTEST_FRIEND ( cNetURL  )

Member Data Documentation

◆ k_DirSep

const char GrayLib::cNetURL::k_DirSep = '/'
static

for URL's

◆ k_NetURLSafe

const char GrayLib::cNetURL::k_NetURLSafe = "$-_.+!*'()," "&:;?=/@"
static

Known safe chars. NOTE: '+' has unknown compatibility status.

◆ k_NetURLUnsafe

const char GrayLib::cNetURL::k_NetURLUnsafe = " <>\"#%{}|\\^~[]`"
static

Known UNSAFE chars.

Known safe chars. NOTE: '+' has unknown compatibility status.

◆ k_ServiceSep

const char GrayLib::cNetURL::k_ServiceSep = "://"
static

for URL's "://"

Known UNSAFE chars.

◆ k_SizeMax

const StrLen_t GrayLib::cNetURL::k_SizeMax = (k_NET_HOSTNAME_MAX + 1024)
static

arbitrary max size. NI_MAXHOST + X

◆ m_eServiceType

NETSERVICE_TYPE GrayLib::cNetURL::m_eServiceType

known prefix for service. AKA resource_type. e.g. NETSERVICE_http

◆ m_sExtra

cStringA GrayLib::cNetURL::m_sExtra

extra information/arguments (e.g. "?foo" or "#foo")

◆ m_sObject

cStringA GrayLib::cNetURL::m_sObject

"/dir/dir/object/object.ext"

◆ m_sPassword

cStringA GrayLib::cNetURL::m_sPassword

if supplied as part of the URL.

◆ m_sServer

cStringA GrayLib::cNetURL::m_sServer

domain/Hostname or IP. cNetAddrName::IsValidHostNameChar()

◆ m_sUsername

cStringA GrayLib::cNetURL::m_sUsername

if supplied as part of the URL.

◆ m_wPort

NET_PORT_t GrayLib::cNetURL::m_wPort

the port (ex.80 = default HTTP). k_NET_PORT_INVALID = 0 =use default for m_eServiceType.


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