00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef ACE_CAPABILITIES_H
00015 #define ACE_CAPABILITIES_H
00016 #include "ace/pre.h"
00017
00018 #include "ace/config-all.h"
00019
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif
00023
00024 #include "ace/Null_Mutex.h"
00025 #include "ace/Hash_Map_Manager_T.h"
00026 #include "ace/Containers.h"
00027 #include "ace/SString.h"
00028 #include "ace/Functor_String.h"
00029
00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 class ACE_Export ACE_CapEntry
00043 {
00044 public:
00045
00046 virtual ~ACE_CapEntry (void);
00047
00048 protected:
00049
00050 enum
00051 {
00052 ACE_INTCAP = 0,
00053 ACE_STRINGCAP = 1,
00054 ACE_BOOLCAP = 2
00055 };
00056
00057 ACE_CapEntry (int captype);
00058
00059 protected:
00060
00061 int captype_;
00062
00063 };
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 class ACE_Export ACE_IntCapEntry : public ACE_CapEntry
00074 {
00075 public:
00076 ACE_IntCapEntry (int val);
00077 int getval (void) const;
00078
00079 protected:
00080 int val_;
00081 };
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 class ACE_Export ACE_StringCapEntry : public ACE_CapEntry
00092 {
00093 public:
00094 ACE_StringCapEntry (const ACE_TString &val);
00095 ACE_TString getval (void) const;
00096
00097 protected:
00098 ACE_TString val_;
00099 };
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry
00110 {
00111 public:
00112 ACE_BoolCapEntry (int val);
00113 int getval (void) const;
00114
00115 protected:
00116 int val_;
00117 };
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 class ACE_Export ACE_Capabilities
00135 {
00136 public:
00137
00138 typedef ACE_Hash_Map_Manager_Ex<ACE_TString, ACE_CapEntry *, ACE_Hash<ACE_TString>, ACE_Equal_To<ACE_TString>, ACE_Null_Mutex> CAPABILITIES_MAP;
00139
00140
00141 ACE_Capabilities (void);
00142
00143
00144 ~ACE_Capabilities(void);
00145
00146 public:
00147
00148
00149 int getval (const ACE_TCHAR *ent, ACE_TString &val);
00150
00151
00152 int getval (const ACE_TCHAR *ent, int &val);
00153
00154
00155
00156 int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name);
00157
00158 protected:
00159
00160
00161 const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap);
00162
00163
00164 const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap);
00165
00166
00167 int fillent(const ACE_TCHAR *ent);
00168
00169
00170 int parseent (const ACE_TCHAR *name, ACE_TCHAR *line);
00171
00172
00173 int getline (FILE* fp,
00174 ACE_TString &line);
00175
00176
00177 int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line);
00178
00179
00180 void resetcaps (void);
00181
00182 private:
00183
00184
00185 CAPABILITIES_MAP caps_;
00186
00187 };
00188
00189 #if defined (ACE_IS_SPLITTING)
00190 int
00191 is_empty (const ACE_TCHAR *line)
00192 {
00193 while (*line && isspace (*line))
00194 ++line;
00195
00196 return *line == ACE_LIB_TEXT ('\0') || *line == ACE_LIB_TEXT ('#');
00197 }
00198
00199 int
00200 is_line (const ACE_TCHAR *line)
00201 {
00202 while (*line && isspace (*line))
00203 ++line;
00204
00205 return *line != ACE_LIB_TEXT ('\0');
00206 }
00207 #endif
00208
00209 ACE_END_VERSIONED_NAMESPACE_DECL
00210
00211 #if defined (__ACE_INLINE__)
00212 #include "ace/Capabilities.inl"
00213 #endif
00214
00215 #include "ace/post.h"
00216 #endif