# gtksourceview::SourceTag Class Reference

An attribute that can be applied to a range of text. More...

`#include <sourcetag.h>`

List of all members.

## Public Types
typedef SourceTag | CppObjectType
typedef SourceTag_Class | CppClassType
typedef GtkSourceTag | BaseObjectType
typedef GtkSourceTagClass | BaseClassType
## Public Member Functions
virtual | ~SourceTag ()
GtkSourceTag * | gobj ()
| Provides access to the underlying C GObject.
const GtkSourceTag * | gobj () const
| Provides access to the underlying C GObject.
GtkSourceTag * | 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
| getter of the tag ID.
SourceTagStyle | get_style () const
| getter of the tag style.
void | set_style (const SourceTagStyle &a_style)
| setter of the tag style.
## Static Public Member Functions
static GType | get_type () G_GNUC_CONST
static GType | get_base_type () G_GNUC_CONST
static Glib::RefPtr< SourceTag > | create_syntax_tag (const Glib::ustring &a_id, const Glib::ustring &a_name, const Glib::ustring &a_pat_start, const Glib::ustring &a_pat_end)
| create a syntax tag.
static Glib::RefPtr< SourceTag > | create_pattern_tag (const Glib::ustring &a_id, const Glib::ustring &a_name, const Glib::ustring &a_pattern)
| create a pattern tag.
static Glib::RefPtr< SourceTag > | create_keyword_list_tag (const Glib::ustring &a_id, const Glib::ustring &a_name, const Glib::SListHandle< const Glib::ustring > &a_keywords, bool a_case_sensitive=true, bool a_match_empty_string_at_beginning=true, bool a_match_empty_string_at_end=true, const Glib::ustring &a_beginning_regex="", const Glib::ustring &a_end_regex="")
| create a tag for a list of keywords.
static Glib::RefPtr< SourceTag > | create_line_comment_tag_new (const Glib::ustring &a_id, const Glib::ustring &a_name, const Glib::ustring &a_pattern_start)
| create a tag for a comment.
static Glib::RefPtr< SourceTag > | create_string_tag_new (const Glib::ustring &a_id, const Glib::ustring &a_name, const Glib::ustring &a_pattern_start, const Glib::ustring &a_pattern_end, bool a_end_at_line_end=true)
| create a tag for a string delimited by two patterns.
## Protected Member Functions
| SourceTag (const Glib::ConstructParams &construct_params)
| SourceTag (GtkSourceTag *castitem)
| SourceTag ()
## Friends
class | SourceTag_Class
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < gtksourceview::SourceTag > | wrap (GtkSourceTag *object, bool take_copy=false)

## Detailed Description

An attribute that can be applied to a range of text.

A tag is a an attribute that can be applied to a range of text One can associate style information to a given Tag. For example, a tag might be called "bold" and might make the text inside the tag bold. GtkSourceView uses SourceTag to perform syntax highlighting.

## Member Typedef Documentation

typedef SourceTag gtksourceview::SourceTag::CppObjectType

typedef SourceTag_Class gtksourceview::SourceTag::CppClassType

typedef GtkSourceTag gtksourceview::SourceTag::BaseObjectType

typedef GtkSourceTagClass gtksourceview::SourceTag::BaseClassType

## Constructor & Destructor Documentation

gtksourceview::SourceTag::SourceTag | ( | const Glib::ConstructParams & | construct_params | ) | `[explicit, protected]`

gtksourceview::SourceTag::SourceTag | ( | GtkSourceTag * | castitem | ) | `[explicit, protected]`

virtual gtksourceview::SourceTag::~SourceTag | ( |  | ) | `[virtual]`

gtksourceview::SourceTag::SourceTag | ( |  | ) | `[protected]`

## Member Function Documentation

static GType gtksourceview::SourceTag::get_type | ( |  | ) | `[static]`

static GType gtksourceview::SourceTag::get_base_type | ( |  | ) | `[static]`

GtkSourceTag* gtksourceview::SourceTag::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

const GtkSourceTag* gtksourceview::SourceTag::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

GtkSourceTag* gtksourceview::SourceTag::gobj_copy | ( |  | ) |

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

static Glib::RefPtr<SourceTag> gtksourceview::SourceTag::create_syntax_tag | ( | const Glib::ustring & | a_id,
|  | const Glib::ustring & | a_name,
|  | const Glib::ustring & | a_pat_start,
|  | const Glib::ustring & | a_pat_end |
| ) |  |  | `[static]`

create a syntax tag.

A syntax tag is a tag that applies to a region of text. The region is identified by a starting pattern and an ending pattern.

