UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
apt_string_table.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2014 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  * $Id: apt_string_table.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef APT_STRING_TABLE_H
20 #define APT_STRING_TABLE_H
21 
22 /**
23  * @file apt_string_table.h
24  * @brief Generic String Table
25  */
26 
27 #include "apt_string.h"
28 
30 
31 
32 /** String table item declaration */
34 
35 /** String table item definition */
37  /** String value associated with id */
39  /** Index of the unique (key) character to compare */
40  apr_size_t key;
41 };
42 
43 
44 /**
45  * Get the string by a given id.
46  * @param table the table to get string from
47  * @param size the size of the table
48  * @param id the id to get string by
49  * @return the string associated with the id, or NULL if the id is invalid
50  */
51 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);
52 
53 /**
54  * Find the id associated with a given string.
55  * @param table the table to search for the id
56  * @param size the size of the table
57  * @param value the string to search for
58  * @return the id associated with the string, or invalid id if string cannot be matched
59  */
60 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);
61 
62 
64 
65 #endif /* APT_STRING_TABLE_H */