Blame src/ibusemoji.h

Packit 3ff832
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
Packit 3ff832
/* vim:set et sts=4: */
Packit 3ff832
/* bus - The Input Bus
Packit 3ff832
 * Copyright (C) 2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
Packit 3ff832
 * Copyright (C) 2017 Red Hat, Inc.
Packit 3ff832
 *
Packit 3ff832
 * This library is free software; you can redistribute it and/or
Packit 3ff832
 * modify it under the terms of the GNU Lesser General Public
Packit 3ff832
 * License as published by the Free Software Foundation; either
Packit 3ff832
 * version 2.1 of the License, or (at your option) any later version.
Packit 3ff832
 *
Packit 3ff832
 * This library is distributed in the hope that it will be useful,
Packit 3ff832
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 3ff832
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 3ff832
 * Lesser General Public License for more details.
Packit 3ff832
 *
Packit 3ff832
 * You should have received a copy of the GNU Lesser General Public
Packit 3ff832
 * License along with this library; if not, write to the Free Software
Packit 3ff832
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
Packit 3ff832
 * USA
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
Packit 3ff832
#error "Only <ibus.h> can be included directly"
Packit 3ff832
#endif
Packit 3ff832
Packit 3ff832
#ifndef __IBUS_EMOJI_H_
Packit 3ff832
#define __IBUS_EMOJI_H_
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * SECTION: ibusemoji
Packit 3ff832
 * @short_description: emoji utility.
Packit 3ff832
 * @stability: Unstable
Packit 3ff832
 *
Packit 3ff832
 * miscellaneous emoji APIs.
Packit 3ff832
 */
Packit 3ff832
Packit 3ff832
#include "ibusserializable.h"
Packit 3ff832
Packit 3ff832
/*
Packit 3ff832
 * Type macros.
Packit 3ff832
 */
Packit 3ff832
/* define GOBJECT macros */
Packit 3ff832
#define IBUS_TYPE_EMOJI_DATA         (ibus_emoji_data_get_type ())
Packit 3ff832
#define IBUS_EMOJI_DATA(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
Packit 3ff832
                                      IBUS_TYPE_EMOJI_DATA, IBusEmojiData))
Packit 3ff832
#define IBUS_EMOJI_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
Packit 3ff832
                                      IBUS_TYPE_EMOJI_DATA, IBusEmojiDataClass))
Packit 3ff832
#define IBUS_IS_EMOJI_DATA(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
Packit 3ff832
                                      IBUS_TYPE_EMOJI_DATA))
Packit 3ff832
Packit 3ff832
Packit 3ff832
G_BEGIN_DECLS
Packit 3ff832
Packit 3ff832
typedef struct _IBusEmojiData IBusEmojiData;
Packit 3ff832
typedef struct _IBusEmojiDataPrivate IBusEmojiDataPrivate;
Packit 3ff832
typedef struct _IBusEmojiDataClass IBusEmojiDataClass;
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * IBusEmojiData:
Packit 3ff832
 *
Packit 3ff832
 * Emoji data likes emoji unicode, annotations, description, category.
Packit 3ff832
 * You can get extended values with g_object_get_properties.
Packit 3ff832
 */
