@@ -47,9 +47,9 @@ using std::string;
4747/* * Rename long pfw types to short ones in pfw namespace. */
4848namespace pfw
4949{
50- typedef ISelectionCriterionInterface Criterion;
51- typedef std::map<string, Criterion *> Criteria;
52- typedef CParameterMgrPlatformConnector Pfw;
50+ typedef ISelectionCriterionInterface Criterion;
51+ typedef std::map<string, Criterion *> Criteria;
52+ typedef CParameterMgrPlatformConnector Pfw;
5353}
5454
5555/* * Class to abstract the boolean+string status api. */
@@ -59,16 +59,27 @@ class Status
5959 /* * Fail without an instance of status. */
6060 static bool failure () { return false ; }
6161 /* * Fail with the given error msg. */
62- bool failure (const string &msg) { mMsg = msg; return false ; }
62+ bool failure (const string &msg)
63+ {
64+ mMsg = msg;
65+ return false ;
66+ }
6367 /* * Success (no error message). */
64- bool success () { mMsg .clear (); return true ; }
68+ bool success ()
69+ {
70+ mMsg .clear ();
71+ return true ;
72+ }
6573
6674 /* * Forward a status operation.
6775 * @param success[in] the operaton status to forward
6876 * or forward a previous failure if omitted
6977 */
70- bool forward (bool success = false ) {
71- if (success) { mMsg .clear (); }
78+ bool forward (bool success = false )
79+ {
80+ if (success) {
81+ mMsg .clear ();
82+ }
7283 return success;
7384 }
7485 /* * Error message accessors.
@@ -87,7 +98,8 @@ class Status
8798// /////////////////////////////
8899
89100/* * Default log callback. Log to cout or cerr depending on level. */
90- static void defaultLogCb (void *, PfwLogLevel level, const char *logLine) {
101+ static void defaultLogCb (void *, PfwLogLevel level, const char *logLine)
102+ {
91103 switch (level) {
92104 case pfwLogInfo:
93105 std::cout << logLine << std::endl;
@@ -98,7 +110,7 @@ static void defaultLogCb(void *, PfwLogLevel level, const char *logLine) {
98110 };
99111}
100112
101- static PfwLogger defaultLogger = { NULL , &defaultLogCb };
113+ static PfwLogger defaultLogger = {NULL , &defaultLogCb};
102114
103115class LogWrapper : public CParameterMgrPlatformConnector ::ILogger
104116{
@@ -109,7 +121,7 @@ class LogWrapper : public CParameterMgrPlatformConnector::ILogger
109121private:
110122 void info (const string &msg) override { log (pfwLogInfo, msg); }
111123
112- void warning (const string &msg) override { log (pfwLogWarning, msg); }
124+ void warning (const string &msg) override { log (pfwLogWarning, msg); }
113125
114126 void log (PfwLogLevel level, const string &strLog)
115127 {
@@ -137,6 +149,7 @@ struct PfwHandler_ : private utility::NonCopyable
137149 * Is mutable because even a const function can fail.
138150 */
139151 mutable Status lastStatus;
152+
140153private:
141154 LogWrapper mLogger ;
142155};
@@ -161,7 +174,6 @@ void PfwHandler::setLogger(const PfwLogger *logger)
161174 pfw->setLogger (&mLogger );
162175}
163176
164-
165177bool PfwHandler::createCriteria (const PfwCriterion criteriaArray[], size_t criterionNb)
166178{
167179 Status &status = lastStatus;
@@ -176,8 +188,7 @@ bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t crite
176188 }
177189 // Check that the criterion does not exist
178190 if (criteria.find (criterion.name ) != criteria.end ()) {
179- return status.failure (" Criterion \" " + string (criterion.name ) +
180- " \" already exist" );
191+ return status.failure (" Criterion \" " + string (criterion.name ) + " \" already exist" );
181192 }
182193
183194 // Create criterion type
@@ -189,15 +200,15 @@ bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t crite
189200 int value;
190201 if (criterion.inclusive ) {
191202 // Check that (int)1 << valueIndex would not overflow (UB)
192- if (std::numeric_limits<int >::max () >> valueIndex == 0 ) {
203+ if (std::numeric_limits<int >::max () >> valueIndex == 0 ) {
193204 return status.failure (" Too many values for criterion " +
194205 string (criterion.name ));
195206 }
196207 value = 1 << valueIndex;
197208 } else {
198209 value = static_cast <int >(valueIndex);
199210 }
200- const char * valueName = criterion.values [valueIndex];
211+ const char *valueName = criterion.values [valueIndex];
201212 string error;
202213 if (not type->addValuePair (value, valueName, error)) {
203214 return status.failure (" Could not add value " + string (valueName) +
@@ -210,10 +221,8 @@ bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t crite
210221 return status.success ();
211222}
212223
213-
214- bool pfwStart (PfwHandler *handle, const char *configPath,
215- const PfwCriterion criteria[], size_t criterionNb,
216- const PfwLogger *logger)
224+ bool pfwStart (PfwHandler *handle, const char *configPath, const PfwCriterion criteria[],
225+ size_t criterionNb, const PfwLogger *logger)
217226{
218227 // Check that the api is correctly used
219228 Status &status = handle->lastStatus ;
@@ -238,8 +247,7 @@ const char *pfwGetLastError(const PfwHandler *handle)
238247 return handle->lastStatus .msg ().c_str ();
239248}
240249
241- static pfw::Criterion *getCriterion (const pfw::Criteria &criteria,
242- const string &name)
250+ static pfw::Criterion *getCriterion (const pfw::Criteria &criteria, const string &name)
243251{
244252 pfw::Criteria::const_iterator it = criteria.find (name);
245253 return it == criteria.end () ? NULL : it->second ;
@@ -300,7 +308,8 @@ PfwParameterHandler *pfwBindParameter(PfwHandler *handle, const char path[])
300308 Status &status = handle->lastStatus ;
301309 if (handle->pfw == NULL ) {
302310 status.failure (" The parameter framework is not started, "
303- " while trying to bind parameter \" " + string (path) + " \" )" );
311+ " while trying to bind parameter \" " +
312+ string (path) + " \" )" );
304313 return NULL ;
305314 }
306315
@@ -321,7 +330,6 @@ void pfwUnbindParameter(PfwParameterHandler *handle)
321330 delete handle;
322331}
323332
324-
325333bool pfwGetIntParameter (const PfwParameterHandler *handle, int32_t *value)
326334{
327335 Status &status = handle->pfw .lastStatus ;
@@ -339,7 +347,9 @@ bool pfwGetStringParameter(const PfwParameterHandler *handle, char *value[])
339347 *value = NULL ;
340348 string retValue;
341349 bool success = handle->parameter .getAsString (retValue, status.msg ());
342- if (not success) { return status.forward (); }
350+ if (not success) {
351+ return status.forward ();
352+ }
343353
344354 *value = strdup (retValue.c_str ());
345355 return status.success ();
@@ -351,5 +361,7 @@ bool pfwSetStringParameter(PfwParameterHandler *handle, const char value[])
351361 return status.forward (handle->parameter .setAsString (value, status.msg ()));
352362}
353363
354- void pfwFree (void *ptr) { std::free (ptr); }
355-
364+ void pfwFree (void *ptr)
365+ {
366+ std::free (ptr);
367+ }
0 commit comments