Blame src/ibusunicode.h

Packit Service 1d8f1c
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
Packit Service 1d8f1c
/* vim:set et sts=4: */
Packit Service 1d8f1c
/* bus - The Input Bus
Packit Service 1d8f1c
 * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
Packit Service 1d8f1c
 * Copyright (C) 2018 Red Hat, Inc.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * This library is free software; you can redistribute it and/or
Packit Service 1d8f1c
 * modify it under the terms of the GNU Lesser General Public
Packit Service 1d8f1c
 * License as published by the Free Software Foundation; either
Packit Service 1d8f1c
 * version 2.1 of the License, or (at your option) any later version.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * This library is distributed in the hope that it will be useful,
Packit Service 1d8f1c
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 1d8f1c
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 1d8f1c
 * Lesser General Public License for more details.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * You should have received a copy of the GNU Lesser General Public
Packit Service 1d8f1c
 * License along with this library; if not, write to the Free Software
Packit Service 1d8f1c
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
Packit Service 1d8f1c
 * USA
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
Packit Service 1d8f1c
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
Packit Service 1d8f1c
#error "Only <ibus.h> can be included directly"
Packit Service 1d8f1c
#endif
Packit Service 1d8f1c
Packit Service 1d8f1c
#ifndef __IBUS_UNICODE_H_
Packit Service 1d8f1c
#define __IBUS_UNICODE_H_
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * SECTION: ibusunicode
Packit Service 1d8f1c
 * @short_description: unicode utility.
Packit Service 1d8f1c
 * @stability: Unstable
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * miscellaneous unicode APIs.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
Packit Service 1d8f1c
#include <gio/gio.h>
Packit Service 1d8f1c
#include "ibusserializable.h"
Packit Service 1d8f1c
Packit Service 1d8f1c
/*
Packit Service 1d8f1c
 * Type macros.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
/* define GOBJECT macros */
Packit Service 1d8f1c
#define IBUS_TYPE_UNICODE_DATA       (ibus_unicode_data_get_type ())
Packit Service 1d8f1c
#define IBUS_UNICODE_DATA(obj)       (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
Packit Service 1d8f1c
                                      IBUS_TYPE_UNICODE_DATA, IBusUnicodeData))
Packit Service 1d8f1c
#define IBUS_UNICODE_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
Packit Service 1d8f1c
                                      IBUS_TYPE_UNICODE_DATA, \
Packit Service 1d8f1c
                                      IBusUnicodeDataClass))
Packit Service 1d8f1c
#define IBUS_IS_UNICODE_DATA(obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
Packit Service 1d8f1c
                                      IBUS_TYPE_UNICODE_DATA))
Packit Service 1d8f1c
#define IBUS_TYPE_UNICODE_BLOCK      (ibus_unicode_block_get_type ())
Packit Service 1d8f1c
#define IBUS_UNICODE_BLOCK(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
Packit Service 1d8f1c
                                      IBUS_TYPE_UNICODE_BLOCK, \
Packit Service 1d8f1c
                                      IBusUnicodeBlock))
Packit Service 1d8f1c
#define IBUS_UNICODE_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
Packit Service 1d8f1c
                                      IBUS_TYPE_UNICODE_BLOCK, \
Packit Service 1d8f1c
                                      IBusUnicodeBlockClass))
Packit Service 1d8f1c
#define IBUS_IS_UNICODE_BLOCK(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
Packit Service 1d8f1c
                                      IBUS_TYPE_UNICODE_BLOCK))
Packit Service 1d8f1c
Packit Service 1d8f1c
Packit Service 1d8f1c
G_BEGIN_DECLS
Packit Service 1d8f1c
Packit Service 1d8f1c
typedef struct _IBusUnicodeData IBusUnicodeData;
Packit Service 1d8f1c
typedef struct _IBusUnicodeDataPrivate IBusUnicodeDataPrivate;
Packit Service 1d8f1c
typedef struct _IBusUnicodeDataClass IBusUnicodeDataClass;
Packit Service 1d8f1c
typedef struct _IBusUnicodeBlock IBusUnicodeBlock;
Packit Service 1d8f1c
typedef struct _IBusUnicodeBlockPrivate IBusUnicodeBlockPrivate;
Packit Service 1d8f1c
typedef struct _IBusUnicodeBlockClass IBusUnicodeBlockClass;
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * IBusUnicodeDataLoadAsyncFinish:
Packit Service 1d8f1c
 * @data_list: (transfer full) (element-type IBusUnicodeData):
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * This callback can receive the list of #IBusUnicodeData.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
typedef void (*IBusUnicodeDataLoadAsyncFinish) (GSList  *data_list,
Packit Service 1d8f1c
                                                gpointer user_data);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * IBusUnicodeData:
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Unicode data likes code, name, alias, block-name.
Packit Service 1d8f1c
 * You can get extended values with g_object_get_properties.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
