Upload initial version
[platform/core/uifw/libscl-ui-nui.git] / scl / parserinfo_provider.h
1 /*
2  * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
18 #ifndef __PARSERINFO_PROVIDER_H__
19 #define __PARSERINFO_PROVIDER_H__
20 #include "iparserinfo_provider.h"
21 #include "istring_provider.h"
22 #include "imetadata_provider.h"
23
24 class ParserInfo_Provider: public IParserInfo_Provider{
25     public:
26         ParserInfo_Provider(IMetadata_Provider* metadataProvider,
27                             const IString_Provider* stringProvider) :m_metadataProvider(metadataProvider),
28                             m_stringProvider(stringProvider) {}
29         void set_current_metadata_record(const char* record_name) {
30             assert(m_metadataProvider);
31             if (m_metadataProvider != NULL) {
32                 m_metadataProvider->set_current_metadata_record(record_name);
33             }
34         }
35         int get_width(const char* field_name)const {
36             assert(m_metadataProvider != NULL);
37             if (m_metadataProvider != NULL)
38                 return m_metadataProvider->get_width(field_name);
39
40             return 0 ;
41         }
42
43         const char* get_string_by_id(const int id)const {
44             if (m_stringProvider != NULL) {
45                 return m_stringProvider->get_string_by_id(id);
46             }
47             return NULL;
48         }
49
50     private:
51         IMetadata_Provider *m_metadataProvider;
52         const IString_Provider *m_stringProvider;
53 };
54 #endif