Changeset View
Changeset View
Standalone View
Standalone View
src/kconfig_compiler/README.dox
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | |||||
349 | for each Enum entry. Since each enum is defined in a little enclosing class of its own, | 349 | for each Enum entry. Since each enum is defined in a little enclosing class of its own, | ||
350 | this allows the same Enum value names to be used in different enums. For example, the | 350 | this allows the same Enum value names to be used in different enums. For example, the | ||
351 | .kcfg entry | 351 | .kcfg entry | ||
352 | 352 | | |||
353 | \verbatim | 353 | \verbatim | ||
354 | <entry name="KeepData" type="Enum"> | 354 | <entry name="KeepData" type="Enum"> | ||
355 | <choices> | 355 | <choices> | ||
356 | <choice name="Do"> | 356 | <choice name="Do"> | ||
357 | <choice name="Dont"> | 357 | <choice name="Dont" value="Don't"> | ||
358 | </choices> | 358 | </choices> | ||
359 | </entry> | 359 | </entry> | ||
360 | \endverbatim | 360 | \endverbatim | ||
361 | 361 | | |||
362 | will generate this public class containing the enum definition, inside the generated class: | 362 | will generate this public class containing the enum definition, inside the generated class: | ||
363 | 363 | | |||
364 | \verbatim | 364 | \verbatim | ||
365 | class EnumKeepData | 365 | class EnumKeepData | ||
366 | { | 366 | { | ||
367 | public: | 367 | public: | ||
368 | enum type { Do, Dont, COUNT }; | 368 | enum type { Do, Dont, COUNT }; | ||
369 | }; | 369 | }; | ||
370 | \endverbatim | 370 | \endverbatim | ||
371 | 371 | | |||
372 | Since 5.68, if present the <b>value</b> attribute will be used as the choice value written to the backend | ||||
ervin: typo: it says "used used" | |||||
373 | instead of the <b>name</b>, allowing to write text incompatible with enum naming. | ||||
374 | | ||||
372 | Alternatively, if <b>GlobalEnums</b> is set to true, all Enum items are defined as | 375 | Alternatively, if <b>GlobalEnums</b> is set to true, all Enum items are defined as | ||
373 | unnamed enums in the global scope of the generated class. In this case, all Enum values | 376 | unnamed enums in the global scope of the generated class. In this case, all Enum values | ||
374 | must have different names to avoid clashes. However, you can use a 'prefix' argument | 377 | must have different names to avoid clashes. However, you can use a 'prefix' argument | ||
375 | in \<choices\> to prevent duplicate enum member names clashing. Using this, the Enum value | 378 | in \<choices\> to prevent duplicate enum member names clashing. Using this, the Enum value | ||
376 | names are prefixed in code with the string you specify. For example, if <b>GlobalEnums</b> | 379 | names are prefixed in code with the string you specify. For example, if <b>GlobalEnums</b> | ||
377 | is set to true, the .kcfg entry | 380 | is set to true, the .kcfg entry | ||
378 | 381 | | |||
379 | \verbatim | 382 | \verbatim | ||
380 | <entry name="KeepData" type="Enum"> | 383 | <entry name="KeepData" type="Enum"> | ||
381 | <choices prefix="Keep_"> | 384 | <choices prefix="Keep_"> | ||
382 | <choice name="Do"> | 385 | <choice name="Do"> | ||
383 | <choice name="Dont"> | 386 | <choice name="Dont" value="Don't"> | ||
384 | </choices> | 387 | </choices> | ||
385 | </entry> | 388 | </entry> | ||
386 | \endverbatim | 389 | \endverbatim | ||
387 | 390 | | |||
388 | will generate config file entries of "KeepData=Do" and "KeepData=Dont", but the enum | 391 | will generate config file entries of "KeepData=Do" and "KeepData=Dont", but the enum | ||
389 | will be declared | 392 | will be declared | ||
390 | 393 | | |||
391 | \verbatim | 394 | \verbatim | ||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |
typo: it says "used used"