32.6 Ordering parameters and Categories

By default variables and categories appear in alphabetical order. This order can be adjusted however by adding an integer after the category or parameter name in the text configuration file. Variables and categories are then sorted first by this integer and secondarily by there name. If this integer is unspecified, it is taken to be zero. The following example illustrates re-ordering of both categories and variables.

Chapter 32 - Example 8 : cpp file

#include "oeplatform.h"
#include "oesystem.h"

//Defines static const unsigned char* array InterfaceData
#include "ch32-8.itf"

using namespace OEPlatform;
using namespace OESystem;

int main(int argc, char** argv)
{
  OEInterface itf;
  OEConfigure(itf,InterfaceData);
  if (OECheckHelp(itf,argc,argv)) return 0;
  OEParseCommandLine(itf,argc,argv);
  OEWriteSettings(itf,oeout,true);
  return 0;
}

Chapter 32 - Example 8 : txt configuration file

!CATEGORY Variables
  !BRIEF Category for variables

  !PARAMETER -x 2
    !TYPE float
    !DEFAULT 0.0
    !BRIEF First variable
  !END

  !PARAMETER -y 1
    !TYPE float
    !DEFAULT 0.0
    !BRIEF Second variable
  !END

!END

!CATEGORY operator -1

  !PARAMETER -op
    !TYPE string
    !BRIEF Operation to perform on x and y
    !DETAIL
      The operation performed is

        x <-op> y

      So if -op is 'add' the operation is

        x + y
  !END

!END

Running this program gives the following results

> ch32-8 -x 1.0 -y 1.0 -op add
#Interface settings

#operator :
    -op  add

#Variables : Category for variables
    -y  1.000000
    -x  1.000000