[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Capabilities.h
blobe893d987c085652235fa253c693c9b4c941ff68f
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Capabilities.h
7 * $Id: Capabilities.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Arturo Montes <mitosys@colomsat.net.co>
11 //=============================================================================
14 #ifndef ACE_CAPABILITIES_H
15 #define ACE_CAPABILITIES_H
16 #include /**/ "ace/pre.h"
18 #include /**/ "ace/config-all.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/Null_Mutex.h"
25 #include "ace/Hash_Map_Manager_T.h"
26 #include "ace/Containers.h"
27 #include "ace/SString.h"
28 #include "ace/Functor_String.h"
30 #if defined (ACE_IS_SPLITTING)
31 # include "ace/OS_NS_ctype.h"
32 #endif /* ACE_IS_SPLITTING */
35 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
37 /**
38 * @class ACE_CapEntry
40 * @brief This class is the base class for all ACE Capabilities entry
41 * subclasses.
43 * This class is not instantiable and does not provide accessors
44 * or methods. If you want to add a new kind of attribute subclass
45 * this class and dynamic_cast to proper subclass.
47 class ACE_Export ACE_CapEntry
49 public:
51 virtual ~ACE_CapEntry (void);
53 protected:
55 enum
57 ACE_INTCAP = 0,
58 ACE_STRINGCAP = 1,
59 ACE_BOOLCAP = 2
62 ACE_CapEntry (int captype);
64 protected:
66 int captype_;
70 /**
71 * @class ACE_IntCapEntry
73 * @brief This class implement the ACE Integer Capability subclass.
75 * This is a container class for ACE Capabilities integer container
76 * values.
78 class ACE_Export ACE_IntCapEntry : public ACE_CapEntry
80 public:
81 ACE_IntCapEntry (int val);
82 int getval (void) const;
84 protected:
85 int val_;
88 /**
89 * @class ACE_StringCapEntry
91 * @brief This class implement the ACE String Capability subclass.
93 * This is a container class for ACE Capabilities String container
94 * values.
96 class ACE_Export ACE_StringCapEntry : public ACE_CapEntry
98 public:
99 ACE_StringCapEntry (const ACE_TString &val);
100 ACE_TString getval (void) const;
102 protected:
103 ACE_TString val_;
107 * @class ACE_BoolCapEntry
109 * @brief This class implement the ACE Bool Capability subclass.
111 * This is a container class for ACE Capabilities bool container
112 * values.
114 class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry
116 public:
117 ACE_BoolCapEntry (int val);
118 int getval (void) const;
120 protected:
121 int val_;
125 * @class ACE_Capabilities
127 * @brief This class implement the ACE Capabilities.
129 * This is a container class for ACE Capabilities
130 * values. Currently exist three different capability values:
131 * <ACE_IntCapEntry> (integer), <ACE_BoolCapEntry> (bool) and
132 * <ACE_StringCapEntry> (String). An ACE_Capabilities is a
133 * unordered set of pair = (<String>, <ACE_CapEntry> *). Where
134 * the first component is the name of capability and the second
135 * component is a pointer to the capability value container. A
136 * <FILE> is a container for ACE_Capabilities, the
137 * ACE_Capabilities has a name in the file, as a termcap file.
139 class ACE_Export ACE_Capabilities
141 public:
143 typedef ACE_Hash_Map_Manager_Ex<ACE_TString, ACE_CapEntry *, ACE_Hash<ACE_TString>, ACE_Equal_To<ACE_TString>, ACE_Null_Mutex> CAPABILITIES_MAP;
145 /// The Constructor
146 ACE_Capabilities (void);
148 /// The Destructor
149 ~ACE_Capabilities(void);
151 public:
153 /// Get a string entry.
154 int getval (const ACE_TCHAR *ent, ACE_TString &val);
156 /// Get an integer entry.
157 int getval (const ACE_TCHAR *ent, int &val);
159 /// Get the ACE_Capabilities name from FILE fname and load the
160 /// associated capabitily entries in map.
161 int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name);
163 protected:
165 /// Parse an integer property
166 const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap);
168 /// Parse a string property
169 const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap);
171 /// Fill the ACE_Capabilities with description in ent.
172 int fillent(const ACE_TCHAR *ent);
174 /// Parse a cap entry
175 int parseent (const ACE_TCHAR *name, ACE_TCHAR *line);
177 /// Get a line from FILE input stream
178 int getline (FILE* fp,
179 ACE_TString &line);
181 /// Is a valid entry
182 int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line);
184 /// Reset the set of capabilities
185 void resetcaps (void);
187 private:
189 /// This is the set of ACE_CapEntry.
190 CAPABILITIES_MAP caps_;
194 #if defined (ACE_IS_SPLITTING)
196 is_empty (const ACE_TCHAR *line)
198 while (*line && ACE_OS::ace_isspace (*line))
199 ++line;
201 return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#');
205 is_line (const ACE_TCHAR *line)
207 while (*line && ACE_OS::ace_isspace (*line))
208 ++line;
210 return *line != ACE_TEXT ('\0');
212 #endif /* ACE_IS_SPLITTING */
214 ACE_END_VERSIONED_NAMESPACE_DECL
216 #if defined (__ACE_INLINE__)
217 #include "ace/Capabilities.inl"
218 #endif /* __ACE_INLINE__ */
220 #include /**/ "ace/post.h"
221 #endif /* __ACE_CAPABILITIES_H__ */