Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5031 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Aug 15, 2005, 9:39:51 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: made the IniParser more standAlone
also fixed all remaing SubProjects, so they compile again

Location:
orxonox/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/defs/stdlibincl.h

    r4381 r5031  
    11/*!
    2   \file stdlibincl.h
    3   \brief some headers of the stdlib
    4   
    5   no Class is defined here.
    6 */
     2 * @file stdlibincl.h
     3 * some headers of the stdlib
     4 *
     5 * no Class is defined here.
     6 */
    77
    88#ifndef _STDLIBINCL_H
  • orxonox/trunk/src/lib/util/ini_parser.cc

    r5022 r5031  
    2222
    2323#include "list.h"
    24 #include "stdlibincl.h"
     24#include <stdlib.h>
     25#include <string.h>
    2526#include "debug.h"
    2627
     
    3334IniParser::IniParser (const char* fileName)
    3435{
    35   this->setClassID(CL_INI_PARSER, "IniParser");
    36 
    3736  this->currentEntry = NULL;
    3837  this->currentSection = NULL;
    3938  this->sections = NULL;
     39  this->fileName = NULL;
    4040  if (fileName != NULL)
    4141    this->readFile(fileName);
     
    8383  this->currentSection = NULL;
    8484  this->sections = NULL;
    85   this->setName(NULL);
     85  this->setFileName(NULL);
    8686}
    8787
     
    9898  if( fileName == NULL)
    9999    return false;
    100   this->setName(fileName);
     100  this->setFileName(fileName);
    101101
    102102  if( (stream = fopen (fileName, "r")) == NULL)
     
    234234  this->currentSection = newSection;
    235235  this->sections->add(newSection);
    236   PRINTF(0)("Added Section %s\n", sectionName);
     236  PRINTF(5)("Added Section %s\n", sectionName);
    237237  return true;
    238238}
     
    375375    strcpy(newEntry->value, value);
    376376    this->currentSection->entries->add(newEntry);
     377    PRINTF(5)("Added Entry %s with Value '%s' to Section %s\n", newEntry->name, newEntry->name, addSection->name);
    377378    return true;
    378379  }
     
    421422  }
    422423  else
    423     PRINTF(1)("%s not opened\n", this->getName());
     424    PRINTF(1)("%s not opened\n", fileName);
    424425
    425426  return defaultValue;
     
    427428}
    428429
     430
     431void IniParser::setFileName(const char* fileName)
     432{
     433  if (this->fileName)
     434    delete []this->fileName;
     435  if (fileName)
     436  {
     437    this->fileName = new char[strlen(fileName)+1];
     438    strcpy(this->fileName, fileName);
     439  }
     440  else
     441    this->fileName = NULL;
     442}
     443
     444
    429445/**
    430446 * output the whole tree in a nice and easy way.
     
    432448void IniParser::debug() const
    433449{
    434   PRINTF(0)("Iniparser %s - debug\n", this->getName());
     450  PRINTF(0)("Iniparser %s - debug\n", this->fileName);
    435451  if (this->sections)
    436452  {
     
    456472  }
    457473  else
    458     PRINTF(1)("%s not opened\n", this->getName());
    459 }
     474    PRINTF(1)("%s not opened\n", fileName);
     475}
  • orxonox/trunk/src/lib/util/ini_parser.h

    r5020 r5031  
    1010
    1111#define PARSELINELENGHT     512       //!< how many chars to read at once
    12 
    13 #include "base_object.h"
     12#ifndef NULL
     13#define NULL 0x0                      //!< NULL
     14#endif
    1415
    1516// FORWARD DEFINITION //
     
    2021 * This class can be used to load an initializer file and parse it's contents for variablename=value pairs.
    2122 */
    22 class IniParser : public BaseObject
     23class IniParser
    2324{
    2425  private:
     
    5354    /** @returns true if the file is opened, false otherwise*/
    5455    bool isOpen() const { return (sections != NULL)?true:false; };
     56    /** @returns the fileName we have opened. */
     57    const char* getFileName() const { return this->fileName; };
    5558
    5659    bool addVar(const char* entryName, const char* value, const char* sectionName = NULL);
     
    7174  private:
    7275    void deleteSections();
     76    void setFileName(const char* fileName);
    7377
    7478  private:
     79    char*                 fileName;        //!< The name of the File that was parsed.
    7580    tList<IniSection>*    sections;        //!< a list of all stored Sections of the Parser
    7681    IniSection*           currentSection;  //!< the current selected Section
  • orxonox/trunk/src/subprojects/importer/Makefile.am

    r4908 r5031  
    3131                  $(MAINSRCDIR)/util/loading/load_param.cc \
    3232                  $(MAINSRCDIR)/lib/util/substring.cc \
     33                  $(MAINSRCDIR)/lib/util/color.cc \
    3334                  $(MAINSRCDIR)/util/loading/factory.cc
  • orxonox/trunk/src/subprojects/importer/Makefile.in

    r4908 r5031  
    6161        importer-p_node.$(OBJEXT) importer-null_parent.$(OBJEXT) \
    6262        importer-load_param.$(OBJEXT) importer-substring.$(OBJEXT) \
    63         importer-factory.$(OBJEXT)
     63        importer-color.$(OBJEXT) importer-factory.$(OBJEXT)
    6464importer_OBJECTS = $(am_importer_OBJECTS)
    6565importer_DEPENDENCIES = $(MAINSRCDIR)/lib/event/libORXevent.a \
     
    7373@AMDEP_TRUE@    ./$(DEPDIR)/importer-camera.Po \
    7474@AMDEP_TRUE@    ./$(DEPDIR)/importer-class_list.Po \
     75@AMDEP_TRUE@    ./$(DEPDIR)/importer-color.Po \
    7576@AMDEP_TRUE@    ./$(DEPDIR)/importer-element_2d.Po \
    7677@AMDEP_TRUE@    ./$(DEPDIR)/importer-factory.Po \
     
    233234                  $(MAINSRCDIR)/util/loading/load_param.cc \
    234235                  $(MAINSRCDIR)/lib/util/substring.cc \
     236                  $(MAINSRCDIR)/lib/util/color.cc \
    235237                  $(MAINSRCDIR)/util/loading/factory.cc
    236238
     
    304306@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importer-camera.Po@am__quote@
    305307@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importer-class_list.Po@am__quote@
     308@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importer-color.Po@am__quote@
    306309@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importer-element_2d.Po@am__quote@
    307310@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importer-factory.Po@am__quote@
     
    624627@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    625628@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(importer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o importer-substring.obj `if test -f '$(MAINSRCDIR)/lib/util/substring.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/substring.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/substring.cc'; fi`
     629
     630importer-color.o: $(MAINSRCDIR)/lib/util/color.cc
     631@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(importer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT importer-color.o -MD -MP -MF "$(DEPDIR)/importer-color.Tpo" -c -o importer-color.o `test -f '$(MAINSRCDIR)/lib/util/color.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/color.cc; \
     632@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/importer-color.Tpo" "$(DEPDIR)/importer-color.Po"; else rm -f "$(DEPDIR)/importer-color.Tpo"; exit 1; fi
     633@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/color.cc' object='importer-color.o' libtool=no @AMDEPBACKSLASH@
     634@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/importer-color.Po' tmpdepfile='$(DEPDIR)/importer-color.TPo' @AMDEPBACKSLASH@
     635@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     636@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(importer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o importer-color.o `test -f '$(MAINSRCDIR)/lib/util/color.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/color.cc
     637
     638importer-color.obj: $(MAINSRCDIR)/lib/util/color.cc
     639@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(importer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT importer-color.obj -MD -MP -MF "$(DEPDIR)/importer-color.Tpo" -c -o importer-color.obj `if test -f '$(MAINSRCDIR)/lib/util/color.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/color.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/color.cc'; fi`; \
     640@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/importer-color.Tpo" "$(DEPDIR)/importer-color.Po"; else rm -f "$(DEPDIR)/importer-color.Tpo"; exit 1; fi
     641@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/color.cc' object='importer-color.obj' libtool=no @AMDEPBACKSLASH@
     642@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/importer-color.Po' tmpdepfile='$(DEPDIR)/importer-color.TPo' @AMDEPBACKSLASH@
     643@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     644@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(importer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o importer-color.obj `if test -f '$(MAINSRCDIR)/lib/util/color.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/color.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/color.cc'; fi`
    626645
    627646importer-factory.o: $(MAINSRCDIR)/util/loading/factory.cc
  • orxonox/trunk/src/subprojects/particles/Makefile.am

    r4908 r5031  
    3737                   $(MAINSRCDIR)/util/loading/load_param.cc \
    3838                   $(MAINSRCDIR)/util/loading/factory.cc \
     39                   $(MAINSRCDIR)/lib/util/color.cc \
    3940                   $(MAINSRCDIR)/lib/util/ini_parser.cc
    4041
  • orxonox/trunk/src/subprojects/particles/Makefile.in

    r4908 r5031  
    6363        particles-null_parent.$(OBJEXT) particles-gui_gtk.$(OBJEXT) \
    6464        particles-substring.$(OBJEXT) particles-load_param.$(OBJEXT) \
    65         particles-factory.$(OBJEXT) particles-ini_parser.$(OBJEXT)
     65        particles-factory.$(OBJEXT) particles-color.$(OBJEXT) \
     66        particles-ini_parser.$(OBJEXT)
    6667particles_OBJECTS = $(am_particles_OBJECTS)
    6768am__DEPENDENCIES_1 =
     
    8081@AMDEP_TRUE@    ./$(DEPDIR)/particles-camera.Po \
    8182@AMDEP_TRUE@    ./$(DEPDIR)/particles-class_list.Po \
     83@AMDEP_TRUE@    ./$(DEPDIR)/particles-color.Po \
    8284@AMDEP_TRUE@    ./$(DEPDIR)/particles-element_2d.Po \
    8385@AMDEP_TRUE@    ./$(DEPDIR)/particles-factory.Po \
     
    249251                   $(MAINSRCDIR)/util/loading/load_param.cc \
    250252                   $(MAINSRCDIR)/util/loading/factory.cc \
     253                   $(MAINSRCDIR)/lib/util/color.cc \
    251254                   $(MAINSRCDIR)/lib/util/ini_parser.cc
    252255
     
    320323@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-camera.Po@am__quote@
    321324@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-class_list.Po@am__quote@
     325@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-color.Po@am__quote@
    322326@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-element_2d.Po@am__quote@
    323327@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/particles-factory.Po@am__quote@
     
    674678@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    675679@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o particles-factory.obj `if test -f '$(MAINSRCDIR)/util/loading/factory.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/util/loading/factory.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/util/loading/factory.cc'; fi`
     680
     681particles-color.o: $(MAINSRCDIR)/lib/util/color.cc
     682@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT particles-color.o -MD -MP -MF "$(DEPDIR)/particles-color.Tpo" -c -o particles-color.o `test -f '$(MAINSRCDIR)/lib/util/color.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/color.cc; \
     683@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/particles-color.Tpo" "$(DEPDIR)/particles-color.Po"; else rm -f "$(DEPDIR)/particles-color.Tpo"; exit 1; fi
     684@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/color.cc' object='particles-color.o' libtool=no @AMDEPBACKSLASH@
     685@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/particles-color.Po' tmpdepfile='$(DEPDIR)/particles-color.TPo' @AMDEPBACKSLASH@
     686@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     687@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o particles-color.o `test -f '$(MAINSRCDIR)/lib/util/color.cc' || echo '$(srcdir)/'`$(MAINSRCDIR)/lib/util/color.cc
     688
     689particles-color.obj: $(MAINSRCDIR)/lib/util/color.cc
     690@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT particles-color.obj -MD -MP -MF "$(DEPDIR)/particles-color.Tpo" -c -o particles-color.obj `if test -f '$(MAINSRCDIR)/lib/util/color.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/color.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/color.cc'; fi`; \
     691@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/particles-color.Tpo" "$(DEPDIR)/particles-color.Po"; else rm -f "$(DEPDIR)/particles-color.Tpo"; exit 1; fi
     692@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='$(MAINSRCDIR)/lib/util/color.cc' object='particles-color.obj' libtool=no @AMDEPBACKSLASH@
     693@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/particles-color.Po' tmpdepfile='$(DEPDIR)/particles-color.TPo' @AMDEPBACKSLASH@
     694@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     695@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(particles_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o particles-color.obj `if test -f '$(MAINSRCDIR)/lib/util/color.cc'; then $(CYGPATH_W) '$(MAINSRCDIR)/lib/util/color.cc'; else $(CYGPATH_W) '$(srcdir)/$(MAINSRCDIR)/lib/util/color.cc'; fi`
    676696
    677697particles-ini_parser.o: $(MAINSRCDIR)/lib/util/ini_parser.cc
Note: See TracChangeset for help on using the changeset viewer.