Debian Codegraph @

src/bnetd/topic.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2015 xboi209
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef INCLUDED_TOPIC_TYPES
19 #define INCLUDED_TOPIC_TYPES
20
21 #include <memory>
22 #include <string>
23 #include <vector>
24
25 #include "connection.h"
26 #include "common/list.h"
27 #endif
28
29 #ifndef JUST_NEED_TYPES
30 #ifndef INCLUDED_TOPIC_PROTOS
31 #define INCLUDED_TOPIC_PROTOS
32 namespace pvpgn
33 {
34
35 namespace bnetd
36 {
37
38 class class_topic
39 {
40 //all public member functions of class_topic verify channel name and topic length
41 public:
42 class_topic();
43
44 std::string get(const std::string channel_name);
45 bool set(const std::string channel_name, const std::string topic_text, bool do_save);
46 bool display(t_connection * c, const std::string channel_name);
47 private:
48 struct t_topic
49 {
50 std::string channel_name;
51 std::string topicstr;
52 bool save;
53 };
54
55 class class_topiclist
56 {
57 public:
58 static bool IsHeadLoaded;
59 std::shared_ptr<class_topic::t_topic> get(const std::string channel_name);
60 bool save();
61 void add(std::string channel_name, std::string topic_text, bool do_save);
62 private:
63 static std::vector<std::shared_ptr<class_topic::t_topic>> Head;
64 } topiclist;
65 };
66
67 } //namespace bnetd
68
69 } //namespace pvpgn
70
71 #endif
72 #endif