Sha256: 490549ffdb66c9c89e97bf891c9b69427ded850c7b69b4d30e650663a3f86acf

Contents?: true

Size: 1.92 KB

Versions: 34

Compression:

Stored size: 1.92 KB

Contents

/* -*- 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
 *
 * オブジェクトにエンコーディング関連の機能を提供するモジュー
 * ル。
 */

/*
 * call-seq:
 *   object.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

34 entries across 34 versions & 1 rubygems

Version Path
rroonga-1.2.9 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.8 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.7-x86-mswin32 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.7-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.7 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.6 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.5-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.5 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.4 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.3 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.2 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.1 ext/groonga/rb-grn-encoding-support.c
rroonga-1.2.0 ext/groonga/rb-grn-encoding-support.c
rroonga-1.1.0-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-1.1.0 ext/groonga/rb-grn-encoding-support.c
rroonga-1.0.9 ext/groonga/rb-grn-encoding-support.c
rroonga-1.0.8 ext/groonga/rb-grn-encoding-support.c
rroonga-1.0.7 ext/groonga/rb-grn-encoding-support.c
rroonga-1.0.5 ext/groonga/rb-grn-encoding-support.c
rroonga-1.0.4 ext/groonga/rb-grn-encoding-support.c