Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 11, 2010, 12:34:00 AM (15 years ago)
Author:
landauf
Message:

merged doc branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/XMLPort.h

    r7284 r7401  
    2828
    2929/**
     30    @defgroup XMLPort XMLPort
     31    @ingroup XML
     32*/
     33
     34/**
    3035    @file
     36    @ingroup XML XMLPort
    3137    @brief Declaration of the XMLPort helper classes and macros.
    3238
     
    6975
    7076    In the XML file, a param or attribute will be set like this:
     77    @code
    7178    <classname paramname="value" />
     79    @endcode
    7280
    7381    The macro will then call loadfunction(value) to set the given value (or call savefunction() to
     
    8896
    8997    In the XML file, a param or attribute will be set like this:
     98    @code
    9099    <classname paramname="value" />
     100    @endcode
    91101
    92102    The macro will then store "value" in the variable or read it when saving.
     
    148158    @param paramname The name of the attribute
    149159    @param loadfunction The function to set the attribute inside of the member object.
    150     @param loadfunction The function to get the attribute from the member object
     160    @param savefunction The function to get the attribute from the member object
     161    @param xmlelement The XML-element that is parsed by this macro
     162    @param mode Loading or saving
    151163
    152164    Sometimes you'll have a member object in your class, which has it's own load- and savefunctions.
    153165    With this macro, you can simply use them instead of writing your own functions.
    154166
    155     @example
     167    Example:
    156168    Your class is called SpaceShip and this class has an object (myPilot_) of class Pilot. Pilot has a name
    157169    and two functions, setName(name) and getName(). Now you want an attribute "pilotname" in your
     
    196208    @param sectionname The name of the subsection in the XML file that encloses the sub-objects ("" means no subsection)
    197209    @param loadfunction The function to add a new object to the class
    198     @param loadfunction The function to get all added objects from the class
     210    @param savefunction The function to get all added objects from the class
    199211    @param xmlelement The XMLElement (received through the XMLPort function)
    200212    @param mode The mode (load/save) (received through the XMLPort function)
     
    210222    likely the best option, so this is usually true.
    211223
    212     @note
     224    @details
    213225    The load- and savefunctions have to follow an exactly defined protocol.
    214226    Loadfunction:
    215227      The loadfunction gets a pointer to the object.
    216       > void loadfunction(objectclass* pointer);
     228      @code
     229      void loadfunction(objectclass* pointer);
     230      @endcode
    217231
    218232    Savefunction:
     
    220234      gets called again, but with index + 1. It's the functions responsibility to do something smart
    221235      with the index and to return 0 if all objects were returned.
    222       > objectclass* savefunction(unsigned int index) const;
     236      @code
     237      objectclass* savefunction(unsigned int index) const;
     238      @endcode
    223239
    224240      Possible implementation:
     241      @code
    225242        objectclass* savefunction(unsigned int index) const
    226243        {
     
    230247            return 0;
    231248        }
    232 
    233     @example
     249      @endcode
     250
     251    Example:
    234252    Possible usage of the macro:
    235     > XMLPortObject(SpaceShip, Weapon, "weapons", addWeapon, getWeapon, xmlelement, mode, false, true);
     253    @code
     254    XMLPortObject(SpaceShip, Weapon, "weapons", addWeapon, getWeapon, xmlelement, mode, false, true);
     255    @endcode
    236256
    237257    Now you can add weapons through the XML file:
     258    @code
    238259    <SpaceShip someattribute="..." ...>
    239260      <weapons>
     
    243264      </weapons>
    244265    </SpaceShip>
     266    @endcode
    245267
    246268    Note that "weapons" is the subsection. This allows you to add more types of sub-objects. In our example,
Note: See TracChangeset for help on using the changeset viewer.