Tizen 2.0 Release
[profile/ivi/libscl-ui.git] / binary_xmlresource / include / string_provider.h
1 /*
2  * Copyright 2012-2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 __STRING_PROVIDER_H__
19 #define __STRING_PROVIDER_H__
20 #include <string>
21 #include <vector>
22 #include "string_bin_parser.h"
23 #include "istring_provider.h"
24 class String_Provider: public IString_Provider{
25     public:
26         String_Provider(const String_Bin_Parser* sp): m_sp(sp) {}
27         const char* get_string_by_id(const int id)const{
28             if (m_sp == NULL) return NULL;
29
30             const std::vector<const char*>& string_depository = m_sp->get_string_depository();
31             if (id >= 0 && id < string_depository.size())
32                 return string_depository.at(id);
33
34             return NULL;
35         }
36     private:
37         const String_Bin_Parser *m_sp;
38 };
39 #endif