gtksourceview::SourceLanguageManager Class Reference

manages the languages supported by the SourceBuffer. More...

Inherits Glib::Object.

Collaboration diagram for gtksourceview::SourceLanguageManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~SourceLanguageManager ()
GtkSourceLanguageManager* gobj ()
 Provides access to the underlying C GObject.
const GtkSourceLanguageManager* gobj () const
 Provides access to the underlying C GObject.
GtkSourceLanguageManager* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::StringArrayHandle get_search_path () const
 Gets the list directories where lm looks for language files.
void set_search_path (const Glib::StringArrayHandle& dirs)
 Sets the list of directories where the lm looks for language files.
void reset_search_path ()
Glib::StringArrayHandle get_language_ids () const
 Returns: a 0-terminated array of string containing the ids of the.
Glib::RefPtr< SourceLanguageget_language (const Glib::ustring& id)
 Gets the Gtk::SourceLanguage identified by the given id in the language manager.
Glib::RefPtr< const
SourceLanguage
get_language (const Glib::ustring& id) const
 Gets the Gtk::SourceLanguage identified by the given id in the language manager.
Glib::RefPtr< SourceLanguageguess_language (const Glib::ustring& filename, const Glib::ustring& content_type)
 Picks a Gtk::SourceLanguage for given file name and content type, according to the information in lang files.
Glib::RefPtr< const
SourceLanguage
guess_language (const Glib::ustring& filename, const Glib::ustring& content_type) const
 Picks a Gtk::SourceLanguage for given file name and content type, according to the information in lang files.

Static Public Member Functions

static Glib::RefPtr
< SourceLanguageManager
create ()
 creates an instance of SourceLanguageManager
static Glib::RefPtr
< SourceLanguageManager
get_default ()
 Returns: a Gtk::SourceLanguageManager.

Protected Member Functions

 SourceLanguageManager ()

Related Functions

(Note that these are not member functions.)



