Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_query.h
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 */
19
27#ifndef __NILOREA_QUERY_HEADER
28#define __NILOREA_QUERY_HEADER
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include <stddef.h>
35
67typedef struct N_QUERY N_QUERY;
68
71typedef const char* (*N_QUERY_GET)(const char* field, void* user_data);
72
76N_QUERY* n_query_compile(const char* expr, char* errbuf, size_t errlen);
77
80int n_query_eval(const N_QUERY* query, N_QUERY_GET get, void* user_data);
81
83void n_query_free(N_QUERY** query);
84
89#ifdef __cplusplus
90}
91#endif
92
93/* #ifndef __NILOREA_QUERY_HEADER */
94#endif
int n_query_eval(const N_QUERY *query, N_QUERY_GET get, void *user_data)
Evaluate a compiled query against one record via get.
Definition n_query.c:468
const char *(* N_QUERY_GET)(const char *field, void *user_data)
Field-value getter: return the value of field for the record being evaluated (NUL-terminated,...
Definition n_query.h:71
N_QUERY * n_query_compile(const char *expr, char *errbuf, size_t errlen)
Compile an expression into a query.
Definition n_query.c:375
void n_query_free(N_QUERY **query)
Free a compiled query and set the pointer to NULL.
Definition n_query.c:474
Opaque compiled query (see n_query_compile / n_query_eval / n_query_free).
Definition n_query.c:62