Debian Codegraph @

Server/Web/HtmlTagSelectWithLabel.cpp

raw symbols SCIP
1 /*
2 RailControl - Model Railway Control Software
3
4 Copyright (c) 2017-2025 by Teddy / Dominik Mahrer - www.railcontrol.org
5
6 RailControl is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
9 later version.
10
11 RailControl is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with RailControl; see the file LICENCE. If not see
18 <http://www.gnu.org/licenses/>.
19 */
20
21 #include "Server/Web/HtmlTagSelectWithLabel.h"
22
23 namespace Server { namespace Web
24 {
25 HtmlTagSelectWithLabel::HtmlTagSelectWithLabel(const std::string& name,
26 const Languages::TextSelector label,
27 const std::map<std::string,DataModel::ObjectIdentifier>& options,
28 const DataModel::ObjectIdentifier& defaultValue)
29 : HtmlTag("div")
30 {
31 HtmlTag::AddClass("input_select_with_label");
32 AddChildTag(HtmlTagLabel(label, "s_" + name));
33 AddChildTag(HtmlTagSelect(name, options, defaultValue));
34 }
35
36 HtmlTag HtmlTagSelectWithLabel::AddAttribute(const std::string& name, const std::string& value)
37 {
38 HtmlTagSelect& select = reinterpret_cast<HtmlTagSelect&>(childTags.at(1));
39 select.HtmlTagSelect::AddAttribute(name, value);
40 return *this;
41 }
42
43 bool HtmlTagSelectWithLabel::IsAttributeSet(const std::string& name)
44 {
45 HtmlTagSelect& select = reinterpret_cast<HtmlTagSelect&>(childTags.at(1));
46 return select.HtmlTagSelect::IsAttributeSet(name);
47 }
48
49 HtmlTag HtmlTagSelectWithLabel::AddClass(const std::string& _class)
50 {
51 HtmlTagSelect& select = reinterpret_cast<HtmlTagSelect&>(childTags.at(1));
52 select.HtmlTagSelect::AddClass(_class);
53 return *this;
54 }
55 }} // namespace Server::Web
56