Top |
Functions
GdictSource * | gdict_source_new () |
gboolean | gdict_source_load_from_file () |
gboolean | gdict_source_load_from_data () |
gchar * | gdict_source_to_data () |
void | gdict_source_set_name () |
const gchar * | gdict_source_get_name () |
void | gdict_source_set_description () |
const gchar * | gdict_source_get_description () |
void | gdict_source_set_database () |
const gchar * | gdict_source_get_database () |
void | gdict_source_set_strategy () |
const gchar * | gdict_source_get_strategy () |
void | gdict_source_set_transport () |
void | gdict_source_set_transportv () |
GdictSourceTransport | gdict_source_get_transport () |
GdictContext * | gdict_source_get_context () |
GdictContext * | gdict_source_peek_context () |
Properties
GdictContext * | context | Read |
gchar * | database | Read / Write |
gchar * | description | Read / Write |
gboolean | editable | Read |
gchar * | filename | Read |
gchar * | name | Read / Write |
gchar * | strategy | Read / Write |
GdictSourceTransport | transport | Read / Write |
Types and Values
enum | GdictSourceError |
struct | GdictSource |
struct | GdictSourceClass |
enum | GdictSourceTransport |
Description
GdictSource is the representation of a GdictContext. Each dictionary source provides a list of available dictionaries (databases) and a list of available matching strategies. Using a GdictContext you can query the dictionary source for matching words and for definitions.
By using a GdictSource object you can retrieve the appropriate GdictContext, already set up with the right parameters.
Functions
gdict_source_new ()
GdictSource *
gdict_source_new (void
);
Creates an empty GdictSource object. Use gdict_load_from_file()
to
read an existing dictionary source definition file.
gdict_source_load_from_file ()
gboolean gdict_source_load_from_file (GdictSource *source
,const gchar *filename
,GError **error
);
Loads a dictionary source definition file into an empty GdictSource object.
Parameters
source |
an empty GdictSource |
|
filename |
path to a dictionary source file |
|
error |
return location for a GError or |
Since: 1.0
gdict_source_load_from_data ()
gboolean gdict_source_load_from_data (GdictSource *source
,const gchar *data
,gsize length
,GError **error
);
Loads a dictionary source definition from data
inside an empty
GdictSource object.
Parameters
source |
||
data |
string containing a dictionary source |
|
length |
length of |
|
error |
return location for a GError or |
Since: 1.0
gdict_source_to_data ()
gchar * gdict_source_to_data (GdictSource *source
,gsize *length
,GError **error
);
Outputs a dictionary source as a string.
Parameters
source |
||
length |
return loaction for the length
of the string, or |
[out][optional] |
error |
return location for a GError or |
Since: 1.0
gdict_source_set_name ()
void gdict_source_set_name (GdictSource *source
,const gchar *name
);
Sets name
as the displayable name of the dictionary source.
Since: 1.0
gdict_source_get_name ()
const gchar *
gdict_source_get_name (GdictSource *source
);
Retrieves the name of source
.
Returns
the name of a GdictSource. The returned string is owned by the GdictSource object, and should not be modified or freed.
Since: 1.0
gdict_source_set_description ()
void gdict_source_set_description (GdictSource *source
,const gchar *description
);
Sets the description of source
. If description
is NULL
, unsets the
currently set description.
Since: 1.0
gdict_source_get_description ()
const gchar *
gdict_source_get_description (GdictSource *source
);
Retrieves the description of source
.
Returns
the description of a GdictSource. The returned string is owned by the GdictSource object, and should not be modified or freed.
Since: 1.0
gdict_source_set_database ()
void gdict_source_set_database (GdictSource *source
,const gchar *database
);
Sets the default database of source
. If database
is NULL
, unsets the
currently set database.
Since: 1.0
gdict_source_get_database ()
const gchar *
gdict_source_get_database (GdictSource *source
);
Retrieves the default database of source
.
Returns
the default strategy of a GdictSource. The returned string is owned by the GdictSource object, and should not be modified or freed.
Since: 1.0
gdict_source_set_strategy ()
void gdict_source_set_strategy (GdictSource *source
,const gchar *strategy
);
Sets the description of source
. If strategy
is NULL
, unsets the
currently set strategy.
Since: 1.0
gdict_source_get_strategy ()
const gchar *
gdict_source_get_strategy (GdictSource *source
);
Retrieves the default strategy of source
.
Returns
the default strategy of a GdictSource. The returned string is owned by the GdictSource object, and should not be modified or freed.
Since: 1.0
gdict_source_set_transport ()
void gdict_source_set_transport (GdictSource *source
,GdictSourceTransport transport
,const gchar *first_transport_property
,...
);
Sets transport
as the choosen transport for source
. The transport
argument is a method of retrieving dictionary data from a source; it is
used to create the right GdictContext for this GdictSource. After
transport
, property name/value pairs should be listed, with a NULL
pointer ending the list. Properties are the same passed to a GdictContext
implementation instance using g_object_set()
.
Here's a simple example:
1 2 3 4 5 6 7 8 |
#include <gdict/gdict.h> GdictSource *source = gdict_source_new (); gdict_source_set_name (source, "My Source"); gdict_source_set_transport (source, GDICT_SOURCE_TRANSPORT_DICTD, "hostname", "dictionary-server.org", "port", 2628, NULL); |
Parameters
source |
||
transport |
a valid transport |
|
first_transport_property |
property for the context bound to
the transport, or |
|
... |
property value for first property name, then additionary
properties, ending with |
Since: 1.0
gdict_source_set_transportv ()
void gdict_source_set_transportv (GdictSource *source
,GdictSourceTransport transport
,const gchar *first_transport_property
,va_list var_args
);
FIXME
Since: 1.0
gdict_source_get_transport ()
GdictSourceTransport
gdict_source_get_transport (GdictSource *source
);
FIXME
Since: 1.0
gdict_source_get_context ()
GdictContext *
gdict_source_get_context (GdictSource *source
);
Gets the GdictContext bound to source
.
Returns
a GdictContext for source
.
Use g_object_unref()
when you don't need it anymore.
[transfer full]
Since: 1.0
gdict_source_peek_context ()
GdictContext *
gdict_source_peek_context (GdictSource *source
);
Gets the GdictContext bound to source
. The returned object is a
referenced copy of the context held by source
; if you want a different
instance, use gdict_source_get_context()
.
Since: 1.0
Property Details
The “context”
property
“context” GdictContext *
The GdictContext bound to this source.
Flags: Read
Since: 1.0
The “database”
property
“database” gchar *
The default database of this dictionary source.
Flags: Read / Write
Default value: NULL
Since: 1.0
The “description”
property
“description” gchar *
The description of this dictionary source.
Flags: Read / Write
Default value: NULL
Since: 1.0
The “editable”
property
“editable” gboolean
Whether the dictionary source is editable or not.
Flags: Read
Default value: TRUE
Since: 1.0
The “filename”
property
“filename” gchar *
The filename used by this dictionary source.
Flags: Read
Default value: NULL
Since: 1.0
The “name”
property
“name” gchar *
The display name of this dictionary source.
Flags: Read / Write
Default value: NULL
Since: 1.0
The “strategy”
property
“strategy” gchar *
The default strategy of this dictionary source.
Flags: Read / Write
Default value: NULL
Since: 1.0
The “transport”
property
“transport” GdictSourceTransport
The transport mechanism used by this source.
Flags: Read / Write
Default value: GDICT_SOURCE_TRANSPORT_INVALID
Since: 1.0