本文整理汇总了C++中GRN_API_RETURN函数的典型用法代码示例。如果您正苦于以下问题:C++ GRN_API_RETURN函数的具体用法?C++ GRN_API_RETURN怎么用?C++ GRN_API_RETURN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GRN_API_RETURN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: grn_tokenizer_query_set_raw_string
grn_rc
grn_tokenizer_query_set_raw_string(grn_ctx *ctx,
grn_tokenizer_query *query,
const char *string,
size_t string_length)
{
GRN_API_ENTER;
if (query->query_buf) {
GRN_PLUGIN_FREE(ctx, query->query_buf);
}
if (string_length == 0) {
query->query_buf = NULL;
query->ptr = NULL;
query->length = 0;
query->need_normalize = GRN_TRUE;
} else {
query->query_buf = (char *)GRN_PLUGIN_MALLOC(ctx, string_length + 1);
if (!query->query_buf) {
GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
"[tokenizer][query] failed to duplicate query");
GRN_API_RETURN(ctx->rc);
}
grn_memcpy(query->query_buf, string, string_length);
query->query_buf[string_length] = '\0';
query->ptr = query->query_buf;
query->length = string_length;
}
GRN_API_RETURN(ctx->rc);
}
开发者ID:groonga,项目名称:groonga,代码行数:32,代码来源:tokenizer.c
示例2: grn_type_create
grn_obj *
grn_type_create(grn_ctx *ctx, const char *name, unsigned int name_size,
grn_obj_flags flags, unsigned int size)
{
grn_id id;
struct _grn_type *res = NULL;
grn_obj *db;
if (!ctx || !ctx->impl || !(db = ctx->impl->db)) {
ERR(GRN_INVALID_ARGUMENT, "db not initialized");
return NULL;
}
GRN_API_ENTER;
if (grn_db_check_name(ctx, name, name_size)) {
GRN_DB_CHECK_NAME_ERR("[type][create]", name, name_size);
GRN_API_RETURN(NULL);
}
if (!GRN_DB_P(db)) {
ERR(GRN_INVALID_ARGUMENT, "invalid db assigned");
GRN_API_RETURN(NULL);
}
id = grn_obj_register(ctx, db, name, name_size);
if (id && (res = GRN_MALLOC(sizeof(grn_db_obj)))) {
GRN_DB_OBJ_SET_TYPE(res, GRN_TYPE);
res->obj.header.flags = flags;
res->obj.header.domain = GRN_ID_NIL;
GRN_TYPE_SIZE(&res->obj) = size;
if (grn_db_obj_init(ctx, db, id, DB_OBJ(res))) {
// grn_obj_delete(ctx, db, id);
GRN_FREE(res);
GRN_API_RETURN(NULL);
}
}
GRN_API_RETURN((grn_obj *)res);
}
开发者ID:cosmo0920,项目名称:groonga,代码行数:34,代码来源:type.c
示例3: grn_token_get_data
grn_obj *
grn_token_get_data(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT, "token must not be NULL");
GRN_API_RETURN(NULL);
}
GRN_API_RETURN(&(token->data));
}
开发者ID:AkioKanno,项目名称:groonga,代码行数:10,代码来源:tokenizer.c
示例4: grn_token_get_status
grn_token_status
grn_token_get_status(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT, "token must not be NULL");
GRN_API_RETURN(GRN_TOKEN_CONTINUE);
}
GRN_API_RETURN(token->status);
}
开发者ID:AkioKanno,项目名称:groonga,代码行数:10,代码来源:tokenizer.c
示例5: grn_token_get_source_offset
uint64_t
grn_token_get_source_offset(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][source-offset][get] token must not be NULL");
GRN_API_RETURN(0);
}
GRN_API_RETURN(token->source_offset);
}
开发者ID:groonga,项目名称:groonga,代码行数:11,代码来源:token.c
示例6: grn_token_have_overlap
grn_bool
grn_token_have_overlap(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][overlap][have] token must not be NULL");
GRN_API_RETURN(0);
}
GRN_API_RETURN(token->have_overlap);
}
开发者ID:groonga,项目名称:groonga,代码行数:11,代码来源:token.c
示例7: grn_token_get_force_prefix_search
grn_bool
grn_token_get_force_prefix_search(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][force-prefix-search][get] token must not be NULL");
GRN_API_RETURN(GRN_FALSE);
}
GRN_API_RETURN(token->force_prefix_search);
}
开发者ID:groonga,项目名称:groonga,代码行数:11,代码来源:token.c
示例8: grn_token_get_position
uint32_t
grn_token_get_position(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][position][get] token must not be NULL");
GRN_API_RETURN(0);
}
GRN_API_RETURN(token->position);
}
开发者ID:groonga,项目名称:groonga,代码行数:11,代码来源:token.c
示例9: grn_token_get_source_first_character_length
uint32_t
grn_token_get_source_first_character_length(grn_ctx *ctx, grn_token *token)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][source-first-character-length][get] token must not be NULL");
GRN_API_RETURN(0);
}
GRN_API_RETURN(token->source_first_character_length);
}
开发者ID:groonga,项目名称:groonga,代码行数:11,代码来源:token.c
示例10: grn_tokenizer_query_open
grn_tokenizer_query *
grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args,
unsigned int normalize_flags)
{
grn_obj *flags;
grn_obj *query_str;
grn_obj *tokenize_mode;
GRN_API_ENTER;
flags = grn_ctx_pop(ctx);
query_str = grn_ctx_pop(ctx);
tokenize_mode = grn_ctx_pop(ctx);
if (query_str == NULL) {
GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "missing argument");
GRN_API_RETURN(NULL);
}
if ((num_args < 1) || (args == NULL) || (args[0] == NULL)) {
GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "invalid NULL pointer");
GRN_API_RETURN(NULL);
}
{
grn_tokenizer_query * const query =
GRN_PLUGIN_MALLOC(ctx, sizeof(grn_tokenizer_query));
if (!query) {
GRN_API_RETURN(NULL);
}
grn_tokenizer_query_init(ctx, query);
grn_tokenizer_query_set_raw_string(ctx,
query,
GRN_TEXT_VALUE(query_str),
GRN_TEXT_LEN(query_str));
if (ctx->rc != GRN_SUCCESS) {
GRN_PLUGIN_FREE(ctx, query);
GRN_API_RETURN(NULL);
}
if (flags) {
grn_tokenizer_query_set_flags(ctx, query, GRN_UINT32_VALUE(flags));
}
if (tokenize_mode) {
grn_tokenizer_query_set_mode(ctx, query, GRN_UINT32_VALUE(tokenize_mode));
}
grn_tokenizer_query_set_normalize_flags(ctx, query, normalize_flags);
grn_tokenizer_query_set_lexicon(ctx, query, args[0]);
grn_tokenizer_query_ensure_have_tokenized_delimiter(ctx, query);
GRN_API_RETURN(query);
}
}
开发者ID:groonga,项目名称:groonga,代码行数:53,代码来源:tokenizer.c
示例11: grn_token_set_position
grn_rc
grn_token_set_position(grn_ctx *ctx, grn_token *token, uint32_t position)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][position][set] token must not be NULL");
GRN_API_RETURN(ctx->rc);
}
token->position = position;
GRN_API_RETURN(ctx->rc);
}
开发者ID:groonga,项目名称:groonga,代码行数:12,代码来源:token.c
示例12: grn_token_set_force_prefix_search
grn_rc
grn_token_set_force_prefix_search(grn_ctx *ctx, grn_token *token, grn_bool force)
{
GRN_API_ENTER;
if (!token) {
ERR(GRN_INVALID_ARGUMENT,
"[token][force-prefix-search][set] token must not be NULL");
GRN_API_RETURN(ctx->rc);
}
token->force_prefix_search = force;
GRN_API_RETURN(ctx->rc);
}
开发者ID:groonga,项目名称:groonga,代码行数:12,代码来源:token.c
示例13: grn_type_size
uint32_t
grn_type_size(grn_ctx *ctx, grn_obj *type)
{
uint32_t size;
GRN_API_ENTER;
if (!type) {
ERR(GRN_INVALID_ARGUMENT, "[type][size] type is NULL");
GRN_API_RETURN(0);
}
size = GRN_TYPE_SIZE(DB_OBJ(type));
GRN_API_RETURN(size);
}
开发者ID:cosmo0920,项目名称:groonga,代码行数:13,代码来源:type.c
示例14: grn_windows_event_logger_set
grn_rc
grn_windows_event_logger_set(grn_ctx *ctx, const char *event_source_name)
{
#ifdef WIN32
grn_rc rc;
grn_logger windows_event_logger;
grn_windows_event_logger_data *data;
if (ctx) {
GRN_API_ENTER;
}
data = malloc(sizeof(grn_windows_event_logger_data));
if (!data) {
if (ctx) {
ERR(GRN_NO_MEMORY_AVAILABLE,
"failed to allocate user data for Windows event logger");
GRN_API_RETURN(ctx->rc);
} else {
return GRN_NO_MEMORY_AVAILABLE;
}
}
if (event_source_name) {
data->event_source_name = grn_strdup_raw(event_source_name);
} else {
data->event_source_name = grn_strdup_raw("libgroonga");
}
data->event_source = INVALID_HANDLE_VALUE;
windows_event_logger.max_level = GRN_LOG_DEFAULT_LEVEL;
windows_event_logger.flags = GRN_LOG_TIME | GRN_LOG_MESSAGE;
windows_event_logger.user_data = data;
windows_event_logger.log = windows_event_logger_log;
windows_event_logger.reopen = windows_event_logger_reopen;
windows_event_logger.fin = windows_event_logger_fin;
rc = grn_logger_set(ctx, &windows_event_logger);
if (rc != GRN_SUCCESS) {
windows_event_logger.fin(ctx, windows_event_logger.user_data);
}
if (ctx) {
GRN_API_RETURN(rc);
} else {
return rc;
}
#else /* WIN32 */
return GRN_FUNCTION_NOT_IMPLEMENTED;
#endif /* WIN32 */
}
开发者ID:cafedomancer,项目名称:groonga,代码行数:51,代码来源:windows_event_logger.c
示例15: grn_command_input_get_arguments
grn_obj *
grn_command_input_get_arguments(grn_ctx *ctx,
grn_command_input *input)
{
GRN_API_ENTER;
GRN_API_RETURN((grn_obj *)(input->arguments));
}
开发者ID:XLPE,项目名称:groonga,代码行数:7,代码来源:command.c
示例16: grn_tokenizer_query_get_normalize_flags
unsigned int
grn_tokenizer_query_get_normalize_flags(grn_ctx *ctx,
grn_tokenizer_query *query)
{
GRN_API_ENTER;
GRN_API_RETURN(query->normalize_flags);
}
开发者ID:groonga,项目名称:groonga,代码行数:7,代码来源:tokenizer.c
示例17: grn_tokenizer_query_set_lexicon
grn_rc
grn_tokenizer_query_set_lexicon(grn_ctx *ctx,
grn_tokenizer_query *query,
grn_obj *lexicon)
{
GRN_API_ENTER;
if (query->lexicon != lexicon) {
query->lexicon = lexicon;
if (query->lexicon) {
grn_table_get_info(ctx,
query->lexicon,
NULL,
&(query->encoding),
NULL,
NULL,
NULL);
} else {
query->encoding = ctx->encoding;
}
query->need_normalize = GRN_TRUE;
}
GRN_API_RETURN(ctx->rc);
}
开发者ID:groonga,项目名称:groonga,代码行数:25,代码来源:tokenizer.c
示例18: grn_tokenizer_query_get_token_filter_index
unsigned int
grn_tokenizer_query_get_token_filter_index(grn_ctx *ctx,
grn_tokenizer_query *query)
{
GRN_API_ENTER;
GRN_API_RETURN(query->token_filter_index);
}
开发者ID:groonga,项目名称:groonga,代码行数:7,代码来源:tokenizer.c
示例19: grn_tokenizer_create
grn_obj *
grn_tokenizer_create(grn_ctx *ctx,
const char *name,
int name_length)
{
grn_obj *tokenizer;
GRN_API_ENTER;
tokenizer = grn_proc_create(ctx,
name,
name_length,
GRN_PROC_TOKENIZER,
NULL,
NULL,
NULL,
0,
NULL);
if (!tokenizer) {
if (name_length < 0) {
name_length = strlen(name);
}
GRN_PLUGIN_ERROR(ctx,
GRN_TOKENIZER_ERROR,
"[tokenizer][create] failed to create: <%.*s>",
name_length, name);
}
GRN_API_RETURN(tokenizer);
}
开发者ID:groonga,项目名称:groonga,代码行数:29,代码来源:tokenizer.c
示例20: grn_command_input_add
grn_obj *
grn_command_input_add(grn_ctx *ctx,
grn_command_input *input,
const char *name,
int name_size,
grn_bool *added)
{
grn_obj *argument = NULL;
/* TODO: Use grn_bool */
int internal_added = GRN_FALSE;
GRN_API_ENTER;
if (name_size == -1) {
name_size = strlen(name);
}
if (input->arguments) {
grn_hash_add(ctx, input->arguments, name, name_size, (void **)&argument,
&internal_added);
if (internal_added) {
GRN_TEXT_INIT(argument, 0);
}
}
if (added) {
*added = internal_added;
}
GRN_API_RETURN(argument);
}
开发者ID:AkioKanno,项目名称:groonga,代码行数:29,代码来源:command.c
注:本文中的GRN_API_RETURN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论