CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
HTML.h
Go to the documentation of this file.
1
20#if !defined(_HTML_H_)
21#define _HTML_H_
22
23#include "Utils.h"
24
25namespace cmlabs {
26namespace html {
27
31std::string DecodeHTML(std::string str);
35std::string EncodeHTML(std::string str);
36
40unsigned char HTML2Char(const char* str);
41
47bool GetMimeType(char* dest, const char* filename, uint32 maxsize);
55bool GetMimeType(char* dest, const char* filename, uint32 maxsize, bool &isBinary);
59bool IsMimeBinary(const char* type);
60
64std::string GetUsernameFromURL(std::string url);
68std::string GetPasswordFromURL(std::string url);
72std::string GetAuthenticationFromURL(std::string url);
76std::string GetHostFromURL(std::string url);
81uint16 GetPortFromURL(std::string url);
85std::string GetProtocolFromURL(std::string url);
89std::string GetURIFromURL(std::string url);
90
93bool HTML_UnitTest();
94
95} // namespace html
96} // namespace cmlabs
97
98#endif //_UTILS_H_
99
Cross-platform utility toolbox for CMSDK: threading, synchronization, shared memory,...
bool HTML_UnitTest()
Self-contained unit test of the HTML/URL helpers.
Definition HTML.cpp:362
std::string GetURIFromURL(std::string url)
Extract the URI (path plus query) from a URL.
Definition HTML.cpp:348
std::string GetProtocolFromURL(std::string url)
Extract the protocol/scheme from a URL.
Definition HTML.cpp:333
bool GetMimeType(char *dest, const char *filename, uint32 maxsize)
Look up the MIME type for a filename based on its extension.
Definition HTML.cpp:137
bool IsMimeBinary(const char *type)
Determine whether a MIME type denotes binary content.
Definition HTML.cpp:130
std::string GetUsernameFromURL(std::string url)
Extract the username from a URL of the form scheme://user:pass@host/...
Definition HTML.cpp:255
unsigned char HTML2Char(const char *str)
Convert a single HTML entity (e.g.
Definition HTML.cpp:90
std::string EncodeHTML(std::string str)
Encode a plain string for safe embedding in HTML (e.g.
Definition HTML.cpp:51
std::string GetPasswordFromURL(std::string url)
Extract the password from a URL of the form scheme://user:pass@host/...
Definition HTML.cpp:267
std::string GetHostFromURL(std::string url)
Extract the host name (or IP literal) from a URL.
Definition HTML.cpp:291
uint16 GetPortFromURL(std::string url)
Extract the port number from a URL.
Definition HTML.cpp:314
std::string DecodeHTML(std::string str)
Decode HTML entities in a string (e.g.
Definition HTML.cpp:12
std::string GetAuthenticationFromURL(std::string url)
Extract the full "user:pass" authentication section from a URL.
Definition HTML.cpp:279