Sha256: 6d7bdee6a487b21f44654a87680c2e038ea978b48f3049e406dacb00c32a015e

Contents?: true

Size: 1.97 KB

Versions: 14

Compression:

Stored size: 1.97 KB

Contents

/* -*- coding: utf-8; c-file-style: "ruby" -*- */
/*
  Copyright (C) 2009  Kouhei Sutou <kou@clear-code.com>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 2.1 as published by the Free Software Foundation.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "rb-grn.h"

#define SELF(object) (RB_GRN_OBJECT(DATA_PTR(object)))

VALUE rb_mGrnEncodingSupport;

/*
 * Document-module: Groonga::EncodingSupport
 *
 * オブジェクトにエンコーディング関連の機能を提供するモジュー
 * ル。
 */

/*
 * オブジェクトのエンコーディングを返す。
 * @overload encoding
 * @return [Groonga::Encoding] オブジェクトのエンコーディング
 */
static VALUE
rb_grn_encoding_support_get_encoding (VALUE self)
{
    grn_ctx *context = NULL;
    grn_obj *object = NULL;
    grn_obj *encoding_value;
    grn_encoding encoding;

    rb_grn_object_deconstruct(SELF(self), &object, &context,
                              NULL, NULL, NULL, NULL);
    encoding_value = grn_obj_get_info(context, object, GRN_INFO_ENCODING, NULL);
    rb_grn_context_check(context, self);

    memcpy(&encoding, GRN_BULK_HEAD(encoding_value), sizeof(encoding));
    grn_obj_unlink(context, encoding_value);

    return GRNENCODING2RVAL(encoding);
}

void
rb_grn_init_encoding_support (VALUE mGrn)
{
    rb_mGrnEncodingSupport = rb_define_module_under(mGrn, "EncodingSupport");

    rb_define_method(rb_mGrnEncodingSupport, "encoding",
		     rb_grn_encoding_support_get_encoding, 0);
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rroonga-2.1.3-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.3 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.2-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.2 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.1-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.1 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.0-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.1.0 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.8-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.8 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.7-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.7 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.6 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.5 ext/groonga/rb-grn-encoding-support.c