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.
17 * @file plugin_metafile_reader.cpp
18 * @author Grzegorz Krawczyk(g.krawczyk@samsung.com)
23 #include "plugin_metafile_reader.h"
24 #include <plugin_path.h>
26 using namespace WrtDB;
29 const std::string XML_NAMESPACE = "";
31 const std::string TOKEN_LIBRARY_NAME = "library-name";
32 const std::string TOKEN_API_FEATURE = "api-feature";
33 const std::string TOKEN_NAME = "name";
34 const std::string TOKEN_DEVICECAPABILITY = "device-capability";
37 PluginMetafileReader::PluginMetafileReader() : m_parserSchema(this)
39 m_parserSchema.addEndTagCallback(
42 &PluginMetafileReader::tokenEndLibraryName);
44 m_parserSchema.addEndTagCallback(
47 &PluginMetafileReader::tokenEndApiFeature);
49 m_parserSchema.addEndTagCallback(
52 &PluginMetafileReader::tokenEndName);
54 m_parserSchema.addEndTagCallback(
55 TOKEN_DEVICECAPABILITY,
57 &PluginMetafileReader::tokenEndDeviceCapability);
60 void PluginMetafileReader::initialize(const PluginPath &filename)
62 m_parserSchema.initialize(filename.Fullpath(),
64 ValidationCore::SaxReader::VALIDATION_DTD,
68 void PluginMetafileReader::read(WrtDB::PluginMetafileData &data)
70 m_parserSchema.read(data);
73 void PluginMetafileReader::blankFunction(PluginMetafileData & /* data */)
76 void PluginMetafileReader::tokenEndLibraryName(PluginMetafileData &data)
78 data.m_libraryName = m_parserSchema.getText();
81 void PluginMetafileReader::tokenEndApiFeature(PluginMetafileData &data)
83 data.m_featureContainer.insert(m_feature);
84 m_feature.m_deviceCapabilities.clear();
87 void PluginMetafileReader::tokenEndName(PluginMetafileData & /* data */)
89 m_feature.m_name = m_parserSchema.getText();
92 void PluginMetafileReader::tokenEndDeviceCapability(PluginMetafileData& /*data*/)
94 m_feature.m_deviceCapabilities.insert(m_parserSchema.getText());