Sha256: 7c03761be2d5135db6de7030bc99a42fb9bc09cecd410506f9776d98c5e9d217

Contents?: true

Size: 1.94 KB

Versions: 14

Compression:

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

/*
 * 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

14 entries across 14 versions & 1 rubygems

Version Path
rroonga-2.0.4-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.4 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.3-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.3 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.2 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.2-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.1-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.1 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.0-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-2.0.0 ext/groonga/rb-grn-encoding-support.c
rroonga-1.3.1-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-1.3.1 ext/groonga/rb-grn-encoding-support.c
rroonga-1.3.0-x86-mingw32 ext/groonga/rb-grn-encoding-support.c
rroonga-1.3.0 ext/groonga/rb-grn-encoding-support.c