Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 1 and Version 2 of code/doc/ConfigValueContainer


Ignore:
Timestamp:
Feb 27, 2008, 7:47:28 PM (17 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/ConfigValueContainer

    v1 v2  
    8686== The config-file ==
    8787
     88The config-file (usually ''orxonox.ini'') has a clear structure, split into sections, where each section belongs to one class. A new section is introduced by a line containing the name of the class in square brackets:
     89{{{
     90[ClassName]
     91}}}
     92The following lines contain all config-values of the class in the following form:
     93{{{
     94varname=value
     95}}}
    8896
     97The config file adds missing variables or sections and repairs unreadable values by resetting them to the default value, but it doesn't change or remove needless entries. This allows you to add comments or funny ASCII-art. Whitespaces are ignored, so you can format your config-file in every way you like.
     98
     99You can begin a line with a comment-symbol to ignore a line. If this removes an entry, a new one gets added to the end of the section, but you could add two versions of a line and comment one (for example when you want to test different settings without losing the previous value). There are four different comment-symbols:
     100 * '''#'''comment: script-language style
     101 * '''%'''comment: matlab style
     102 * ''';'''comment: unreal tournament config-file style
     103 * '''//'''comment: code style
     104
     105Different variable-types have different formattings in the config file. There are three different cases:
     106 * '''Primitives''': varname=value
     107 * '''Strings''': varname="string"
     108 * '''Complex types''' (like vectors): varname=(value1, ..., valueN)
     109
     110 * Additionally booleans can be denoted by using ''true'' or ''false''.
     111
     112There are four cases causing the parser to change the config-file:
     113 1. Case: A config-value is set, but can't be parsed (wrong formatting) or can't be converted to the wanted type:
     114   * Change: The value is set back to the default
     115 1. Case: A config-value is missing but the section of the corresponding class exists:
     116   * Change: The value is added at the end of the section
     117 1. Case: The whole section is missing or can't be found because the [!ClassName]-line is missing:
     118   * Change: The whole section is added at the end of the file
     119 1. Case: The config-file is missing:
     120   * Change: The config-file is created and all sections and values are written to the file.
     121
     122Example of a valid config-file:
     123{{{
     124[MyClass] <-- This name is stupid
     125firstValue_  = 1.000000
     126secondValue_ = 1.0
     127thirdValue_  = 1
     128
     129[OtherClass] <-- This name is even worse
     130//teststring = "test"
     131teststring = "teeeeeeeeeeeest"
     132
     133[StupidNamedClass] <-- This name rocks
     134position1_=(1.0, 2.0, 3.0)
     135position2_ = ( 1.000000 , 2.000000 , 3.000000 )
     136    position3_ =      (1,2,3)
     137
     138gagagugubleeeeeeeeeep!
     139
     140[LastClass] <-- Where did you know...? Now this is scary...
     141moo_ = "Oh yes they do!"
     142bTheyMoo_ = true
     143}}}