| GNOME Dictionary Library Reference Manual | ||||
|---|---|---|---|---|
enum GdictSourceError; GdictSource; GdictSourceClass; GdictSource* gdict_source_new (void);gboolean gdict_source_load_from_file (GdictSource *source, constgchar *filename,GError **error);gboolean gdict_source_load_from_data (GdictSource *source, constgchar *data,gsize length,GError **error);gchar * gdict_source_to_data (GdictSource *source,gsize *length,GError **error);void gdict_source_set_name (GdictSource *source, constgchar *name); constgchar * gdict_source_get_name (GdictSource *source);void gdict_source_set_description (GdictSource *source, constgchar *description); constgchar * gdict_source_get_description (GdictSource *source);void gdict_source_set_database (GdictSource *source, constgchar *database); constgchar * gdict_source_get_database (GdictSource *source);void gdict_source_set_strategy (GdictSource *source, constgchar *strategy); constgchar * gdict_source_get_strategy (GdictSource *source); enum GdictSourceTransport;void gdict_source_set_transport (GdictSource *source, GdictSourceTransport transport, constgchar *first_transport_property, ...);void gdict_source_set_transportv (GdictSource *source, GdictSourceTransport transport, constgchar *first_transport_property,va_list var_args); GdictSourceTransport gdict_source_get_transport (GdictSource *source);GdictContext * gdict_source_get_context (GdictSource *source);GdictContext * gdict_source_peek_context (GdictSource *source);
"context"GdictContext * : Read "database"gchar * : Read / Write "description"gchar * : Read / Write "filename"gchar * : Read "name"gchar * : Read / Write "strategy"gchar * : Read / Write "transport" GdictSourceTransport : Read / Write
GdictSource is the representation of a
By using a GdictSource object you can retrieve the appropriate
typedef enum
{
GDICT_SOURCE_ERROR_PARSE,
GDICT_SOURCE_ERROR_INVALID_NAME,
GDICT_SOURCE_ERROR_INVALID_TRANSPORT,
GDICT_SOURCE_ERROR_INVALID_BAD_PARAMETER
} GdictSourceError;
GdictSource* gdict_source_new (void);
Creates an empty GdictSource object. Use gdict_load_from_file()
| Returns : | an empty GdictSource |
gboolean gdict_source_load_from_file (GdictSource *source, constgchar *filename,GError **error);
Loads a dictionary source definition file into an empty GdictSource object.
source : |
an empty GdictSource |
filename : |
path to a dictionary source file |
error : |
return location for a NULL |
| Returns : | TRUEfilename was loaded successfully.
|
Since 1.0
gboolean gdict_source_load_from_data (GdictSource *source, constgchar *data,gsize length,GError **error);
Loads a dictionary source definition from data inside an empty
GdictSource object.
source : |
a GdictSource |
data : |
string containing a dictionary source |
length : |
length of data
|
error : |
return location for a NULL |
| Returns : | TRUEfilename was loaded successfully.
|
Since 1.0
gchar * gdict_source_to_data (GdictSource *source,gsize *length,GError **error);
Outputs a dictionary source as a string.
source : |
a GdictSource |
length : |
return loaction for the length of the string, or NULL |
error : |
return location for a NULL |
| Returns : | a newly allocated string holding the contents of source.
|
Since 1.0
void gdict_source_set_name (GdictSource *source, constgchar *name);
Sets name as the displayable name of the dictionary source.
source : |
a GdictSource |
name : |
the UTF8-encoded name of the dictionary source |
Since 1.0
constgchar * gdict_source_get_name (GdictSource *source);
Retrieves the name of source.
source : |
a GdictSource |
| 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
void gdict_source_set_description (GdictSource *source, constgchar *description);
Sets the description of source. If description is NULL
source : |
a GdictSource |
description : |
a UTF-8 encoded description or NULL |
Since 1.0
constgchar * gdict_source_get_description (GdictSource *source);
Retrieves the description of source.
source : |
a GdictSource |
| 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
void gdict_source_set_database (GdictSource *source, constgchar *database);
Sets the default database of source. If database is NULL
source : |
a GdictSource |
database : |
a UTF-8 encoded database name or NULL |
Since 1.0
constgchar * gdict_source_get_database (GdictSource *source);
Retrieves the default database of source.
source : |
a GdictSource |
| 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
void gdict_source_set_strategy (GdictSource *source, constgchar *strategy);
Sets the description of source. If strategy is NULL
source : |
a GdictSource |
strategy : |
a UTF-8 encoded strategy or NULL |
Since 1.0
constgchar * gdict_source_get_strategy (GdictSource *source);
Retrieves the default strategy of source.
source : |
a GdictSource |
| 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
typedef enum
{
GDICT_SOURCE_TRANSPORT_DICTD,
GDICT_SOURCE_TRANSPORT_INVALID /* only for debug */
} GdictSourceTransport;
void gdict_source_set_transport (GdictSource *source, GdictSourceTransport transport, constgchar *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 transport, property name/value pairs should be listed, with a NULLg_object_set()
Here's a simple example:
#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);
source : |
a GdictSource |
transport : |
a valid transport |
first_transport_property : |
property for the context bound to
the transport, or NULL |
... : |
property value for first property name, then additionary
properties, ending with NULL |
Since 1.0
void gdict_source_set_transportv (GdictSource *source, GdictSourceTransport transport, constgchar *first_transport_property,va_list var_args);
FIXME
source : |
a GdictSource |
transport : |
a GdictSourceTransport |
first_transport_property : |
FIXME |
var_args : |
FIXME |
Since 1.0
GdictSourceTransport gdict_source_get_transport (GdictSource *source);
FIXME
source : |
a GdictSource |
| Returns : | FIXME |
Since 1.0
GdictContext * gdict_source_get_context (GdictSource *source);
Gets the source.
source : |
a GdictSource |
| Returns : | a source. Use g_object_unref() |
Since 1.0
GdictContext * gdict_source_peek_context (GdictSource *source);
Gets the 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().
source : |
a GdictSource |
| Returns : | a referenced g_object_unref() |
Since 1.0
"context" property"context"GdictContext * : Read
The
Since 1.0
"database" property"database"gchar * : Read / Write
The default database of this dictionary source.
Default value: NULL
Since 1.0
"description" property"description"gchar * : Read / Write
The description of this dictionary source.
Default value: NULL
Since 1.0
"filename" property"filename"gchar * : Read
The filename used by this dictionary source.
Default value: NULL
Since 1.0
"name" property"name"gchar * : Read / Write
The display name of this dictionary source.
Default value: NULL
Since 1.0
"strategy" property"strategy"gchar * : Read / Write
The default strategy of this dictionary source.
Default value: NULL
Since 1.0
"transport" property"transport" GdictSourceTransport : Read / Write
The transport mechanism used by this source.
Default value: GDICT_SOURCE_TRANSPORT_INVALID
Since 1.0