Packit 3ff832
struct _IBusEmojiData {
Packit 3ff832
    IBusSerializable parent;
Packit 3ff832
    /* instance members */
Packit 3ff832
Packit 3ff832
    /*< public >*/
Packit 3ff832
    /*< private >*/
Packit 3ff832
    IBusEmojiDataPrivate *priv;
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
struct _IBusEmojiDataClass {
Packit 3ff832
    IBusSerializableClass parent;
Packit 3ff832
    /* class members */
Packit 3ff832
};
Packit 3ff832
Packit 3ff832
GType           ibus_emoji_data_get_type     (void);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_new:
Packit 3ff832
 * @first_property_name: Name of the first property.
Packit 3ff832
 * @...: the NULL-terminated arguments of the properties and values.
Packit 3ff832
 *
Packit 3ff832
 * Creates a new #IBusEmojiData.
Packit 3ff832
 * emoji property is required. e.g.
Packit 3ff832
 * ibus_emoji_data_new ("emoji", "😁", NULL)
Packit 3ff832
 *
Packit 3ff832
 * Returns: A newly allocated #IBusEmojiData.
Packit 3ff832
 */
Packit 3ff832
IBusEmojiData * ibus_emoji_data_new          (const gchar *first_property_name,
Packit 3ff832
                                               ...);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_get_emoji:
Packit 3ff832
 * @emoji : An #IBusEmojiData
Packit 3ff832
 *
Packit 3ff832
 * Gets the emoji character in #IBusEmojiData. It should not be freed.
Packit 3ff832
 *
Packit 3ff832
 * Returns: emoji property in #IBusEmojiData
Packit 3ff832
 */
Packit 3ff832
const gchar *   ibus_emoji_data_get_emoji       (IBusEmojiData *emoji);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_get_annotations:
Packit 3ff832
 * @emoji : An #IBusEmojiData
Packit 3ff832
 *
Packit 3ff832
 * Gets the annotation list in #IBusEmojiData. It should not be freed.
Packit 3ff832
 *
Packit 3ff832
 * Returns: (transfer none) (element-type utf8):
Packit 3ff832
 *          annotation list property in #IBusEmojiData
Packit 3ff832
 */
Packit 3ff832
GSList *        ibus_emoji_data_get_annotations (IBusEmojiData *emoji);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_set_annotations:
Packit 3ff832
 * @emoji : An #IBusEmojiData
Packit 3ff832
 * @annotations: (transfer full) (element-type utf8): List of emoji annotations
Packit 3ff832
 *
Packit 3ff832
 * Sets the annotation list in #IBusEmojiData.
Packit 3ff832
 */
Packit 3ff832
void            ibus_emoji_data_set_annotations (IBusEmojiData *emoji,
Packit 3ff832
                                                 GSList        *annotations);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_get_description:
Packit 3ff832
 * @emoji : An #IBusEmojiData
Packit 3ff832
 *
Packit 3ff832
 * Gets the emoji description in #IBusEmojiData. It should not be freed.
Packit 3ff832
 *
Packit 3ff832
 * Returns: description property in #IBusEmojiData
Packit 3ff832
 */
Packit 3ff832
const gchar *   ibus_emoji_data_get_description (IBusEmojiData *emoji);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_set_description:
Packit 3ff832
 * @emoji : An #IBusEmojiData
Packit 3ff832
 * @description: An emoji description
Packit 3ff832
 *
Packit 3ff832
 * Sets the description in #IBusEmojiData.
Packit 3ff832
 */
Packit 3ff832
void            ibus_emoji_data_set_description (IBusEmojiData *emoji,
Packit 3ff832
                                                 const gchar   *description);
Packit 3ff832
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_get_category:
Packit 3ff832
 * @emoji : An #IBusEmojiData
Packit 3ff832
 *
Packit 3ff832
 * Gets the emoji category in #IBusEmojiData. It should not be freed.
Packit 3ff832
 *
Packit 3ff832
 * Returns: category property in #IBusEmojiData
Packit 3ff832
 */
Packit 3ff832
const gchar *   ibus_emoji_data_get_category    (IBusEmojiData *emoji);
Packit 3ff832
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_dict_save:
Packit 3ff832
 * @path: A path of the saved dictionary file.
Packit 3ff832
 * @dict: (element-type utf8 gpointer) (transfer none): An Emoji dictionary
Packit 3ff832
 *
Packit 3ff832
 * Saves the Emoji dictionary to the cache file.
Packit 3ff832
 * Recommend to use ibus_emoji_data_save() instead becase GSList in
Packit 3ff832
 * GHashTable does not work with Gir and Vala.
Packit 3ff832
 * Calls ibus_emoji_data_save() internally. The format of the hash table
Packit 3ff832
 * changed and now is { emoji character, #IBusEmojiData object }.
Packit 3ff832
 */
Packit 3ff832
void            ibus_emoji_dict_save            (const gchar    *path,
Packit 3ff832
                                                 GHashTable     *dict);
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_dict_load:
Packit 3ff832
 * @path: A path of the saved dictionary file.
Packit 3ff832
 *
Packit 3ff832
 * Returns: (element-type utf8 gpointer) (transfer none): An Emoji dictionary
Packit 3ff832
 * file loaded from the saved cache file.
Packit 3ff832
 *
Packit 3ff832
 * A hash table of { emoji character, #IBusEmojiData object } is loaded
Packit 3ff832
 * from the saved cache file.
Packit 3ff832
 * Recommend to use ibus_emoji_data_load() instead becase GSList in
Packit 3ff832
 * GHashTable does not work with Gir and Vala.
Packit 3ff832
 * Calls ibus_emoji_data_load() internally.
Packit 3ff832
 */
Packit 3ff832
GHashTable *    ibus_emoji_dict_load            (const gchar    *path);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_dict_lookup:
Packit 3ff832
 * @dict: (element-type utf8 IBusEmojiData) (transfer full): An Emoji dictionary
Packit 3ff832
 * @emoji: an emoji character
Packit 3ff832
 *
Packit 3ff832
 * Returns: (transfer none): An #IBusEmojiData of @emoji.
Packit 3ff832
 * This API was prepared for the old dict foramat with Gir and Vala
Packit 3ff832
 * but no longer needed.
Packit 3ff832
 * Use ibus_emoji_data_load() instead.
Packit 3ff832
 */
Packit 3ff832
IBusEmojiData * ibus_emoji_dict_lookup          (GHashTable     *dict,
Packit 3ff832
                                                 const gchar    *emoji);
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_save:
Packit 3ff832
 * @path: A path of the saved emoji data.
Packit 3ff832
 * @list: (element-type IBusEmojiData) (transfer none): A list of emoji data.
Packit 3ff832
 *
Packit 3ff832
 * Save the list of #IBusEmojiData to the cache file.
Packit 3ff832
 */
Packit 3ff832
void            ibus_emoji_data_save            (const gchar    *path,
Packit 3ff832
                                                 GSList         *list);
Packit 3ff832
Packit 3ff832
/**
Packit 3ff832
 * ibus_emoji_data_load:
Packit 3ff832
 * @path: A path of the saved dictionary file.
Packit 3ff832
 *
Packit 3ff832
 * Returns: (element-type IBusEmojiData) (transfer container):
Packit 3ff832
 * An #IBusEmojiData list loaded from the saved cache file.
Packit 3ff832
 */
Packit 3ff832
GSList *        ibus_emoji_data_load            (const gchar    *path);
Packit 3ff832
Packit 3ff832
G_END_DECLS
Packit 3ff832
#endif