2 * Copyright (c) 2000 - 2015 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 InitialValuesFile.h
18 * @author Maciej Karpiuk (m.karpiuk2@samsung.com)
20 * @brief InitialValuesFile class.
23 #ifndef INITIALVALUESFILE_H_
24 #define INITIALVALUESFILE_H_
27 #include <InitialValueHandler.h>
28 #include <ckm-logic.h>
31 namespace InitialValues {
33 class InitialValuesFile
36 InitialValuesFile(const std::string &XML_filename,
39 int Validate(const std::string &XSD_file);
49 XML::Parser::ElementHandlerPtr GetObjectHandler(ObjectType type);
50 void ReleaseObjectHandler(ObjectType type);
52 XML::Parser::ElementHandlerPtr GetBufferHandler(EncodingType type);
53 void ReleaseBufferHandler(EncodingType type);
55 XML::Parser::ElementHandlerPtr GetPermissionHandler();
56 void ReleasePermissionHandler();
58 std::string m_filename;
60 InitialValueHandler::InitialValueHandlerPtr m_currentHandler;
61 CKMLogic & m_db_logic;
63 class HeaderHandler : public XML::Parser::ElementHandler
66 explicit HeaderHandler(InitialValuesFile & parent);
67 virtual void Start(const XML::Parser::Attributes & attr);
68 virtual void Characters(const std::string &) {};
69 virtual void End() {};
71 bool isCorrectVersion() const;
75 InitialValuesFile & m_parent;
77 typedef std::shared_ptr<HeaderHandler> HeaderHandlerPtr;
78 HeaderHandlerPtr m_header;
80 void registerElementListeners();
81 static void Error(const XML::Parser::ErrorType errorType,
82 const std::string & logMsg);
88 #endif /* INITIALVALUESFILE_H_ */