linebreak

Handle linebreak object. More...

Collaboration diagram for linebreak:

## Data Structures

struct | unistr_t
struct | mapent_t
struct | gcstring_t
struct | linebreak_t

## Typedefs

typedef unsigned char | propval_t
typedef struct linebreak_t | linebreak_t

## Enumerations

enum | linebreak_state_t { LINEBREAK_STATE_NONE = 0 , LINEBREAK_STATE_SOT , LINEBREAK_STATE_SOP , LINEBREAK_STATE_SOL , LINEBREAK_STATE_LINE , LINEBREAK_STATE_EOL , LINEBREAK_STATE_EOP , LINEBREAK_STATE_EOT , LINEBREAK_STATE_MAX }

## Functions

propval_t | linebreak_search_lbclass (linebreak_t *obj, unichar_t c)
propval_t | linebreak_search_eawidth (linebreak_t *obj, unichar_t c)
void | linebreak_update_lbclass (linebreak_t *obj, unichar_t c, propval_t p)
void | linebreak_update_eawidth (linebreak_t *obj, unichar_t c, propval_t p)
void | linebreak_merge_lbclass (linebreak_t *obj, linebreak_t *diff)
void | linebreak_merge_eawidth (linebreak_t *obj, linebreak_t *diff)
void | linebreak_clear_lbclass (linebreak_t *obj)
void | linebreak_clear_eawidth (linebreak_t *obj)
linebreak_t * | linebreak_new (linebreak_ref_func_t ref_func)
linebreak_t * | linebreak_incref (linebreak_t *obj)
linebreak_t * | linebreak_copy (linebreak_t *obj)
void | linebreak_destroy (linebreak_t *obj)
void | linebreak_set_newline (linebreak_t *lbobj, unistr_t *newline)
void | linebreak_set_stash (linebreak_t *lbobj, void *stash)
void | linebreak_set_format (linebreak_t *lbobj, linebreak_format_func_t format_func, void *format_data)
void | linebreak_add_prep (linebreak_t *lbobj, linebreak_prep_func_t prep_func, void *prep_data)
void | linebreak_set_sizing (linebreak_t *lbobj, linebreak_sizing_func_t sizing_func, void *sizing_data)
void | linebreak_set_urgent (linebreak_t *lbobj, linebreak_urgent_func_t urgent_func, void *urgent_data)
void | linebreak_set_user (linebreak_t *lbobj, linebreak_obs_prep_func_t user_func, void *user_data)
void | linebreak_reset (linebreak_t *lbobj)
propval_t | linebreak_get_lbrule (linebreak_t *obj, propval_t blbc, propval_t albc)
propval_t | linebreak_lbclass (linebreak_t *obj, unichar_t c)
propval_t | linebreak_eawidth (linebreak_t *obj, unichar_t c)

## Detailed Description

Handle linebreak object.

## Typedef Documentation

## linebreak_t

typedef struct linebreak_t linebreak_t

LineBreak object.

## propval_t

typedef unsigned char propval_t

Character property

## Enumeration Type Documentation

## linebreak_state_t

enum linebreak_state_t

state argument for format callback.

Enumerator
LINEBREAK_STATE_NONE |
LINEBREAK_STATE_SOT |
LINEBREAK_STATE_SOP |
LINEBREAK_STATE_SOL |
LINEBREAK_STATE_LINE |
LINEBREAK_STATE_EOL |
LINEBREAK_STATE_EOP |
LINEBREAK_STATE_EOT |
LINEBREAK_STATE_MAX |

## Function Documentation

## linebreak_add_prep()

void linebreak_add_prep | ( | linebreak_t * | lbobj,
|  | linebreak_prep_func_t | prep_func,
|  | void * | prep_data )

Setter: Add/clear prep_func/prep_data Member

Parameters

  [in] | lbobj | target linebreak object.
  [in] | prep_func | preprocessing callback function or NULL.
  [in] | prep_data | new prep_data value.

Returns
  none. New preprocessing callback is added. Reference count of prep_data item will be handled appropriately. if prep_func was NULL, all data are cleared.

## linebreak_clear_eawidth()

void linebreak_clear_eawidth | ( | linebreak_t * | obj | ) |

Clear custom East_Asian_Width property map

Parameters

  [in] | obj | linebreak object.

Returns
  none. All East_Asian_Width values in custom map will be cleared.

## linebreak_clear_lbclass()

