ARIF_FETCH(3) ARIF User Manual ARIF_FETCH(3)

arif_fetch - fetch candidates

#include <arif/arif.h>
int
arif_fetch (
    struct arif_ctx         *ctx,
    struct arif_cand const **candidates_ptr
);

The arif_fetch() function fetches all candidates from the current page of input context ctx into an array of struct arif_cand, and stores a pointer to that array into candidates_ptr. The array is valid until the next time arif_query() is called with new input text.

A candidate is a piece of text generated by an IME that is meant to replace part of the original input text.

The struct arif_cand type is defined as:

struct arif_cand {
    char const *text;
    int         len;
    int         replace_len;
    char const *transform;
    int         transform_len;
    char const *display;
    int         display_len;
};

The text member is the actual text of the candidate, and len is its length in bytes.

Member replace_len is the number of leading bytes of the original text that are meant to be replaced by the candidate.

Should the original text passed to arif_query() be transformed into another text when selecting this candidate, the resulting text is put into transform, and transform_len is its length in bytes. Otherwise, transform value is NULL.

The display member is the text to display when listing candidates for the user to choose. Member display_len is its length in bytes.

Returns the number of items in the array stored to candidates_ptr.

Copyright (C) 2023 CismonX <admin@cismon.net>

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

You should have received a copy of the license along with this document. If not, see <https://www.gnu.org/licenses/fdl-1.3.html>.

arif_query(3), arif_select_page(3)

January 2, 2023 0.1.0