OpenXcom  1.0
Open-source clone of the original X-Com
ModInfo.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <string>
21 #include <vector>
22 
23 namespace OpenXcom
24 {
25 
29 class ModInfo
30 {
31 private:
32  const std::string _path;
33  std::string _name, _desc, _version, _author, _url, _id, _master;
34  bool _isMaster;
35  int _reservedSpace;
36  std::string _requiredExtendedVersion;
37  std::vector<std::string> _externalResourceDirs;
38 public:
40  ModInfo(const std::string &path);
42  void load(const std::string &filename);
44  const std::string &getPath() const;
46  const std::string &getName() const;
48  const std::string &getDescription() const;
50  const std::string &getVersion() const;
52  const std::string &getAuthor() const;
54  const std::string &getId() const;
57  const std::string &getMaster() const;
59  bool isMaster() const;
61  bool canActivate(const std::string &curMaster) const;
63  int getReservedSpace() const;
65  void setReservedSpace(int reservedSpace);
67  const std::string &getRequiredExtendedVersion() const;
69  const std::vector<std::string> &getExternalResourceDirs() const;
70 };
71 
72 }
const std::string & getId() const
Gets the id for this mod.
Definition: ModInfo.cpp:78
bool isMaster() const
Gets whether this mod is a master (i.e. a vanilla game/total conversion)
Definition: ModInfo.cpp:80
const std::string & getAuthor() const
Gets the author of this mod.
Definition: ModInfo.cpp:77
ModInfo(const std::string &path)
Creates default metadata for a mod at the specified path.
Definition: ModInfo.cpp:27
void setReservedSpace(int reservedSpace)
Sets mod size (DO NOT use this method outside Options::updateReservedSpace()).
Definition: ModInfo.cpp:83
const std::string & getMaster() const
Gets the master this mod can load under. If it can load under any master (or if this mod is a master ...
Definition: ModInfo.cpp:79
const std::string & getDescription() const
Gets the description for this mod.
Definition: ModInfo.cpp:75
const std::string & getName() const
Gets the name of this mod.
Definition: ModInfo.cpp:74
bool canActivate(const std::string &curMaster) const
Gets whether this mod can be activated.
Definition: ModInfo.cpp:97
const std::string & getVersion() const
Gets the version of this mod.
Definition: ModInfo.cpp:76
int getReservedSpace() const
Gets size of mod, bigger mod reserve more values in common colections/surfacesets.
Definition: ModInfo.cpp:82
Represents mod metadata.
Definition: ModInfo.h:29
const std::vector< std::string > & getExternalResourceDirs() const
Gets the list of external resource dirs to load for this mod.
Definition: ModInfo.cpp:103
const std::string & getRequiredExtendedVersion() const
Gets the OXCE version required by this mod.
Definition: ModInfo.cpp:81
const std::string & getPath() const
Gets the path where this mod resides on disk.
Definition: ModInfo.cpp:73
void load(const std::string &filename)
Loads the metadata from YAML.
Definition: ModInfo.cpp:35
Definition: BaseInfoState.cpp:40