struct _IBusUnicodeData {
Packit Service 1d8f1c
    IBusSerializable parent;
Packit Service 1d8f1c
    /* instance members */
Packit Service 1d8f1c
Packit Service 1d8f1c
    /*< public >*/
Packit Service 1d8f1c
    /*< private >*/
Packit Service 1d8f1c
    IBusUnicodeDataPrivate *priv;
Packit Service 1d8f1c
};
Packit Service 1d8f1c
Packit Service 1d8f1c
struct _IBusUnicodeDataClass {
Packit Service 1d8f1c
    IBusSerializableClass parent;
Packit Service 1d8f1c
    /* class members */
Packit Service 1d8f1c
};
Packit Service 1d8f1c
Packit Service 1d8f1c
struct _IBusUnicodeBlock {
Packit Service 1d8f1c
    IBusSerializable parent;
Packit Service 1d8f1c
    /* instance members */
Packit Service 1d8f1c
Packit Service 1d8f1c
    /*< public >*/
Packit Service 1d8f1c
    /*< private >*/
Packit Service 1d8f1c
    IBusUnicodeBlockPrivate *priv;
Packit Service 1d8f1c
};
Packit Service 1d8f1c
Packit Service 1d8f1c
struct _IBusUnicodeBlockClass {
Packit Service 1d8f1c
    IBusSerializableClass parent;
Packit Service 1d8f1c
    /* class members */
Packit Service 1d8f1c
};
Packit Service 1d8f1c
Packit Service 1d8f1c
GType           ibus_unicode_data_get_type    (void);
Packit Service 1d8f1c
GType           ibus_unicode_block_get_type   (void);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_new:
Packit Service 1d8f1c
 * @first_property_name: Name of the first property.
Packit Service 1d8f1c
 * @...: the NULL-terminated arguments of the properties and values.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Creates a new #IBusUnicodeData.
Packit Service 1d8f1c
 * code property is required. e.g.
Packit Service 1d8f1c
 * ibus_unicode_data_new ("code", 0x3042, NULL)
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: A newly allocated #IBusUnicodeData.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
IBusUnicodeData * ibus_unicode_data_new       (const gchar *first_property_name,
Packit Service 1d8f1c
                                               ...);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_get_code:
Packit Service 1d8f1c
 * @unicode: An #IBusUnicodeData
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the code point in #IBusUnicodeData.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: code property in #IBusUnicodeData
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
gunichar          ibus_unicode_data_get_code  (IBusUnicodeData    *unicode);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_get_name:
Packit Service 1d8f1c
 * @unicode: An #IBusUnicodeData
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the name in #IBusUnicodeData. It should not be freed.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: name property in #IBusUnicodeData
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
const gchar *     ibus_unicode_data_get_name  (IBusUnicodeData    *unicode);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_get_alias:
Packit Service 1d8f1c
 * @unicode: An #IBusUnicodeData
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the alias in #IBusUnicodeData. It should not be freed.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: alias property in #IBusUnicodeData
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
const gchar *     ibus_unicode_data_get_alias (IBusUnicodeData    *unicode);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_get_block_name:
Packit Service 1d8f1c
 * @unicode: An #IBusUnicodeData
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the block name in #IBusUnicodeData. It should not be freed.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: block-name property in #IBusUnicodeData
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
const gchar *     ibus_unicode_data_get_block_name
Packit Service 1d8f1c
                                              (IBusUnicodeData    *unicode);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_set_block_name:
Packit Service 1d8f1c
 * @unicode: An #IBusUnicodeData
Packit Service 1d8f1c
 * @block_name: A block name
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Sets the block name in #IBusUnicodeData.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
void              ibus_unicode_data_set_block_name
Packit Service 1d8f1c
                                              (IBusUnicodeData    *unicode,
Packit Service 1d8f1c
                                               const gchar        *block_name);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_save:
Packit Service 1d8f1c
 * @path: A path of the saved Unicode data.
Packit Service 1d8f1c
 * @list: (element-type IBusUnicodeData) (transfer none): A list of unicode
Packit Service 1d8f1c
 *  data.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Save the list of #IBusUnicodeData to the cache file.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
void              ibus_unicode_data_save      (const gchar        *path,
Packit Service 1d8f1c
                                               GSList             *list);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_load:
Packit Service 1d8f1c
 * @path: A path of the saved dictionary file.
Packit Service 1d8f1c
 * @object: (nullable): If the #GObject has "unicode-deserialize-progress"
