Added GfParmExists function to check if a given section exists (fixed clumsy previous commit, sorry)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3349 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 17bd5746bcd4b7feae66513ed8c6376d8736a76c
Former-commit-id: ffafca2085cfcdb4f0530df9d4dc80cf4ca714f8
This commit is contained in:
pouillot 2011-02-10 11:10:32 +00:00
parent ca09b52e03
commit d01c60c59f
2 changed files with 29 additions and 3 deletions

View file

@ -2163,6 +2163,32 @@ GfParmGetEltNb (void *handle, const char *path)
return count;
}
/** Check if a section exists.
@ingroup paramsdata
@param handle handle of parameters
@param path path of section
@return 0 if doesn't exist, not 0 otherwise.
*/
int
GfParmExists (void *handle, const char *path)
{
struct parmHandle *parmHandle = (struct parmHandle *)handle;
struct parmHeader *conf;
struct section *section;
int count;
if ((parmHandle == NULL) || (parmHandle->magic != PARM_MAGIC)) {
GfLogError ("GfParmExists: bad handle (%p)\n", parmHandle);
return 0;
}
conf = parmHandle->conf;
section = (struct section *)GfHashGetStr (conf->sectionHash, path);
return section != 0;
}
/** Seek the first section element of a list.

View file

@ -55,6 +55,8 @@ public:
GfRaceManager* getManager() const;
const std::string& getSessionName() const;
enum EDisplayMode { eDisplayNormal, eDisplayResultsOnly,
nDisplayModeNumber };
enum ETimeOfDaySpec { eTimeDawn, eTimeMorning, eTimeNoon, eTimeAfternoon,
@ -76,7 +78,7 @@ public:
ERainSpec eRainSpec;
};
Parameters* getParameters(const std::string& strSessionName) const;
Parameters* getParameters();
int getSupportedFeatures() const;
@ -102,8 +104,6 @@ public:
GfTrack* getTrack() const;
const std::string& getSessionName() const;
void* getResultsDescriptorHandle() const;
void print() const;