Crossfire Server, Trunk
LicenseManager.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2021-2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef LICENSEMANAGER_H
14 #define LICENSEMANAGER_H
15 
16 #include <string>
17 #include <map>
18 #include <vector>
19 
20 struct BufferReader;
21 
26 public:
27 
28  typedef std::pair<std::string, std::string> LicenseItem;
29  typedef std::map<std::string, std::vector<LicenseItem>> LicenseItems;
34  virtual ~LicenseManager();
35 
41  LicenseItems getForFace(const std::string &face);
42 
47  std::map<std::string, LicenseItems> getAll() const { return m_licenses; }
48 
52  void reset() { m_licenses.clear(); }
53 
59  void readLicense(BufferReader *reader, const char *filename);
60 
66  static std::string licenseNameFromFaceName(const std::string &face);
67 
68  static void parseLicenseFile(BufferReader *reader, const char *filename, std::vector<LicenseItem> &items);
69 
70 private:
71  std::map<std::string, LicenseItems> m_licenses;
72 };
73 
74 #endif /* LICENSEMANAGER_H */
LicenseManager::m_licenses
std::map< std::string, LicenseItems > m_licenses
Definition: LicenseManager.h:71
LicenseManager::reset
void reset()
Definition: LicenseManager.h:52
LicenseManager::LicenseItems
std::map< std::string, std::vector< LicenseItem > > LicenseItems
Definition: LicenseManager.h:29
npc_dialog.filename
filename
Definition: npc_dialog.py:99
LicenseManager::LicenseManager
LicenseManager()
Definition: LicenseManager.cpp:19
LicenseManager::licenseNameFromFaceName
static std::string licenseNameFromFaceName(const std::string &face)
Definition: LicenseManager.cpp:83
LicenseManager::readLicense
void readLicense(BufferReader *reader, const char *filename)
Definition: LicenseManager.cpp:25
LicenseManager::~LicenseManager
virtual ~LicenseManager()
Definition: LicenseManager.cpp:22
LicenseManager::getForFace
LicenseItems getForFace(const std::string &face)
Definition: LicenseManager.cpp:75
LicenseManager::LicenseItem
std::pair< std::string, std::string > LicenseItem
Definition: LicenseManager.h:28
LicenseManager
Definition: LicenseManager.h:25
LicenseManager::parseLicenseFile
static void parseLicenseFile(BufferReader *reader, const char *filename, std::vector< LicenseItem > &items)
Definition: LicenseManager.cpp:57
BufferReader
Definition: bufferreader.cpp:21
LicenseManager::getAll
std::map< std::string, LicenseItems > getAll() const
Definition: LicenseManager.h:47