Glib::RefPtr
< gtksourceview::SourceLanguageManager
wrap (GtkSourceLanguageManager* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

manages the languages supported by the SourceBuffer.


Constructor & Destructor Documentation

virtual gtksourceview::SourceLanguageManager::~SourceLanguageManager (  )  [virtual]
gtksourceview::SourceLanguageManager::SourceLanguageManager (  )  [protected]

Member Function Documentation

static Glib::RefPtr<SourceLanguageManager> gtksourceview::SourceLanguageManager::create (  )  [static]

creates an instance of SourceLanguageManager

Returns:
the newly created instance of SourceLanguageManager
static Glib::RefPtr<SourceLanguageManager> gtksourceview::SourceLanguageManager::get_default (  )  [static]

Returns: a Gtk::SourceLanguageManager.

Return value is owned

Returns:
A Gtk::SourceLanguageManager. Return value is owned by GtkSourceView library and must not be unref'ed.
Glib::RefPtr<const SourceLanguage> gtksourceview::SourceLanguageManager::get_language ( const Glib::ustring id  )  const

Gets the Gtk::SourceLanguage identified by the given id in the language manager.

Parameters:
id A language id.
Returns:
A Gtk::SourceLanguage, or 0 if there is no language identified by the given id. Return value is owned by lm and should not be freed.
Glib::RefPtr<SourceLanguage> gtksourceview::SourceLanguageManager::get_language ( const Glib::ustring id  ) 

Gets the Gtk::SourceLanguage identified by the given id in the language manager.

Parameters:
id A language id.
Returns:
A Gtk::SourceLanguage, or 0 if there is no language identified by the given id. Return value is owned by lm and should not be freed.
Glib::StringArrayHandle gtksourceview::SourceLanguageManager::get_language_ids (  )  const

Returns: a 0-terminated array of string containing the ids of the.

Returns:
A 0-terminated array of string containing the ids of the available languages or 0 if no language is available. The array is owned by lm and must not be modified.
Glib::StringArrayHandle gtksourceview::SourceLanguageManager::get_search_path (  )  const

Gets the list directories where lm looks for language files.

Returns:
0-terminated array containg a list of language files directories. The array is owned by lm and must not be modified.
const GtkSourceLanguageManager* gtksourceview::SourceLanguageManager::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GtkSourceLanguageManager* gtksourceview::SourceLanguageManager::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GtkSourceLanguageManager* gtksourceview::SourceLanguageManager::gobj_copy (  ) 

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

Glib::RefPtr<const SourceLanguage> gtksourceview::SourceLanguageManager::guess_language ( const Glib::ustring filename,
const Glib::ustring content_type 
) const

Picks a Gtk::SourceLanguage for given file name and content type, according to the information in lang files.

Either filename or content_type may be 0. This function can be used as follows:

<informalexample><programlisting> GtkSourceLanguage *lang; lang = gtk_source_language_manager_guess_language (filename, 0); gtk_source_buffer_set_language (buffer, lang); </programlisting></informalexample>

or

<informalexample><programlisting> GtkSourceLanguage *lang = 0; bool result_uncertain; gchar *content_type;

content_type = g_content_type_guess (filename, 0, 0, &result_uncertain); if (result_uncertain) { g_free (content_type); content_type = 0; }

lang = gtk_source_language_manager_guess_language (manager, filename, content_type); gtk_source_buffer_set_language (buffer, lang);

g_free (content_type); </programlisting></informalexample>

etc. Use get_mime_types() and get_globs() if you need full control over file -> language mapping.

Parameters:
filename A filename in Glib filename encoding, or 0.
content_type A content type (as in GIO API), or 0.
Returns:
A Gtk::SourceLanguage, or 0 if there is no suitable language for given filename and/or content_type. Return value is owned by lm and should not be freed.
Since gtksourceviewmm 2.4:
Glib::RefPtr<SourceLanguage> gtksourceview::SourceLanguageManager::guess_language ( const Glib::ustring filename,
const Glib::ustring content_type 
)

Picks a Gtk::SourceLanguage for given file name and content type, according to the information in lang files.

Either filename or content_type may be 0. This function can be used as follows:

<informalexample><programlisting> GtkSourceLanguage *lang; lang = gtk_source_language_manager_guess_language (filename, 0); gtk_source_buffer_set_language (buffer, lang); </programlisting></informalexample>

or

<informalexample><programlisting> GtkSourceLanguage *lang = 0; bool result_uncertain; gchar *content_type;

content_type = g_content_type_guess (filename, 0, 0, &result_uncertain); if (result_uncertain) { g_free (content_type); content_type = 0; }

lang = gtk_source_language_manager_guess_language (manager, filename, content_type); gtk_source_buffer_set_language (buffer, lang);

g_free (content_type); </programlisting></informalexample>

etc. Use get_mime_types() and get_globs() if you need full control over file -> language mapping.

Parameters:
filename A filename in Glib filename encoding, or 0.
content_type A content type (as in GIO API), or 0.
Returns:
A Gtk::SourceLanguage, or 0 if there is no suitable language for given filename and/or content_type. Return value is owned by lm and should not be freed.
Since gtksourceviewmm 2.4:
void gtksourceview::SourceLanguageManager::reset_search_path (  ) 
void gtksourceview::SourceLanguageManager::set_search_path ( const Glib::StringArrayHandle dirs  ) 

Sets the list of directories where the lm looks for language files.

If dirs is 0, the search path is reset to default.

<note>

At the moment this function can be called only before the language files are loaded for the first time. In practice to set a custom search path for a Gtk::SourceLanguageManager, you have to call this function right after creating it.

</note>

Parameters:
dirs A 0-terminated array of strings or 0.

Friends And Related Function Documentation

Glib::RefPtr< gtksourceview::SourceLanguageManager > wrap ( GtkSourceLanguageManager *  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:

Generated on 13 Jan 2010 for gtksourceviewmm by  doxygen 1.6.1