Tizen 2.1 base
[platform/core/system/libsf-common.git] / include / ccatalog.h
1 /*
2  *  libsf-common
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JuHyun Kim <jh8212.kim@samsung.com>
7  * 
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */ 
21
22
23
24
25 #if !defined(_CATALOG_CLASS_H_)
26 #define _CATALOG_CLASS_H_
27
28
29
30 class ccatalog : public ctype
31 {
32 public:
33         enum ccatalog_splitter_id {
34                 SPLITTER_FOR_CONF_FILE = 0x00,
35                 SPLITTER_FOR_CPU_INFO = 0x01,
36         };
37         
38         ccatalog();
39         virtual ~ccatalog();
40
41         bool load(const char *conf_file , char splitter_id = SPLITTER_FOR_CONF_FILE);
42         bool is_loaded(void);
43         bool unload(void);
44
45         char *value(char *group, char *name);
46         char *value(char *group, char *name, int idx);
47         int count_of_values(char *group, char *name);
48
49         void *iterate_init(void);
50         void *iterate_next(void *handle);
51         void *iterate_prev(void *handle);
52         char *iterate_get_name(void *handle);
53
54 private:
55         struct desc_t : public clist {
56                 char *name;
57                 char *value;
58         };
59
60         struct group_t : public clist {
61                 char *name;
62                 int attr_cnt;
63
64                 desc_t *head;
65                 desc_t *tail;
66         };
67
68         group_t *m_head;
69         group_t *m_tail;
70 };
71
72
73
74 #endif
75 //! End of a file