1 /*MT*
2
3 MediaTomb - http://www.mediatomb.cc/
4
5 pages.cc - this file is part of MediaTomb.
6
7 Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
9
10 Copyright (C) 2006-2010 Gena Batyan <bgeradz@mediatomb.cc>,
11 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12 Leonhard Wimmer <leo@mediatomb.cc>
13
14 MediaTomb is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License version 2
16 as published by the Free Software Foundation.
17
18 MediaTomb is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 version 2 along with MediaTomb; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
26
27 $Id$
28 */
29
30 /// \file pages.cc
31
32 #include "pages.h" // API
33
34 namespace Web {
35
createWebRequestHandler(std::shared_ptr<Context> context,std::shared_ptr<ContentManager> content,std::shared_ptr<UpnpXMLBuilder> xmlBuilder,std::string_view page)36 std::unique_ptr<WebRequestHandler> createWebRequestHandler(
37 std::shared_ptr<Context> context,
38 std::shared_ptr<ContentManager> content,
39 std::shared_ptr<UpnpXMLBuilder> xmlBuilder,
40 std::string_view page)
41 {
42 if (page == "add")
43 return std::make_unique<Web::Add>(std::move(content));
44 if (page == "remove")
45 return std::make_unique<Web::Remove>(std::move(content));
46 if (page == "add_object")
47 return std::make_unique<Web::AddObject>(std::move(content));
48 if (page == "auth")
49 return std::make_unique<Web::Auth>(std::move(content));
50 if (page == "containers")
51 return std::make_unique<Web::Containers>(std::move(content), std::move(xmlBuilder));
52 if (page == "directories")
53 return std::make_unique<Web::Directories>(std::move(content));
54 if (page == "files")
55 return std::make_unique<Web::Files>(std::move(content));
56 if (page == "items")
57 return std::make_unique<Web::Items>(std::move(content), std::move(xmlBuilder));
58 if (page == "edit_load")
59 return std::make_unique<Web::EditLoad>(std::move(content), std::move(xmlBuilder));
60 if (page == "edit_save")
61 return std::make_unique<Web::EditSave>(std::move(content));
62 if (page == "autoscan")
63 return std::make_unique<Web::Autoscan>(std::move(content));
64 if (page == "void")
65 return std::make_unique<Web::VoidType>(std::move(content));
66 if (page == "tasks")
67 return std::make_unique<Web::Tasks>(std::move(content));
68 if (page == "action")
69 return std::make_unique<Web::Action>(std::move(content));
70 if (page == "clients")
71 return std::make_unique<Web::Clients>(std::move(content));
72 if (page == "config_load")
73 return std::make_unique<Web::ConfigLoad>(std::move(content));
74 if (page == "config_save")
75 return std::make_unique<Web::ConfigSave>(std::move(context), std::move(content));
76
77 throw_std_runtime_error("Unknown page: {}", page);
78 }
79
80 } // namespace Web
81