PandoraBotIRC  1.0.0
An irc bot that acts as a Pandora chatter bot
pbirc::util Namespace Reference

Namespace for general utility functions. More...

Functions

bool isReserved (char const &c)
 
std::string URLEncode (std::string const &s)
 
std::string HTMLEscape (std::string s)
 
std::string HTMLUnEscape (std::string s)
 
std::string stripHtml (std::string const &s)
 
template<typename ReverseIter >
ReverseIter::iterator_type make_forward (ReverseIter i)
 
std::string removeLeadingSpaces (std::string const &s)
 
std::string removeTrailingSpaces (std::string const &s)
 

Detailed Description

Namespace for general utility functions.

Function Documentation

std::string pbirc::util::HTMLEscape ( std::string  s)

Replaces escape characters in HTML with their proper counterparts.

Parameters
[in]sstring to escape
Returns
the escaped string
std::string pbirc::util::HTMLUnEscape ( std::string  s)

Does the opposite of HTMLEscape

Parameters
[in]sthe string to unescape
Returns
the unescaped string
bool pbirc::util::isReserved ( char const &  c)

Function checks a character to see if a character is reserved in URLs. A reserved character is used for a special purpose in URLs.

Parameters
[in]ccharacter to be tested.
Returns
returns true if a character is URL reserved. Otherwise false.
template<typename ReverseIter >
ReverseIter::iterator_type pbirc::util::make_forward ( ReverseIter  i)

Helper function to convert a reverse_iterator into a forward_iterator

Parameters
[in]ireverse_iterator to be made forward
Returns
forward_iterator that points to the same object as i.
std::string pbirc::util::removeLeadingSpaces ( std::string const &  s)

Removes the leading spaces from a string

Parameters
[in]sstring to remove whitespaces from
Returns
string with no leading whitespaces
std::string pbirc::util::removeTrailingSpaces ( std::string const &  s)

Removes the trailing whitespaces from a string

Parameters
[in]sstring to remove trailing whitespaces from
Returns
string with no trailing whitespaces
std::string pbirc::util::stripHtml ( std::string const &  s)

Removes all HTML tags from a string.

Parameters
[in]sstring to strip html from
Returns
html-free string
std::string pbirc::util::URLEncode ( std::string const &  s)

URL encodes a string – Removes reserved characters and replaces them with hex counterparts. "The quick brown fox" will become "The%20quick%20brown%20fox"

Parameters
[in]sstring to encode
Returns
encoded version of string