Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cNetURL.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cNetURL_H
7 #define _INC_cNetURL_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cNetPort.h"
15 
16 namespace GrayLib
17 {
19 
21  {
26 
27  public:
28  static const StrLen_t k_SizeMax = (k_NET_HOSTNAME_MAX + 1024);
29  static const char k_DirSep = '/';
30  static const char k_ServiceSep[4];
31 
32 #define NET_DirSep "/" // Path separator char as string. like FILESTR_DirSep for string concatenation.
33 
34  static const char k_NetURLSafe[];
35  static const char k_NetURLUnsafe[];
36 
44 
45  protected:
46  void SetObject2(const char* pszObj);
47 
48  public:
49  cNetURL(void);
50  cNetURL(const char* pszURL, DWORD dwFlags = 0, NETSERVICE_TYPE eServiceType = NETSERVICE_UNDEF, NET_PORT_t wPort = k_NET_PORT_INVALID);
51  ~cNetURL(void);
52 
53  NET_PORT_t get_Port() const;
54 
55  void SetEmpty();
56 
57  HRESULT SetURL(const char* pszURL, DWORD dwFlags = 0);
58  HRESULT SetObject(const char* pszObject);
59  cStringA get_URL() const;
60 
61  static StrLen_t GRAYCALL DeCode(char* pszDst, StrLen_t iDstMaxSize, const char* pszSrc, StrLen_t iSrcMaxSize = k_StrLen_UNK);
62  static StrLen_t GRAYCALL EnCode(char* pszDst, StrLen_t iDstMaxSize, const char* pszSrc, StrLen_t iSrcMaxSize = k_StrLen_UNK);
63  static cStringA GRAYCALL EnCode(const char* pszSrc, StrLen_t iSrcMaxSize = k_StrLen_UNK);
64  static cStringA GRAYCALL DeCode(const char* pszSrc, StrLen_t iSrcMaxSize = k_StrLen_UNK);
65 
67  };
68 };
69 #endif // _INC_cNetStream_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cNetURL.h:21
NET_PORT_t m_wPort
the port (ex.80 = default HTTP). k_NET_PORT_INVALID = 0 =use default for m_eServiceType.
Definition: cNetURL.h:41
cStringA m_sServer
domain/Hostname or IP. cNetAddrName::IsValidHostNameChar()
Definition: cNetURL.h:40
cStringA m_sUsername
if supplied as part of the URL.
Definition: cNetURL.h:38
cStringA m_sPassword
if supplied as part of the URL.
Definition: cNetURL.h:39
UNITTEST_FRIEND(cNetURL)
cStringA m_sObject
"/dir/dir/object/object.ext"
Definition: cNetURL.h:42
NETSERVICE_TYPE m_eServiceType
known prefix for service. AKA resource_type. e.g. NETSERVICE_http
Definition: cNetURL.h:37
cStringA m_sExtra
extra information/arguments (e.g. "?foo" or "#foo")
Definition: cNetURL.h:43
Definition: cMesh.h:22
WORD NET_PORT_t
WinINet calls ports NET_PORT_t INTERNET_PORT = a service.
Definition: cNetPort.h:21
UNITTEST2_PREDEF(cQuadtree)
NETSERVICE_TYPE
Definition: cNetPort.h:32
@ NETSERVICE_UNDEF
undefined service.
Definition: cNetPort.h:37
const StrLen_t k_StrLen_UNK
use the default/current length of the string argument.
Definition: StrConst.h:34
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32