cgul_line_wrapper_cxx Class Reference

C++ bindings for cgul_line_wrapper More...

#include <cgul_line_wrapper_cxx.h>

Collaboration diagram for cgul_line_wrapper_cxx:
Collaboration graph

Static Public Member Functions

static void wrap_utf8_at_column (cgul_string_cxx &lines, unsigned int column)
 
static void wrap_utf32_at_column (cgul_wstring_cxx &wlines, unsigned int column)
 
static void wrap_utf8_at_width (cgul_string_cxx &lines, cgul_bdf_cxx &bdf, int substitute, unsigned int max_line_width)
 
static void wrap_utf32_at_width (cgul_wstring_cxx &wlines, cgul_bdf_cxx &bdf, int substitute, unsigned int max_line_width)
 

Detailed Description

This class provides the C++ bindings for C cgul_line_wrapper objects. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_line_wrapper into C++-style function calls and exception handling.

Member Function Documentation

§ wrap_utf8_at_column()

static void cgul_line_wrapper_cxx::wrap_utf8_at_column ( cgul_string_cxx lines,
unsigned int  column 
)
inlinestatic

This function wraps the UTF-8 string lines at column and returns the result in lines. This is used for formatting text destined for the console. It assumes all characters have the same, unspecified width. So the wrapping is based on the maximum number of characters per line.

It is permissible for lines to have embedded new-line characters before calling this method. When an embedded new-line character is encountered, this method will honor it and force the start of a new line.

If an error occurs, an exception is thrown.

Parameters
[in,out]lineslines to wrap
[in]columncolumn at which to wrap

References cgul_line_wrapper__wrap_utf8_at_column(), and cgul_string_cxx::get_obj().

§ wrap_utf32_at_column()

static void cgul_line_wrapper_cxx::wrap_utf32_at_column ( cgul_wstring_cxx wlines,
unsigned int  column 
)
inlinestatic

This function wraps the UTF-32 string wlines at column and returns the result in wlines. This is used for formatting text destined for the console. It assumes all characters have the same, unspecified width. So the wrapping is based on the maximum number of wide characters per line.

It is permissible for wlines to have embedded new-line wide characters before calling this method. When an embedded new-line wide character is encountered, this method will honor it and force the start of a new line.

If an error occurs, an exception is thrown.

Parameters
[in,out]wlineslines to wrap
[in]columncolumn at which to wrap

References cgul_line_wrapper__wrap_utf32_at_column(), and cgul_wstring_cxx::get_obj().

§ wrap_utf8_at_width()

static void cgul_line_wrapper_cxx::wrap_utf8_at_width ( cgul_string_cxx lines,
cgul_bdf_cxx bdf,
int  substitute,
unsigned int  max_line_width 
)
inlinestatic

This function wraps the UTF-8 string lines at width and returns the result in lines. This is used for formatting text destined to be drawn on a graphical surface. The amount of space each line consumes is calculated using the BDF font bdf by calling cgul_bdf__get_utf8_extents(). Thus, in order for this function to be accurate, your code must draw text as explained in the comments to cgul_bdf__get_utf8_extents() and the value you pass in here for substitute must match.

It is permissible for lines to have embedded new-line characters before calling this method. When an embedded new-line character is encountered, this method will honor it and force the start of a new line.

If substitute is set, this method assumes the code that draws the text will substitute missing glyphs with the default glyph for the font, e.g., an empty box. If substitute is not set, this method will throw an exception if it cannot find the glyph for one of the characters in lines.

If you just need to calculate the width of a string in pixels, you can use cgul_bdf__get_utf8_extents() instead.

If an error occurs, an exception is thrown.

Parameters
[in,out]lineslines to wrap
[in]bdfBDF font
[in]substitutewhether to substitute missing glyphs with the default
[in]max_line_widthmaximum line width before wrapping occurs

References cgul_line_wrapper__wrap_utf8_at_width(), cgul_bdf_cxx::get_obj(), and cgul_string_cxx::get_obj().

§ wrap_utf32_at_width()

static void cgul_line_wrapper_cxx::wrap_utf32_at_width ( cgul_wstring_cxx wlines,
cgul_bdf_cxx bdf,
int  substitute,
unsigned int  max_line_width 
)
inlinestatic

This function wraps the UTF-32 string wlines at width and returns the result in wlines. This is used for formatting text destined to be drawn on a graphical surface. The amount of space each line consumes is calculated using the BDF font bdf by calling cgul_bdf__get_utf32_extents(). Thus, in order for this function to be accurate, your code must draw text as explained in the comments to cgul_bdf__get_utf32_extents() and the value you pass in here for substitute must match.

It is permissible for wlines to have embedded new-line characters before calling this method. When an embedded new-line character is encountered, this method will honor it and force the start of a new line.

If substitute is set, this method assumes the code that draws the text will substitute missing glyphs with the default glyph for the font, e.g., an empty box. If substitute is not set, this method will throw an exception if it cannot find the glyph for one of the characters in lines.

If you just need to calculate the width of a string in pixels, you can use cgul_bdf__get_utf32_extents() instead.

If an error occurs, an exception is thrown.

Parameters
[in,out]wlineslines to wrap
[in]bdfBDF font
[in]substitutewhether to substitute missing glyphs with the default
[in]max_line_widthmaximum line width before wrapping occurs

References cgul_line_wrapper__wrap_utf32_at_width(), cgul_bdf_cxx::get_obj(), and cgul_wstring_cxx::get_obj().


The documentation for this class was generated from the following file: