CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
HTML.cpp File Reference

Implementation of the HTML/URL helpers: entity encode/decode tables, extension-to-MIME-type mapping and URL component extraction. More...

#include "HTML.h"
#include "PsyTime.h"
#include "UnitTestFramework.h"
Include dependency graph for HTML.cpp:

Go to the source code of this file.

Namespaces

namespace  cmlabs
namespace  cmlabs::html

Functions

std::string cmlabs::html::DecodeHTML (std::string str)
 Decode HTML entities in a string (e.g.
std::string cmlabs::html::EncodeHTML (std::string str)
 Encode a plain string for safe embedding in HTML (e.g.
unsigned char cmlabs::html::HTML2Char (const char *str)
 Convert a single HTML entity (e.g.
bool cmlabs::html::IsMimeBinary (const char *type)
 Determine whether a MIME type denotes binary content.
bool cmlabs::html::GetMimeType (char *dest, const char *filename, uint32 maxsize)
 Look up the MIME type for a filename based on its extension.
bool cmlabs::html::GetMimeType (char *dest, const char *filename, uint32 maxsize, bool &isBinary)
 Look up the MIME type for a filename and report whether it is binary.
std::string cmlabs::html::GetUsernameFromURL (std::string url)
 Extract the username from a URL of the form scheme://user:pass@host/...
std::string cmlabs::html::GetPasswordFromURL (std::string url)
 Extract the password from a URL of the form scheme://user:pass@host/...
std::string cmlabs::html::GetAuthenticationFromURL (std::string url)
 Extract the full "user:pass" authentication section from a URL.
std::string cmlabs::html::GetHostFromURL (std::string url)
 Extract the host name (or IP literal) from a URL.
uint16 cmlabs::html::GetPortFromURL (std::string url)
 Extract the port number from a URL.
std::string cmlabs::html::GetProtocolFromURL (std::string url)
 Extract the protocol/scheme from a URL.
std::string cmlabs::html::GetURIFromURL (std::string url)
 Extract the URI (path plus query) from a URL.
bool cmlabs::html::HTML_UnitTest ()
 Self-contained unit test of the HTML/URL helpers.
void cmlabs::Register_HTML_Tests ()

Detailed Description

Implementation of the HTML/URL helpers: entity encode/decode tables, extension-to-MIME-type mapping and URL component extraction.

Definition in file HTML.cpp.