#include <dpl/log/log.h>
namespace ViewModule {
-
namespace {
-
const char * const type2name[Scheme::COUNT] = {
- "file",
- "sms",
- "mmsto",
- "mailto",
- "data",
- "tel",
- "http",
- "https",
- "widget",
- "vnd.youtube",
- "rtsp" };
+ "file",
+ "sms",
+ "smsto",
+ "mmsto",
+ "mailto",
+ "data",
+ "tel",
+ "http",
+ "https",
+ "widget",
+#ifdef APP_SCHEME_ENABLED
+ "app",
+#endif
+ "rtsp"
+};
typedef std::map<std::string, Scheme::Type> SchemeMap;
SchemeMap PopulateMap()
{
- LogInfo("Populating scheme map...");
+ LogDebug("Populating scheme map...");
SchemeMap map;
- for(size_t st = Scheme::FILE; st<Scheme::COUNT;++st) {
- LogInfo(" * " << type2name[st] << "->" << st);
+ for (size_t st = Scheme::FILE; st < Scheme::COUNT; ++st) {
+ LogDebug(" * " << type2name[st] << "->" << st);
map[type2name[st]] = static_cast<Scheme::Type>(st);
}
return map;
}
const SchemeMap name2type = PopulateMap();
-
} // namespace
-Scheme::Scheme(const std::string& name) : m_name(name), m_type(INVALID) {
+Scheme::Scheme(const std::string& name) : m_name(name), m_type(INVALID)
+{
m_type = GetType(name);
}
-Scheme::Scheme(Type type) : m_type(type) {
- m_name = GetName(type);
-}
-
std::string Scheme::GetName (Type type)
{
Assert(type >= FILE && type < COUNT);
Scheme::Type Scheme::GetType(const std::string& name)
{
auto it = name2type.find(name);
- if(it == name2type.end()) {
+ if (it == name2type.end()) {
LogError("Invalid scheme: " << name);
return INVALID;
}
return it->second;
}
-
} /* namespace ViewModule */