From d01c60c59f14c04f96fd33844ed920c4679d32fd Mon Sep 17 00:00:00 2001 From: pouillot Date: Thu, 10 Feb 2011 11:10:32 +0000 Subject: [PATCH] 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 --- src/libs/tgf/params.cpp | 26 ++++++++++++++++++++++++++ src/libs/tgfdata/race.h | 6 +++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/libs/tgf/params.cpp b/src/libs/tgf/params.cpp index 9b36011a6..2be595c73 100644 --- a/src/libs/tgf/params.cpp +++ b/src/libs/tgf/params.cpp @@ -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. diff --git a/src/libs/tgfdata/race.h b/src/libs/tgfdata/race.h index 1f45539a5..7ba4b79d2 100644 --- a/src/libs/tgfdata/race.h +++ b/src/libs/tgfdata/race.h @@ -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;