Parameters:

  | a_id | the ID of the tag. That ID must be unique accross all the tag IDs.
  | a_name | the name of the tag. Can be translatable.
  | a_pat_start | the regular expression pattern that describes the beginning of the region the tag applied to. See Grammar of SourceTag related patterns for more about the syntax.
  | a_pat_end | the pattern that describes the end of the region.

Returns:
  the newly created SourceTag

static Glib::RefPtr<SourceTag> gtksourceview::SourceTag::create_pattern_tag | ( | const Glib::ustring & | a_id,
|  | const Glib::ustring & | a_name,
|  | const Glib::ustring & | a_pattern |
| ) |  |  | `[static]`

create a pattern tag.

A pattern tag is a tag that applies to a word (keyword, or term). In this case The word is represented by a regular expression pattern.

Parameters:

  | a_id | the id of the tag. Must be unique accross all the pattter ids.
  | a_name | the name of the tag. Is a translatable string.
  | a_pattern | the word pattern.

static Glib::RefPtr<SourceTag> gtksourceview::SourceTag::create_keyword_list_tag | ( | const Glib::ustring & | a_id,
|  | const Glib::ustring & | a_name,
|  | const Glib::SListHandle< const Glib::ustring > & | a_keywords,
|  | bool | a_case_sensitive = `true`,
|  | bool | a_match_empty_string_at_beginning = `true`,
|  | bool | a_match_empty_string_at_end = `true`,
|  | const Glib::ustring & | a_beginning_regex = `""`,
|  | const Glib::ustring & | a_end_regex = `""` |
| ) |  |  | `[static]`

create a tag for a list of keywords.

This is a more user friendly wrapper to SourceTag::create_pattern_tag() .

Parameters:

  | a_id | the ID of the tag. Must be unique accross all tag IDs.
  | a_name | the name of the tag. Can be a translated string.
  | a_keywords | the list of keyword the tag applies to.
  | a_case_sensitive | wether the tag should match the keywords in a case sentive context or not.
  | a_match_empty_string_at_beginning | whether the tag should match an empty string at the beginning of keywords or not.
  | a_match_empty_string_at_end | wether the tag should match the an empty string at the end of keywords or not.
  | a_beginning_regex | a regex that that describes a pattern that can be present at the beginning of each keyword. If you don't understand what this is, just let it be.
  | a_end_regex | same as a_beginning_regex but applies for a pattern at the end the keywords.

Returns:
  the newly created SourceTag

static Glib::RefPtr<SourceTag> gtksourceview::SourceTag::create_line_comment_tag_new | ( | const Glib::ustring & | a_id,
|  | const Glib::ustring & | a_name,
|  | const Glib::ustring & | a_pattern_start |
| ) |  |  | `[static]`

create a tag for a comment.

This is a user friendly way to create a syntax tag for a one liner comment.

Parameters:

  | a_id | the ID of the of the tag. Must be unique accross all tag IDs.
  | a_name | the name of the tag. Can be a translated string.
  | a_pattern_start | the pattern of the beginning of the commented line. the tag will applied to the region located between by a_patter_start and the end of line.

Returns:
  the newly created SourceTag

static Glib::RefPtr<SourceTag> gtksourceview::SourceTag::create_string_tag_new | ( | const Glib::ustring & | a_id,
|  | const Glib::ustring & | a_name,
|  | const Glib::ustring & | a_pattern_start,
|  | const Glib::ustring & | a_pattern_end,
|  | bool | a_end_at_line_end = `true` |
| ) |  |  | `[static]`

create a tag for a string delimited by two patterns.

Parameters:

  | a_id | the ID of the tag. Must be unique accross all tag IDs.
  | a_name | the name of the tag. Can be a translated string.
  | a_pattern_start | the starting pattern of the string.
  | a_pattern_end | the ending pattern of the string.
  | a_end_at_line_end | whether the ending pattern should be suffixed by an end of line character.

Glib::ustring gtksourceview::SourceTag::get_id | ( |  | ) | const

getter of the tag ID.

Returns:
  the ID

SourceTagStyle gtksourceview::SourceTag::get_style | ( |  | ) | const

getter of the tag style.

Returns:
  the style

void gtksourceview::SourceTag::set_style | ( | const SourceTagStyle & | a_style | ) |

setter of the tag style.

Parameters:

  | a_style | the new style

## Friends And Related Function Documentation

friend class SourceTag_Class`[friend]`

Glib::RefPtr< gtksourceview::SourceTag > wrap | ( | GtkSourceTag * | 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.

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

- sourcetag.h