Kouhei Sutou 2019-04-26 10:20:40 +0900 (Fri, 26 Apr 2019) Revision: d638f0ef45d731fb3240d8e9d7d7a22df30d7447 https://github.com/groonga/groonga/commit/d638f0ef45d731fb3240d8e9d7d7a22df30d7447 Message: Add grn_obj_is_id_accessor() Modified files: include/groonga/obj.h lib/obj.c Modified: include/groonga/obj.h (+2 -1) =================================================================== --- include/groonga/obj.h 2019-04-26 09:38:50 +0900 (50d0daf05) +++ include/groonga/obj.h 2019-04-26 10:20:40 +0900 (6374ecd2b) @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2015-2018 Brazil - Copyright(C) 2018 Kouhei Sutou <kou****@clear*****> + Copyright(C) 2018-2019 Kouhei Sutou <kou****@clear*****> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -48,6 +48,7 @@ GRN_API grn_bool grn_obj_is_reference_column(grn_ctx *ctx, grn_obj *obj); GRN_API grn_bool grn_obj_is_data_column(grn_ctx *ctx, grn_obj *obj); GRN_API grn_bool grn_obj_is_index_column(grn_ctx *ctx, grn_obj *obj); GRN_API grn_bool grn_obj_is_accessor(grn_ctx *ctx, grn_obj *obj); +GRN_API grn_bool grn_obj_is_id_accessor(grn_ctx *ctx, grn_obj *obj); GRN_API grn_bool grn_obj_is_key_accessor(grn_ctx *ctx, grn_obj *obj); GRN_API grn_bool grn_obj_is_type(grn_ctx *ctx, grn_obj *obj); GRN_API grn_bool grn_obj_is_text_family_type(grn_ctx *ctx, grn_obj *obj); Modified: lib/obj.c (+18 -1) =================================================================== --- lib/obj.c 2019-04-26 09:38:50 +0900 (4660e9e26) +++ lib/obj.c 2019-04-26 10:20:40 +0900 (221a7aaa9) @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2015-2018 Brazil - Copyright(C) 2018 Kouhei Sutou <kou****@clear*****> + Copyright(C) 2018-2019 Kouhei Sutou <kou****@clear*****> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -276,6 +276,23 @@ grn_obj_is_accessor(grn_ctx *ctx, grn_obj *obj) } grn_bool +grn_obj_is_id_accessor(grn_ctx *ctx, grn_obj *obj) +{ + grn_accessor *accessor; + + if (!grn_obj_is_accessor(ctx, obj)) { + return GRN_FALSE; + } + + accessor = (grn_accessor *)obj; + if (accessor->next) { + return GRN_FALSE; + } + + return accessor->action == GRN_ACCESSOR_GET_ID; +} + +grn_bool grn_obj_is_key_accessor(grn_ctx *ctx, grn_obj *obj) { grn_accessor *accessor; -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190426/60a2c4b2/attachment-0001.html>