comparison m_option.h @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents af274aef6b81
children c1a3f1bbba26
comparison
equal deleted inserted replaced
29262:7d545a6b8aff 29263:0f1b5b68af32
185 char* comments; 185 char* comments;
186 /// Size needed for the data. 186 /// Size needed for the data.
187 unsigned int size; 187 unsigned int size;
188 /// See \ref OptionTypeFlags. 188 /// See \ref OptionTypeFlags.
189 unsigned int flags; 189 unsigned int flags;
190 190
191 /// Parse the data from a string. 191 /// Parse the data from a string.
192 /** It is the only required function, all others can be NULL. 192 /** It is the only required function, all others can be NULL.
193 * 193 *
194 * \param opt The option that is parsed. 194 * \param opt The option that is parsed.
195 * \param name The full option name. 195 * \param name The full option name.
196 * \param param The parameter to parse. 196 * \param param The parameter to parse.
197 * \param dst Pointer to the memory where the data should be written. 197 * \param dst Pointer to the memory where the data should be written.
198 * If NULL the parameter validity should still be checked. 198 * If NULL the parameter validity should still be checked.
199 * \param src Source of the option, see \ref OptionParserModes. 199 * \param src Source of the option, see \ref OptionParserModes.
200 * \return On error a negative value is returned, on success the number of arguments 200 * \return On error a negative value is returned, on success the number of arguments
201 * consumed. For details see \ref OptionParserReturn. 201 * consumed. For details see \ref OptionParserReturn.
202 */ 202 */
203 int (*parse)(const m_option_t* opt,const char *name, char *param, void* dst, int src); 203 int (*parse)(const m_option_t* opt,const char *name, char *param, void* dst, int src);
204 204
205 /// Print back a value in string form. 205 /// Print back a value in string form.
206 /** \param opt The option to print. 206 /** \param opt The option to print.
207 * \param val Pointer to the memory holding the data to be printed. 207 * \param val Pointer to the memory holding the data to be printed.
208 * \return An allocated string containing the text value or (void*)-1 208 * \return An allocated string containing the text value or (void*)-1
209 * on error. 209 * on error.
222 /** \param opt The option to copy. 222 /** \param opt The option to copy.
223 * \param dst Pointer to the destination memory. 223 * \param dst Pointer to the destination memory.
224 * \param src Pointer to the source memory. 224 * \param src Pointer to the source memory.
225 */ 225 */
226 void (*save)(const m_option_t* opt,void* dst, void* src); 226 void (*save)(const m_option_t* opt,void* dst, void* src);
227 227
228 /// Set the value in the program (dst) from a save slot. 228 /// Set the value in the program (dst) from a save slot.
229 /** \param opt The option to copy. 229 /** \param opt The option to copy.
230 * \param dst Pointer to the destination memory. 230 * \param dst Pointer to the destination memory.
231 * \param src Pointer to the source memory. 231 * \param src Pointer to the source memory.
232 */ 232 */
254 /** \ingroup Options 254 /** \ingroup Options
255 */ 255 */
256 struct m_option { 256 struct m_option {
257 /// Option name. 257 /// Option name.
258 const char *name; 258 const char *name;
259 259
260 /// Reserved for higher level APIs, it shouldn't be used by parsers. 260 /// Reserved for higher level APIs, it shouldn't be used by parsers.
261 /** The suboption parser and func types do use it. They should instead 261 /** The suboption parser and func types do use it. They should instead
262 * use the priv field but this was inherited from older versions of the 262 * use the priv field but this was inherited from older versions of the
263 * config code. 263 * config code.
264 */ 264 */
265 void *p; 265 void *p;
266 266
267 /// Option type. 267 /// Option type.
268 const m_option_type_t* type; 268 const m_option_type_t* type;
269 269
270 /// See \ref OptionFlags. 270 /// See \ref OptionFlags.
271 unsigned int flags; 271 unsigned int flags;
272 272
273 /// \brief Mostly useful for numeric types, the \ref M_OPT_MIN flags must 273 /// \brief Mostly useful for numeric types, the \ref M_OPT_MIN flags must
274 /// also be set. 274 /// also be set.
275 double min; 275 double min;
276 276
277 /// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must 277 /// \brief Mostly useful for numeric types, the \ref M_OPT_MAX flags must
278 /// also be set. 278 /// also be set.
279 double max; 279 double max;
280 280
281 /// Type dependent data (for all kinds of extended settings). 281 /// Type dependent data (for all kinds of extended settings).
282 /** This used to be a function pointer to hold a 'reverse to defaults' func. 282 /** This used to be a function pointer to hold a 'reverse to defaults' func.
283 * Now it can be used to pass any type of extra args needed by the parser. 283 * Now it can be used to pass any type of extra args needed by the parser.
284 * Passing a 'default func' is still valid for all func based option types. 284 * Passing a 'default func' is still valid for all func based option types.
285 */ 285 */
425 #define M_OPT_MISSING_PARAM -2 425 #define M_OPT_MISSING_PARAM -2
426 426
427 /// Returned when the given parameter couldn't be parsed. 427 /// Returned when the given parameter couldn't be parsed.
428 #define M_OPT_INVALID -3 428 #define M_OPT_INVALID -3
429 429
430 /// \brief Returned if the value is "out of range". The exact meaning may 430 /// \brief Returned if the value is "out of range". The exact meaning may
431 /// vary from type to type. 431 /// vary from type to type.
432 #define M_OPT_OUT_OF_RANGE -4 432 #define M_OPT_OUT_OF_RANGE -4
433 433
434 /// Returned if the parser failed for any other reason than a bad parameter. 434 /// Returned if the parser failed for any other reason than a bad parameter.
435 #define M_OPT_PARSER_ERR -5 435 #define M_OPT_PARSER_ERR -5
454 454
455 /// Find the option matching the given name in the list. 455 /// Find the option matching the given name in the list.
456 /** \ingroup Options 456 /** \ingroup Options
457 * This function takes the possible wildcards into account (see 457 * This function takes the possible wildcards into account (see
458 * \ref M_OPT_TYPE_ALLOW_WILDCARD). 458 * \ref M_OPT_TYPE_ALLOW_WILDCARD).
459 * 459 *
460 * \param list Pointer to an array of \ref m_option. 460 * \param list Pointer to an array of \ref m_option.
461 * \param name Name of the option. 461 * \param name Name of the option.
462 * \return The matching option or NULL. 462 * \return The matching option or NULL.
463 */ 463 */
464 const m_option_t* m_option_list_find(const m_option_t* list,const char* name); 464 const m_option_t* m_option_list_find(const m_option_t* list,const char* name);