Packit Service 1d8f1c
 *    signal, this function will emit (the number of desrialized
Packit Service 1d8f1c
 *    #IBusUnicodeData, * the total number of #IBusUnicodeData) of uint values
Packit Service 1d8f1c
 *    with that signal by 100 times. Otherwise %NULL.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: (element-type IBusUnicodeData) (transfer container):
Packit Service 1d8f1c
 * An #IBusUnicodeData list loaded from the saved cache file.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
GSList *          ibus_unicode_data_load      (const gchar        *path,
Packit Service 1d8f1c
                                               GObject            *object);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_data_load_async:
Packit Service 1d8f1c
 * @path: A path of the saved dictionary file.
Packit Service 1d8f1c
 * @object: (nullable): If the #GObject has "unicode-deserialize-progress"
Packit Service 1d8f1c
 *    signal, this function will emit (the number of desrialized
Packit Service 1d8f1c
 *    #IBusUnicodeData, * the total number of #IBusUnicodeData) of uint values
Packit Service 1d8f1c
 *    with that signal by 100 times. Otherwise %NULL.
Packit Service 1d8f1c
 * @cancellable: cancellable.
Packit Service 1d8f1c
 * @callback: (scope notified): IBusUnicodeDataLoadAsyncFinish.
Packit Service 1d8f1c
 * @user_data: User data.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * IBusUnicodeDataLoadAsyncFinish can receive the list of #IBusUnicodeData.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
void              ibus_unicode_data_load_async
Packit Service 1d8f1c
                                              (const gchar        *path,
Packit Service 1d8f1c
                                               GObject            *object,
Packit Service 1d8f1c
                                               GCancellable       *cancellable,
Packit Service 1d8f1c
                                               IBusUnicodeDataLoadAsyncFinish
Packit Service 1d8f1c
                                                                   callback,
Packit Service 1d8f1c
                                               gpointer            user_data);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_block_new:
Packit Service 1d8f1c
 * @first_property_name: Name of the first property.
Packit Service 1d8f1c
 * @...: the NULL-terminated arguments of the properties and values.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Creates a new #IBusUnicodeBlock.
Packit Service 1d8f1c
 * block property is required. e.g.
Packit Service 1d8f1c
 * ibus_unicode_block_new ("start", 0x0000, "end", "0x007f", "name", "basic",
Packit Service 1d8f1c
 * NULL)
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: A newly allocated #IBusUnicodeBlock.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
IBusUnicodeBlock *ibus_unicode_block_new      (const gchar *first_property_name,
Packit Service 1d8f1c
                                               ...);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_block_get_start:
Packit Service 1d8f1c
 * @block: An #IBusUnicodeData
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the start code point in #IBusUnicodeBlock.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: start property in #IBusUnicodeBlock
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
gunichar          ibus_unicode_block_get_start
Packit Service 1d8f1c
                                              (IBusUnicodeBlock   *block);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_block_get_end:
Packit Service 1d8f1c
 * @block: An #IBusUnicodeData
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the end code point in #IBusUnicodeBlock.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: end property in #IBusUnicodeBlock
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
gunichar          ibus_unicode_block_get_end
Packit Service 1d8f1c
                                              (IBusUnicodeBlock   *block);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_block_get_name:
Packit Service 1d8f1c
 * @block: An #IBusUnicodeBlock
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Gets the name in #IBusUnicodeBlock. It should not be freed.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: name property in #IBusUnicodeBlock
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
const gchar *     ibus_unicode_block_get_name (IBusUnicodeBlock   *block);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_block_save:
Packit Service 1d8f1c
 * @path: A path of the saved Unicode block.
Packit Service 1d8f1c
 * @list: (element-type IBusUnicodeBlock) (transfer none): A list of unicode
Packit Service 1d8f1c
 *  block.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Save the list of #IBusUnicodeBlock to the cache file.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
void              ibus_unicode_block_save     (const gchar        *path,
Packit Service 1d8f1c
                                               GSList             *list);
Packit Service 1d8f1c
Packit Service 1d8f1c
/**
Packit Service 1d8f1c
 * ibus_unicode_block_load:
Packit Service 1d8f1c
 * @path: A path of the saved dictionary file.
Packit Service 1d8f1c
 *
Packit Service 1d8f1c
 * Returns: (element-type IBusUnicodeBlock) (transfer container):
Packit Service 1d8f1c
 * An #IBusUnicodeBlock list loaded from the saved cache file.
Packit Service 1d8f1c
 */
Packit Service 1d8f1c
GSList *          ibus_unicode_block_load     (const gchar        *path);
Packit Service 1d8f1c
Packit Service 1d8f1c
G_END_DECLS
Packit Service 1d8f1c
#endif