2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
24 #include <dpl/log/log.h>
26 namespace ViewModule {
28 const char * const type2name[Scheme::COUNT] = {
38 #ifdef APP_SCHEME_ENABLED
45 typedef std::map<std::string, Scheme::Type> SchemeMap;
47 SchemeMap PopulateMap()
49 LogInfo("Populating scheme map...");
51 for (size_t st = Scheme::FILE; st < Scheme::COUNT; ++st) {
52 LogInfo(" * " << type2name[st] << "->" << st);
53 map[type2name[st]] = static_cast<Scheme::Type>(st);
58 const SchemeMap name2type = PopulateMap();
61 Scheme::Scheme(const std::string& name) : m_name(name), m_type(INVALID)
63 m_type = GetType(name);
66 std::string Scheme::GetName (Type type)
68 Assert(type >= FILE && type < COUNT);
69 return type2name[type];
72 Scheme::Type Scheme::GetType(const std::string& name)
74 auto it = name2type.find(name);
75 if (it == name2type.end()) {
76 LogError("Invalid scheme: " << name);
81 } /* namespace ViewModule */