| 151 | }; |
| 152 | |
| 153 | class ConfigAccess final : |
| 154 | public RefCntIface<IConfigImpl<ConfigAccess, CheckStatusWrapper> > |
| 155 | { |
| 156 | public: |
| 157 | ConfigAccess(RefPtr<ConfigFile> c) : confFile(c) { } |
| 158 | |
| 159 | // IConfig implementation |
| 160 | IConfigEntry* find(CheckStatusWrapper* status, const char* name) |
| 161 | { |
| 162 | try |
| 163 | { |
| 164 | return confFile.hasData() ? newParam(confFile->findParameter(name)) : NULL; |
| 165 | } |
| 166 | catch (const Firebird::Exception& ex) |
| 167 | { |
| 168 | ex.stuffException(status); |
| 169 | } |
| 170 | return NULL; |
| 171 | } |
| 172 | |
| 173 | IConfigEntry* findValue(CheckStatusWrapper* status, const char* name, const char* value) |
| 174 | { |
| 175 | try |
| 176 | { |
| 177 | return confFile.hasData() ? newParam(confFile->findParameter(name, value)) : NULL; |
| 178 | } |
| 179 | catch (const Firebird::Exception& ex) |
| 180 | { |
| 181 | ex.stuffException(status); |
| 182 | } |
| 183 | return NULL; |
| 184 | } |
| 185 | |
| 186 | IConfigEntry* findPos(CheckStatusWrapper* status, const char* name, unsigned int n) |
| 187 | { |
| 188 | try |
| 189 | { |
| 190 | if (!confFile.hasData()) |
| 191 | { |
| 192 | return NULL; |
| 193 | } |
| 194 | |
| 195 | const ConfigFile::Parameters& p = confFile->getParameters(); |
| 196 | FB_SIZE_T pos; |
| 197 | if (!p.find(name, pos)) |
| 198 | { |
| 199 | return NULL; |
| 200 | } |
| 201 | |
| 202 | if (n + pos >= p.getCount() || p[n + pos].name != name) |
| 203 | { |
| 204 | return NULL; |
| 205 | } |
| 206 | |
| 207 | return newParam(&p[n + pos]); |
| 208 | } |
| 209 | catch (const Firebird::Exception& ex) |
| 210 | { |
no outgoing calls
no test coverage detected