Leosac  0.8.0
Open Source Access Control
XmlScheduleLoader.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "tools/ISchedule.hpp"
23 #include <boost/property_tree/ptree_fwd.hpp>
24 #include <map>
25 
26 namespace Leosac
27 {
28 namespace Tools
29 {
37 {
38  public:
42  bool load(const boost::property_tree::ptree &t);
43 
47  static int week_day_to_int(const std::string &day);
48 
52  const std::map<std::string, ISchedulePtr> &schedules() const;
53 
54  private:
58  bool extract_one(const boost::property_tree::ptree &node);
59 
60  std::map<std::string, ISchedulePtr> schedules_;
61 };
62 }
63 }
Leosac::Tools::XmlScheduleLoader
Load a list of schedules from a boost::property_tree.
Definition: XmlScheduleLoader.hpp:36
Leosac::Tools::XmlScheduleLoader::load
bool load(const boost::property_tree::ptree &t)
Load all schedules from a tree and stores them in the map.
Definition: XmlScheduleLoader.cpp:49
ISchedule.hpp
Leosac::Tools::XmlScheduleLoader::extract_one
bool extract_one(const boost::property_tree::ptree &node)
Adds a new schedule to the map.
Definition: XmlScheduleLoader.cpp:71
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Tools::XmlScheduleLoader::schedules_
std::map< std::string, ISchedulePtr > schedules_
Definition: XmlScheduleLoader.hpp:60
Leosac::Tools::XmlScheduleLoader::schedules
const std::map< std::string, ISchedulePtr > & schedules() const
Access the map of stored schedules.
Definition: XmlScheduleLoader.cpp:111
Leosac::Tools::XmlScheduleLoader::week_day_to_int
static int week_day_to_int(const std::string &day)
Helper function.
Definition: XmlScheduleLoader.cpp:29