22 #ifndef STYLESHEET_MANAGER_HPP 23 #define STYLESHEET_MANAGER_HPP 25 #include <boost/asio.hpp> 26 #include <boost/thread/thread.hpp> 27 #include <boost/unordered_map.hpp> 28 #include "../extras/dirwatch/dir_monitor.hpp" 29 #include <boost/filesystem/path.hpp> 38 namespace fs = boost::filesystem;
46 :
public boost::enable_shared_from_this<StylesheetManager>
47 ,
public boost::noncopyable
TESTABLE bool hasStylesheet(const string &path)
boost::thread monitorThread
TESTABLE void onRemovedStylesheet(const fs::path &stylesheet_path)
removes the Stylesheet from the Stylesheet Cache and the prerendered tiles from the Cache...
TESTABLE void stopStylesheetObserving()
Stops the folder observation.
boost::scoped_ptr< boost::asio::dir_monitor > monitorService
TESTABLE void startStylesheetObserving(const shared_ptr< RequestManager > &manager)
starts observing the Stylesheet directory.
The StylesheetManager provides an interface to get arbitrary Stylesheets from the stylesheet director...
A Stylesheet parses a given MapCSS Stylesheet file and stores the defined rules.
boost::shared_mutex stylesheetsLock
static shared_ptr< Stylesheet > makeFallbackStylesheet(const shared_ptr< Geodata > &geodata)
TESTABLE void onFileSystemEvent(const boost::system::error_code &ec, const boost::asio::dir_monitor_event &ev)
handler method for dirwatch, forwards only .mapcss files to onNewStylesheet and onRemovedStylesheet ...
TESTABLE shared_ptr< Stylesheet > getStylesheet(const string &path)
Returns the Stylesheet Object for the Stylesheet specified.
shared_ptr< Configuration > config
TESTABLE void onNewStylesheet(const fs::path &stylesheet_path)
tries to read and parse the given file.
StylesheetManager(const shared_ptr< Configuration > &config)
Creates a new StylesheetManager with the given Configuration.
weak_ptr< RequestManager > manager
boost::asio::io_service ioService
fs::path stylesheetFolder
Represents a set of options accessible via strings.
boost::unordered_map< fs::path, shared_ptr< Stylesheet > > parsedStylesheets