void linebreak_clear_lbclass | ( | linebreak_t * | obj | ) |

Clear custom line breaking class map

Parameters

  [in] | obj | linebreak object.

Returns
  none. All line breaking class values in custom map will be cleared.

## linebreak_copy()

linebreak_t * linebreak_copy | ( | linebreak_t * | obj | ) |

Copy Constructor

Create deep copy of linebreak object. Reference count of new object will be set to 1. If ref_func member of object is not NULL, it will be executed to increase reference count of prep_data, format_data, sizing_data, urgent_data and stash members.

Parameters

  [in] | obj | linebreak object, must not be NULL.

Returns
  New linebreak object. If error occurred, errno is set then NULL is returned.

## linebreak_destroy()

void linebreak_destroy | ( | linebreak_t * | obj | ) |

Decrease Reference Count; Destructor

Decrement reference count of linebreak object. When reference count becomes zero, free memories allocated for object and then, if ref_func member of object was not NULL, it will be executed to decrease reference count of prep_data, format_data, sizing_data, urgent_data and stash members.

Parameters

  [in] | obj | linebreak object.

Returns
  none. If obj was NULL, do nothing.

## linebreak_eawidth()

propval_t linebreak_eawidth | ( | linebreak_t * | obj,
|  | unichar_t | c )

Get East_Asian_Width Property

Deprecated
  Use gcstring_columns() instead.

Get UAX #11 East_Asian_Width property value of Unicode character. Class A will be resolved to appropriate property F or N.

Parameters

  [in] | obj | linebreak object, must not be NULL.
  [in] | c | Unicode character.

Returns
  East_Asian_Width property value.

## linebreak_get_lbrule()

propval_t linebreak_get_lbrule | ( | linebreak_t * | obj,
|  | propval_t | blbc,
|  | propval_t | albc )

Get breaking rule between two classes

From given two line breaking classes, get breaking rule determined by internal data.

Parameters

  [in] | obj | linebreak object, must not be NULL.
  [in] | albc | line breaking class.
  [in] | blbc | line breaking class.

Returns
  line breaking action: MANDATORY, DIRECT, INDIRECT or PROHIBITED. If action was not determined, returns DIRECT.

Note
  This method gives just approximate description of line breaking behavior. Class AI and CJ will be resolved to approppriate classes. See also linebreak_lbrule().
  This method was introduced by Sombok 2.0.6.
  LEGACY_CM and HANGUL_AS_AL options are concerned as of Sombok 2.1.2.
  Only HANGUL_AS_AL is concerned as of Sombok 2.2.

## linebreak_incref()

linebreak_t * linebreak_incref | ( | linebreak_t * | obj | ) |

Increase Reference Count

Increse reference count of linebreak object.

Parameters

  [in] | obj | linebreak object, must not be NULL.

Returns
  linebreak object itself. If error occurred, errno is set then NULL is returned.

## linebreak_lbclass()

propval_t linebreak_lbclass | ( | linebreak_t * | obj,
|  | unichar_t | c )

Get Line Breaking Class

Deprecated
  Use gcstring_lbclass() or gcstring_lbclass_ext() instead.

Get UAX #14 line breaking class of Unicode character. Classes XX and SG will be resolved to AL.

Parameters

  [in] | obj | linebreak object, must not be NULL.
  [in] | c | Unicode character.

Returns
  line breaking class property value.

## linebreak_merge_eawidth()

void linebreak_merge_eawidth | ( | linebreak_t * | obj,
|  | linebreak_t * | diff )

Update custom East_Asian_Width map by another map.

Parameters

  [in] | obj | destination linebreak object.
  [in] | diff | source linebreak object.

Returns
  none. custom map will be updated.

## linebreak_merge_lbclass()

void linebreak_merge_lbclass | ( | linebreak_t * | obj,
|  | linebreak_t * | diff )

Update custom line breaking class map by another map.

Parameters

  [in] | obj | destination linebreak object.
  [in] | diff | source linebreak object.

Returns
  none. custom map will be updated.

## linebreak_new()

linebreak_t * linebreak_new | ( | linebreak_ref_func_t | ref_func | ) |

Constructor

Creates new linebreak object. Reference count of it will be set to 1.

Parameters

  [in] | ref_func | function to handle reference count of external objects, or NULL.

Returns
  New linebreak object. If error occurred, errno is set then NULL is returned.

## linebreak_reset()

