UniMRCP  1.7.0
apt_string_table.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APT_STRING_TABLE_H
18 #define APT_STRING_TABLE_H
19 
20 /**
21  * @file apt_string_table.h
22  * @brief Generic String Table
23  */
24 
25 #include "apt_string.h"
26 
28 
29 
30 /** String table item declaration */
32 
33 /** String table item definition */
35  /** String value associated with id */
37  /** Index of the unique (key) character to compare */
38  apr_size_t key;
39 };
40 
41 
42 /**
43  * Get the string by a given id.
44  * @param table the table to get string from
45  * @param size the size of the table
46  * @param id the id to get string by
47  * @return the string associated with the id, or NULL if the id is invalid
48  */
49 APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id);
50 
51 /**
52  * Find the id associated with a given string.
53  * @param table the table to search for the id
54  * @param size the size of the table
55  * @param value the string to search for
56  * @return the id associated with the string, or invalid id if string cannot be matched
57  */
58 APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value);
59 
60 
62 
63 #endif /* APT_STRING_TABLE_H */
const apt_str_t * apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id)
#define APT_END_EXTERN_C
Definition: apt.h:38
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
apr_size_t key
Definition: apt_string_table.h:38
#define APT_DECLARE(type)
Definition: apt.h:53
Definition: apt_string.h:36
apr_size_t apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value)
String Representation.
apt_str_t value
Definition: apt_string_table.h:36
Definition: apt_string_table.h:34