pangomm: Pango::Language Class Reference

pangomm 2.42.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions | List of all members
Pango::Language Class Reference

A Pango::Language is used to represent a language. More...

`#include <pangomm/language.h>`

## Public Member Functions
| Language (PangoLanguage* gobject, bool make_a_copy=true)
| Language (const Language& other)
Language& | operator= (const Language& other)
| Language (Language&& other) noexcept
Language& | operator= (Language&& other) noexcept
| ~Language () noexcept
void | swap (Language& other) noexcept
PangoLanguage* | gobj ()
| Provides access to the underlying C instance. More...
const PangoLanguage* | gobj () const
| Provides access to the underlying C instance. More...
PangoLanguage* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. More...
| Language ()
| Constructs an empty language tag. More...
| Language (const Glib::ustring& language)
| Constructs a Pango::Language object from a RFC-3066 format language tag. More...
Glib::ustring | get_string () const
| Gets a RFC-3066 format string representing the given language tag. More...
bool | matches (const Glib::ustring& range_list) const
| Checks if a language tag matches one of the elements in a list of language ranges. More...
bool | includes_script (Script script) const
| Determines if script is one of the scripts used to write language. More...
Glib::ArrayHandle< Script > | get_scripts () const
| Determines the scripts used to to write this language. More...

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Attributes
PangoLanguage* | gobject_

## Related Functions
(Note that these are not member functions.)
void | swap (Language& lhs, Language& rhs) noexcept
Pango::Language | wrap (PangoLanguage* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

A Pango::Language is used to represent a language.

## Constructor & Destructor Documentation

Pango::Language::Language | ( | PangoLanguage * | gobject,
|  | bool | make_a_copy = `true`
| ) |  |
| explicit

Pango::Language::Language | ( | const Language& | other | ) |

Pango::Language::Language | ( | Language&& | other | ) |
| noexcept

Pango::Language::~Language | ( |  | ) |
| noexcept

Pango::Language::Language | ( |  | ) |

Constructs an empty language tag.

Pango::Language::Language | ( | const Glib::ustring & | language | ) |

Constructs a Pango::Language object from a RFC-3066 format language tag.

This function first canonicalizes the string by converting it to lowercase, mapping '_' to '-', and stripping all characters other than letters and '-'.

## Member Function Documentation

Glib::ArrayHandle<Script> Pango::Language::get_scripts | ( |  | ) | const

Determines the scripts used to to write this language.

If nothing is known about the language tag then an empty container is returned. The list of scripts returned starts with the script that the language uses most and continues to the one it uses least.

Most languages use only one script for writing, but there are some that use two (Latin and Cyrillic for example), and a few use three (Japanese for example). Applications should not make any assumptions on the maximum number of scripts returned though, except that it is a small number.

Returns
  A container of Script values.

Since pangomm 2.14:

Glib::ustring Pango::Language::get_string | ( |  | ) | const

Gets a RFC-3066 format string representing the given language tag.

Returns
  A string representing the language tag. An empty string is returned if the language tag is empty.

static GType Pango::Language::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

PangoLanguage* Pango::Language::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

const PangoLanguage* Pango::Language::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

PangoLanguage* Pango::Language::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

bool Pango::Language::includes_script | ( | Script | script | ) | const

Determines if script is one of the scripts used to write language.

The returned value is conservative; if nothing is known about the language tag language, `true` will be returned, since, as far as Pango knows, script might be used to write language.

This routine is used in Pango's itemization process when determining if a supplied language tag is relevant to a particular section of text. It probably is not useful for applications in most circumstances.

This function uses get_scripts() internally.

Since pangomm 1.4:

Parameters

  script | A Pango::Script.

Returns
  `true` if script is one of the scripts used to write language or if nothing is known about language (including the case that language is `nullptr`), `false` otherwise.

bool Pango::Language::matches | ( | const Glib::ustring & | range_list | ) | const

Checks if a language tag matches one of the elements in a list of language ranges.

A language tag is considered to match a range in the list if the range is '*', the range is exactly the tag, or the range is a prefix of the tag, and the character after it in the tag is '-'.

Parameters

  range_list | A list of language ranges, separated by ';', ':', ',', or space characters. Each element must either be '*', or a RFC 3066 language range canonicalized as by from_string().

Returns
  `true` if a match was found.

Language& Pango::Language::operator= | ( | const Language& | other | ) |

Language& Pango::Language::operator= | ( | Language&& | other | ) |
| noexcept

void Pango::Language::swap | ( | Language& | other | ) |
| noexcept

## Friends And Related Function Documentation

void swap | ( | Language& | lhs,
|  | Language& | rhs
| ) |  |
| related

Parameters

  lhs | The left-hand side
  rhs | The right-hand side

Pango::Language wrap | ( | PangoLanguage * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

PangoLanguage* Pango::Language::gobject_
| protected