void linebreak_reset | ( | linebreak_t * | lbobj | ) |

Reset State

Reset internal state of linebreak object. Internal state is set by linebreak_break_partial() function.

Parameters

  [in] | lbobj | linebreak object.

Returns
  none. If lbobj was NULL, do nothing.

## linebreak_search_eawidth()

propval_t linebreak_search_eawidth | ( | linebreak_t * | obj,
|  | unichar_t | c )

Find property from custom East_Asian_Width map.

Parameters

  [in] | obj | linebreak object.
  [in] | c | Unicode character.

Returns
  property value. If not found, PROP_UNKNOWN.

## linebreak_search_lbclass()

propval_t linebreak_search_lbclass | ( | linebreak_t * | obj,
|  | unichar_t | c )

Find property from custom line breaking class map.

Parameters

  [in] | obj | linebreak object.
  [in] | c | Unicode character.

Returns
  property value. If not found, PROP_UNKNOWN.

## linebreak_set_format()

void linebreak_set_format | ( | linebreak_t * | lbobj,
|  | linebreak_format_func_t | format_func,
|  | void * | format_data )

Setter: Update format_func/format_data Member

Parameters

  [in] | lbobj | target linebreak object.
  [in] | format_func | format callback function or NULL.
  [in] | format_data | new format_data value.

Returns
  none. New format callback is set. Reference count of format_data member will be handled appropriately.

## linebreak_set_newline()

void linebreak_set_newline | ( | linebreak_t * | lbobj,
|  | unistr_t * | newline )

Setter: Update newline member

Parameters

  [in] | lbobj | target linebreak object, must not be NULL.
  [in] | newline | pointer to Unicode string.

Returns
  none. Copy of newline is set. If error occurred, lbobj->errnum is set.

## linebreak_set_sizing()

void linebreak_set_sizing | ( | linebreak_t * | lbobj,
|  | linebreak_sizing_func_t | sizing_func,
|  | void * | sizing_data )

Setter: Update sizing_func/sizing_data Member

Parameters

  [in] | lbobj | target linebreak object.
  [in] | sizing_func | sizing callback function or NULL.
  [in] | sizing_data | new sizing_data value.

Returns
  none. New sizing callback is set. Reference count of sizing_data member will be handled appropriately.

## linebreak_set_stash()

void linebreak_set_stash | ( | linebreak_t * | lbobj,
|  | void * | stash )

Setter: Update stash Member

Parameters

  [in] | lbobj | target linebreak object, must not be NULL.
  [in] | stash | new stash value or NULL.

Returns
  none. New stash value is set. Reference count of stash member will be handled appropriately.

## linebreak_set_urgent()

void linebreak_set_urgent | ( | linebreak_t * | lbobj,
|  | linebreak_urgent_func_t | urgent_func,
|  | void * | urgent_data )

Setter: Update urgent_func/urgent_data Member

Parameters

  [in] | lbobj | target linebreak object.
  [in] | urgent_func | urgent breaking callback function or NULL.
  [in] | urgent_data | new urgent_data value.

Returns
  none. New urgent breaking callback is set. Reference count of urgent_data member will be handled appropriately.

## linebreak_set_user()

void linebreak_set_user | ( | linebreak_t * | lbobj,
|  | linebreak_obs_prep_func_t | user_func,
|  | void * | user_data )

Setter: Update user_func/user_data Member

Deprecated
  Use linebreak_add_prep() instead.

Parameters

  [in] | lbobj | target linebreak object.
  [in] | user_func | preprocessing callback function or NULL.
  [in] | user_data | new user_data value.

Returns
  none. New preprocessing callback is set. Reference count of user_data member will be handled appropriately.

## linebreak_update_eawidth()

void linebreak_update_eawidth | ( | linebreak_t * | obj,
|  | unichar_t | c,
|  | propval_t | p )

Update custom East_Asian_Width propety map.

Parameters

  [in] | obj | linebreak object.
  [in] | c | Unicode character.
  [in] | p | New East_Asian_Width propery value.

Returns
  none. custom map will be updated.

## linebreak_update_lbclass()

void linebreak_update_lbclass | ( | linebreak_t * | obj,
|  | unichar_t | c,
|  | propval_t | p )

Update custom line breaking class map.

Parameters

  [in] | obj | linebreak object.
  [in] | c | Unicode character.
  [in] | p | New line breaking class propery value.

Returns
  none. Custom map will be updated.