Savarese Software Research Corporation
WebStrings.h File Reference
#include <ssrc/wispers-packages.h>
#include <string>
#include <tuple>
Include dependency graph for WebStrings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef std::tuple< const char
*, std::ptrdiff_t, const char
*, std::ptrdiff_t > 
title_body_type

Functions

void escape_javascript (string &result, const char *text, const unsigned int text_size)
void escape_javascript (string &result, const string &text)
string escape_javascript (const string &text)
void escape_html (string &result, const char *text, const unsigned int text_size)
 Escapes characters in text that could result in rendering HTML when passed to an HTML renderer.
void escape_html (string &result, const string &text)
string escape_html (const string &text)
void escape_url (string &result, const char *text, const unsigned int text_size)
 Escapes characters in text that are either reserved or "unsafe" according to RFC 1738.
void escape_url (string &result, const string &text)
string escape_url (const string &text)
void unescape_url (string &url)
 Unescapes URL escape sequences in place.
void strip_html (string &result, const char *text, const unsigned int text_size)
 Removes all HTML tags from text.
void strip_html (string &result, const string &text)
string strip_html (const string &text)
void strip_html_and_unescape (string &result, const char *text, const unsigned int text_size)
 Removes all HTML tags from text and unescapes character entities, converting them into the characters they represent.
string strip_html_and_unescape (const char *text, const unsigned int text_size)
void strip_html_and_unescape (string &result, const string &text)
string strip_html_and_unescape (const string &text)
void wrap_lines (char *text, const unsigned int text_size, const unsigned int max_length=79)
 Replaces spaces in text with newlines in such a manner that no line exceeds a specified maximum length, except for sequences of characters uninterrupted by spaces that exceed the maximum line length.
title_body_type html_title_and_body (const char *begin, const char *end)
 Returns the offsets of the title and body of an HTML document.

Typedef Documentation

typedef std::tuple<const char *, std::ptrdiff_t, const char *, std::ptrdiff_t> title_body_type

Definition at line 109 of file WebStrings.h.


Function Documentation

void escape_html ( string result,
const char *  text,
const unsigned int  text_size 
)

Escapes characters in text that could result in rendering HTML when passed to an HTML renderer.

In addition, all leading and trailing whitespace is removed.

Parameters:
resultBuffer in which to store escaped text. The string will be resized to hold the text.
textThe text to be escaped.
text_sizeThe length of the unescaped text.

Definition at line 410 of file WebStrings.cc.

Referenced by escape_html().

void escape_html ( string result,
const string text 
) [inline]

Definition at line 45 of file WebStrings.h.

References escape_html().

string escape_html ( const string text) [inline]

Definition at line 49 of file WebStrings.h.

References escape_html().

void escape_javascript ( string result,
const char *  text,
const unsigned int  text_size 
)

Definition at line 392 of file WebStrings.cc.

Referenced by escape_javascript().

void escape_javascript ( string result,
const string text 
) [inline]

Definition at line 32 of file WebStrings.h.

References escape_javascript().

string escape_javascript ( const string text) [inline]

Definition at line 36 of file WebStrings.h.

References escape_javascript().

void escape_url ( string result,
const char *  text,
const unsigned int  text_size 
)

Escapes characters in text that are either reserved or "unsafe" according to RFC 1738.

Trailing spaces are escaped and not trimmed.

Parameters:
resultBuffer in which to store escaped text. The string will be resized to hold the text.
textThe text to be escaped.
text_sizeThe length of the unescaped text.

Definition at line 427 of file WebStrings.cc.

Referenced by escape_url().

void escape_url ( string result,
const string text 
) [inline]

Definition at line 58 of file WebStrings.h.

References escape_url().

string escape_url ( const string text) [inline]

Definition at line 62 of file WebStrings.h.

References escape_url().

title_body_type html_title_and_body ( const char *  begin,
const char *  end 
)

Returns the offsets of the title and body of an HTML document.

Definition at line 603 of file WebStrings.cc.

void strip_html ( string result,
const char *  text,
const unsigned int  text_size 
)

Removes all HTML tags from text.

Parameters:
resultBuffer in which to store stripped text. The string will be resized to hold the text.
textThe text to be stripped.
text_sizeThe length of the unstripped text.

Definition at line 475 of file WebStrings.cc.

Referenced by strip_html().

void strip_html ( string result,
const string text 
) [inline]

Definition at line 73 of file WebStrings.h.

References strip_html().

string strip_html ( const string text) [inline]

Definition at line 77 of file WebStrings.h.

References strip_html().

void strip_html_and_unescape ( string result,
const char *  text,
const unsigned int  text_size 
)

Removes all HTML tags from text and unescapes character entities, converting them into the characters they represent.

Parameters:
resultBuffer in which to store stripped text. The string will be resized to hold the text.
textThe text to be stripped.
text_sizeThe length of the unstripped text.

Definition at line 517 of file WebStrings.cc.

Referenced by strip_html_and_unescape().

string strip_html_and_unescape ( const char *  text,
const unsigned int  text_size 
) [inline]

Definition at line 86 of file WebStrings.h.

References strip_html_and_unescape().

void strip_html_and_unescape ( string result,
const string text 
) [inline]

Definition at line 94 of file WebStrings.h.

References strip_html_and_unescape().

string strip_html_and_unescape ( const string text) [inline]

Definition at line 98 of file WebStrings.h.

References strip_html_and_unescape().

void unescape_url ( string url)

Unescapes URL escape sequences in place.

Parameters:
urlThe URL to unescape.

Definition at line 439 of file WebStrings.cc.

References FROM_HEX.

Referenced by parse_query_string().

void wrap_lines ( char *  text,
const unsigned int  text_size,
const unsigned int  max_length 
)

Replaces spaces in text with newlines in such a manner that no line exceeds a specified maximum length, except for sequences of characters uninterrupted by spaces that exceed the maximum line length.

Parameters:
textThe text to be line-wrapped.
text_sizeThe length of the text.
max_lengthThe maximum line length.

Definition at line 563 of file WebStrings.cc.


Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.