Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 19, 2006, 11:33:27 PM (18 years ago)
Author:
bensch
Message:

first step in the direction of parameter descriptions… again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/util/loading/load_param_class_description.cc

    r9768 r9771  
    2222 *  A list, that holds all the classes that are loadable (classes not objects!!)
    2323 */
    24 LoadParamClassDescription::ClassDescriptionSet LoadParamClassDescription::_classList;
     24LoadParamClassDescription::ClassDescriptionMap LoadParamClassDescription::_classList;
    2525
    2626/**
     
    4848
    4949
     50
     51void LoadParamClassDescription::describeClass(const ClassID& classID,
     52    const std::string& paramName,
     53    const std::string& descriptionText)
     54{
     55  ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName);
     56
     57}
     58
     59
     60void LoadParamClassDescription::setValuesOf(const ClassID& classID,
     61    const std::string& paramName,
     62    unsigned int paramCount,
     63    const MultiType* const defaultValues,
     64    bool retVal)
     65{
     66  ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName);
     67
     68}
     69
     70
    5071/**
    51  *  prints out all loadable Classes, and their parameters
     72 * @brief finds the Iterator to the ParameterDescription paramName matching classID
     73 * @param classID the ClassID to match.
     74 * @param paramName the name of the parameter in the Class.
     75 * @returns the iterator on match.
     76 *
     77 * @note this function creates the Element classID.name()::paramName on the go if it does not exist.
     78 */
     79LoadParamClassDescription::ParamDescriptionMap::iterator
     80LoadParamClassDescription::getParamDescription(const ClassID& classID, const std::string& paramName)
     81{
     82  /// Locate the ClassDescription first
     83  ClassDescriptionMap::iterator classIt = LoadParamClassDescription::_classList.find(classID);
     84  if (classIt == LoadParamClassDescription::_classList.end())
     85  {
     86    LoadParamClassDescription::_classList[classID] = LoadParamClassDescription(classID.name());
     87    classIt = LoadParamClassDescription::_classList.find(classID);
     88    printf("Inserted %s\n", classID.name().c_str());
     89    printAll("");
     90  }
     91  // At this position the class-iterator should point to a valid usefull position.
     92  assert(classIt != LoadParamClassDescription::_classList.end());
     93
     94  /// Now locate the description with paramName.
     95  ParamDescriptionMap::iterator paramIt = (*classIt).second._parameters.find(paramName);
     96  if (paramIt == (*classIt).second._parameters.end())
     97  {
     98    (*classIt).second._parameters[paramName] = LoadParamDescription(paramName);
     99    paramIt = (*classIt).second._parameters.find(paramName);
     100  }
     101  // at this position the param-iterator should
     102  assert (paramIt != (*classIt).second._parameters.end());
     103
     104  return (paramIt);
     105}
     106
     107
     108
     109
     110/**
     111 * @brief prints out all loadable Classes, and their parameters
    52112 * @param fileName prints the output to a File
    53113 * @todo implement it
     
    55115void LoadParamClassDescription::printAll(const std::string& fileName)
    56116{
    57   PRINT(3)("===============================================================\n");
    58   PRINT(3)(" Listing all the Loadable Options (loaded since Game started).\n\n");
    59   for (ClassDescriptionSet::const_iterator classIt = LoadParamClassDescription::_classList.begin();
    60        classIt != LoadParamClassDescription::_classList.begin();
     117  PRINT(0)("===============================================================\n");
     118  PRINT(0)(" Listing all the Loadable Options (loaded since Game started).\n\n");
     119  for (ClassDescriptionMap::const_iterator classIt = LoadParamClassDescription::_classList.begin();
     120       classIt != LoadParamClassDescription::_classList.end();
    61121       classIt ++)
    62122  {
    63     PRINT(3)("<%s>\n", (*classIt)._className.c_str());
    64     for (ParamDescriptionSet::const_iterator param = (*classIt)._parameters.begin();
    65          param != (*classIt)._parameters.end();
     123    PRINT(0)("<%s>\n", (*classIt).second._className.c_str());
     124    for (ParamDescriptionMap::const_iterator param = (*classIt).second._parameters.begin();
     125         param != (*classIt).second._parameters.end();
    66126         ++param)
    67127    {
    68       (*param).print();
     128    ///  (*param).second.print();
    69129    }
    70     PRINT(3)("</%s>\n\n", (*classIt)._className.c_str());
     130    PRINT(0)("</%s>\n\n", (*classIt).second._className.c_str());
    71131  }
    72   PRINT(3)("===============================================================\n");
     132  PRINT(0)("===============================================================\n");
    73133}
Note: See TracChangeset for help on using the changeset viewer.