Exemplo n.º 1
0
EB_Error_Code QEb::searchWord(const QString &word)
{
    EB_Error_Code ecode = eb_search_word(&book, utfToEuc(word));
    if (ecode != EB_SUCCESS)
        dispError("eb_search_word", ecode);
    return ecode;
}
Exemplo n.º 2
0
Arquivo: uim-eb.c Projeto: NgoHuy/uim
char *
uim_eb_search_text (uim_eb *ueb, const char *key, const char *enc)
{
  char *text;
  int i;
  char *str = NULL;
  iconv_t cd;

  /* FIXME! check return value */

  cd = (iconv_t)uim_iconv->create("EUC-JP", enc);
  text = uim_iconv->convert(cd, key);
  uim_iconv->release(cd);

  if (!text)
	  return NULL;

  for (i = 0; i < ueb->subCount; i++) {
    EB_Hit hits[MAX_HITS];
    int hitCount;
    int j;

    /* specify subbook */
    if (eb_set_subbook(&ueb->book, ueb->subCodes[i]) != EB_SUCCESS) {
      uim_notify_fatal(N_("eb: eb_set_subbook() failed")); continue;
    }

    eb_search_word(&ueb->book, text);
    eb_hit_list(&ueb->book, MAX_HITS, hits, &hitCount);
    for (j = 0; j < hitCount; j++) {
      /*EB_Position headp = hits[j].heading;*/
      EB_Position textp = hits[j].text;

      go_text_eb(ueb, textp, &str, enc);
      uim_eb_strappend(&str, "\n", sizeof("\n"));
    }
  }

  free(text);

  return str;
}