ManaPlus
beingcommon.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2013-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef RESOURCES_BEINGCOMMON_H
23 #define RESOURCES_BEINGCOMMON_H
24 
25 #include "fs/virtfs/tools.h"
26 
27 #include "utils/foreach.h"
28 #include "utils/xml.h"
29 
30 #include "localconsts.h"
31 
32 UTILS_FOREACH_H
33 UTILS_VIRTFSTOOLS_H
34 
35 class BeingInfo;
36 
37 struct SpriteDisplay;
38 
39 #define loadXmlDir(name, function) \
40  { \
41  StringVect listVect; \
42  VirtFs::getFilesInDir(paths.getStringValue( \
43  name), listVect, ".xml"); \
44  FOR_EACH (StringVectCIter, itVect, listVect) \
45  { \
46  function(*itVect, SkipError_true); \
47  } \
48  }
49 
50 #define loadXmlDir2(name, function, ext, skipError) \
51  { \
52  StringVect listVect; \
53  VirtFs::getFilesInDir(name, listVect, ext); \
54  FOR_EACH (StringVectCIter, itVect, listVect) \
55  { \
56  function(*itVect, skipError); \
57  } \
58  }
59 
60 namespace BeingCommon
61 {
63  XmlNodePtrConst node,
64  const std::string &hoverCursor) A_NONNULL(1);
65 
67  XmlNodePtrConst node,
68  const int moreBlockFlags) A_NONNULL(1);
69 
70  void readAiAttributes(BeingInfo *const info,
71  XmlNodePtrConst node);
72 
73  void getIncludeFiles(const std::string &dir,
74  StringVect &list,
75  const std::string &ext);
76 
77  bool readObjectNodes(XmlNodePtrConst &spriteNode,
78  SpriteDisplay &display,
79  BeingInfo *const currentInfo,
80  const std::string &dbName) A_NONNULL(3);
81 } // namespace BeingCommon
82 
83 #endif // RESOURCES_BEINGCOMMON_H
#define A_NONNULL(...)
Definition: localconsts.h:168
bool info(InputEvent &event)
Definition: commands.cpp:57
bool readObjectNodes(xmlNode *const &spriteNode, SpriteDisplay &display, BeingInfo *const currentInfo, const std::string &dbName)
void readAiAttributes(BeingInfo *const info, xmlNode *const node)
Definition: beingcommon.cpp:96
void getIncludeFiles(const std::string &dir, StringVect &list, const std::string &ext)
void readBasicAttributes(BeingInfo *const info, xmlNode *const node, const std::string &hoverCursor)
Definition: beingcommon.cpp:37
void readWalkingAttributes(BeingInfo *const info, xmlNode *const node, const int moreBlockFlags)
Definition: beingcommon.cpp:60
std::vector< std::string > StringVect
Definition: stringvector.h:29