gtksourceviewmm: Gsv::Language Class Reference

gtksourceviewmm 3.91.1

Public Member Functions | Static Public Member Functions | Related Symbols | List of all members
Gsv::Language Class Reference

Object representing a syntax highlighted language. More...

`#include <gtksourceviewmm/language.h>`

Inherits Glib::Object.

## Public Member Functions
| Language (Language&& src) noexcept
Language& | operator= (Language&& src) noexcept
| ~Language () noexcept override
GtkSourceLanguage* | gobj ()
| Provides access to the underlying C GObject.
const GtkSourceLanguage* | gobj () const
| Provides access to the underlying C GObject.
GtkSourceLanguage* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::ustring | get_id () const
| Returns the ID of a language.
Glib::ustring | get_name () const
| Returns the localized name of the language.
Glib::ustring | get_section () const
| Returns the localized section of the language.
bool | get_hidden () const
| Returns whether the language should be hidden from the user.
std::vector< Glib::ustring > | get_mime_types () const
| Returns the mime types associated to this language.
std::vector< Glib::ustring > | get_globs () const
| Returns the globs associated to this language.
std::vector< Glib::ustring > | get_style_ids () const
| Returns the ids of the styles defined by this language.
Glib::ustring | get_style_name (const Glib::ustring& style_id) const
| Returns the name of the style with ID style_id defined by this language.
Glib::ustring | get_style_fallback (const Glib::ustring& style_id) const
| Returns the ID of the style to use if the specified style_id is not present in the current style scheme.
Glib::ustring | get_metadata (const Glib::ustring& name) const
| Returns metadata of a language.
Glib::PropertyProxy_ReadOnly< std::string > | property_id () const
| Language id.
Glib::PropertyProxy_ReadOnly< std::string > | property_name () const
| Language name.
Glib::PropertyProxy_ReadOnly< std::string > | property_section () const
| Language section.
Glib::PropertyProxy_ReadOnly< bool > | property_hidden () const
| Whether the language should be hidden from the user.

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

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gsv::Language > | wrap (GtkSourceLanguage* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Object representing a syntax highlighted language.

Language encapsulates syntax and highlighting styles for a particular language. Use LanguageManager to obtain a Language instance, and Buffer::set_language() to apply it to a Buffer.

## Constructor & Destructor Documentation

## ◆ Language()

Gsv::Language::Language | ( | Language&& | src | ) |
| noexcept

## ◆ ~Language()

Gsv::Language::~Language | ( |  | ) |
| overridenoexcept

## Member Function Documentation

## ◆ get_globs()

std::vector< Glib::ustring > Gsv::Language::get_globs | ( |  | ) | const

Returns the globs associated to this language.

This is just a utility wrapper around get_metadata() to retrieve the "globs" metadata property and split it into an array.

Returns
  An array containing the globs.

## ◆ get_hidden()

bool Gsv::Language::get_hidden | ( |  | ) | const

Returns whether the language should be hidden from the user.

Returns
  `true` if the language should be hidden, `false` otherwise.

## ◆ get_id()

Glib::ustring Gsv::Language::get_id | ( |  | ) | const

Returns the ID of a language.

The ID is not locale-dependent.

Returns
  The ID of a language.

## ◆ get_metadata()

Glib::ustring Gsv::Language::get_metadata | ( | const Glib::ustring & | name | ) | const

Returns metadata of a language.

Parameters

  name | Metadata property name.

Returns
  Value of property name stored in the metadata of language or empty string if language doesn't contain that metadata property.

## ◆ get_mime_types()

std::vector< Glib::ustring > Gsv::Language::get_mime_types | ( |  | ) | const

Returns the mime types associated to this language.

This is just a utility wrapper around get_metadata() to retrieve the "mimetypes" metadata property and split it into an array.

Returns
  An array containing the mime types.

## ◆ get_name()

Glib::ustring Gsv::Language::get_name | ( |  | ) | const

Returns the localized name of the language.

Returns
  The name of a language.

## ◆ get_section()

Glib::ustring Gsv::Language::get_section | ( |  | ) | const

Returns the localized section of the language.

Each language belong to a section (ex. HTML belogs to the Markup section).

Returns
  The section of a language.

## ◆ get_style_fallback()

Glib::ustring Gsv::Language::get_style_fallback | ( | const Glib::ustring & | style_id | ) | const

Returns the ID of the style to use if the specified style_id is not present in the current style scheme.

Parameters

  style_id | a style ID.

Returns
  the ID of the style to use if the specified style_id is not present in the current style scheme or NULL if the style has no fallback defined. The returned string is owned by the language and must not be modified. @newin {3,4}

## ◆ get_style_ids()

std::vector< Glib::ustring > Gsv::Language::get_style_ids | ( |  | ) | const

Returns the ids of the styles defined by this language.

Returns
  An array containing ids of the styles defined by this language.

## ◆ get_style_name()

Glib::ustring Gsv::Language::get_style_name | ( | const Glib::ustring & | style_id | ) | const

Returns the name of the style with ID style_id defined by this language.

Parameters

  style_id | A style ID.

Returns
  The name of the style with ID style_id defined by this language or empty string if the style has no name or there is no style with ID style_id defined by this language.

## ◆ get_type()

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

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

## ◆ gobj() [1/2]

GtkSourceLanguage * Gsv::Language::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkSourceLanguage * Gsv::Language::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkSourceLanguage * Gsv::Language::gobj_copy | ( |  | ) |

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

## ◆ operator=()

Language& Gsv::Language::operator= | ( | Language&& | src | ) |
| noexcept

## ◆ property_hidden()

Glib::PropertyProxy_ReadOnly< bool > Gsv::Language::property_hidden | ( |  | ) | const

Whether the language should be hidden from the user.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_id()

Glib::PropertyProxy_ReadOnly< std::string > Gsv::Language::property_id | ( |  | ) | const

Language id.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_name()

Glib::PropertyProxy_ReadOnly< std::string > Gsv::Language::property_name | ( |  | ) | const

Language name.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_section()

Glib::PropertyProxy_ReadOnly< std::string > Gsv::Language::property_section | ( |  | ) | const

Language section.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gsv::Language > wrap | ( | GtkSourceLanguage * | 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.