Fawkes API  Fawkes Development Version
url_manager.h
1 
2 /***************************************************************************
3  * url_manager.h - Web URL manager
4  *
5  * Created: Thu Nov 25 21:53:07 2010
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __LIBS_WEBVIEW_URL_MANAGER_H_
24 #define __LIBS_WEBVIEW_URL_MANAGER_H_
25 
26 #include <map>
27 #include <string>
28 
29 namespace fawkes {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
34 class Mutex;
35 class WebRequestProcessor;
36 
38 {
39  public:
40  WebUrlManager();
42 
43  void register_baseurl(const char *url_prefix, WebRequestProcessor *processor);
44  void unregister_baseurl(const char *url_prefix);
45 
46  WebRequestProcessor * find_processor(std::string &url) const;
47  Mutex * mutex();
48 
49  private:
50  Mutex *__mutex;
51  WebRequestProcessor *__startpage_processor;
52  std::map<std::string, WebRequestProcessor *> __processors;
53 };
54 
55 } // end namespace fawkes
56 
57 #endif
WebUrlManager()
Constructor.
Definition: url_manager.cpp:43
Fawkes library namespace.
Abstract web request processor.
Mutex * mutex()
Get internal mutex.
Manage URL mappings.
Definition: url_manager.h:37
void unregister_baseurl(const char *url_prefix)
Remove a request processor.
Definition: url_manager.cpp:87
WebRequestProcessor * find_processor(std::string &url) const
Lock mutex and find processor.
~WebUrlManager()
Destructor.
Definition: url_manager.cpp:51
Mutex mutual exclusion lock.
Definition: mutex.h:32
void register_baseurl(const char *url_prefix, WebRequestProcessor *processor)
Add a request processor.
Definition: url_manager.cpp:64