Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 20, 2006, 9:49:13 AM (18 years ago)
Author:
bensch
Message:

calling static functions again out of the Shell

File:
1 edited

Legend:

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

    r9776 r9777  
    114114}
    115115
    116 
    117 
    118 
    119116/**
    120117 * @brief prints out all loadable Classes, and their parameters
    121118 * @param fileName prints the output to a File
    122  * @todo implement it
     119 * @param withComments if Comments should be included.
    123120 */
    124 void LoadParamClassDescription::printAll(const std::string& fileName)
     121void LoadParamClassDescription::printAll(const std::string& fileName, bool withComments)
    125122{
    126   PRINT(0)("===============================================================\n");
    127   PRINT(0)(" Listing all the Loadable Options (loaded since Game started).\n\n");
     123  printf("================== function called\n");
     124
     125  FILE* stream;
     126  if( (stream = fopen (fileName.c_str(), "w")) == NULL)
     127  {
     128    PRINTF(2)("File '%s' could not be opened for writing\n Printing to stdout\n", fileName.c_str());
     129    LoadParamClassDescription::printAllTo(stdout, withComments);
     130    return;
     131  }
     132  else
     133    LoadParamClassDescription::printAllTo(stream, withComments);
     134
     135  fclose (stream);
     136}
     137
     138/**
     139 * @brief prints out all loadable Classes, and their parameters to a stream
     140 * @param stream the stream to print to.
     141 * @param withComments if Comments should be included.
     142 */
     143void LoadParamClassDescription::printAllTo(FILE* stream, bool withComments)
     144{
     145  fprintf(stream, "===============================================================\n");
     146  fprintf(stream, " Listing all the Loadable Options (loaded since Game started).\n\n");
    128147  for (ClassDescriptionMap::const_iterator classIt = LoadParamClassDescription::_classList.begin();
    129148       classIt != LoadParamClassDescription::_classList.end();
    130149       classIt ++)
    131150  {
    132     PRINT(0)("<%s>\n", (*classIt).second._className.c_str());
     151    fprintf(stream, "<%s>\n", (*classIt).second._className.c_str());
    133152    for (ParamDescriptionMap::const_iterator param = (*classIt).second._parameters.begin();
    134153         param != (*classIt).second._parameters.end();
    135154         ++param)
    136155    {
    137       (*param).second.print();
     156      (*param).second.print(stream, withComments);
    138157    }
    139     PRINT(0)("</%s>\n\n", (*classIt).second._className.c_str());
     158    fprintf(stream, "</%s>\n\n", (*classIt).second._className.c_str());
    140159  }
    141   PRINT(0)("===============================================================\n");
     160  fprintf(stream, "===============================================================\n");
    142161}
Note: See TracChangeset for help on using the changeset viewer.