Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7234 in orxonox.OLD


Ignore:
Timestamp:
Mar 21, 2006, 3:36:22 PM (18 years ago)
Author:
bensch
Message:

orxonox/branches/preferences: merged the old preferences here… some minor conflicts, hope it works

Location:
branches/preferences
Files:
5 edited
8 copied

Legend:

Unmodified
Added
Removed
  • branches/preferences/AUTHORS

    r4604 r7234  
    11orxonox-crew: <orxonox-dev@mail.datacore.ch>
    22
     3Maintainers:
    34Patrick Boenzli <patrick@orxonox.ethz.ch>
    45Benjamin Grauer <bensch@orxonox.ethz.ch>
     6
     7Developers:
     8Christian Meyer
     9David Gruetter
     10
     11Coders:
    512Simon Hofmann
    6 David Gruetter
    713Johannes Bader
    814Adrian Buerli
    9 Christian Meyer
     15
     16
  • branches/preferences/src/defs/class_id.h

    r7193 r7234  
    9696  CL_MASK_LOWLEVEL_CLASS        =    0x00000fff,
    9797
     98  CL_PREFERENCES                =    0X00000f51,
    9899
    99100  /// SINGLETON classes (range from 0x00000000 to 0x000000ff)
  • branches/preferences/src/lib/parser/Makefile.am

    r5944 r7234  
    11SUBDIRS = \
    22          tinyxml \
    3           ini_parser
     3                                ini_parser \
     4                                preferences
    45
    56
  • branches/preferences/src/lib/parser/ini_parser/ini_parser.cc

    r7221 r7234  
    392392}
    393393
     394/**
     395 * @brief edits the entry speciefied by entryName in sectionName/currentSection or creates it if it doesn't exist
     396 * @param entryName the Name of the Entry to add
     397 * @param value the value to assign to this entry
     398 * @param sectionName if NULL then this entry will be set to the currentSection
     399 * otherwise to the section refered to by sectionName.
     400 * If both are NULL no entry will be added
     401 * @return true if everything is ok false on error
     402 */
     403bool IniParser::editVar(const char* entryName, const char* value, const char* sectionName)
     404{
     405  std::list<IniSection>::iterator section;
     406
     407  if (sectionName != NULL)
     408  {
     409    for (section = this->sections.begin(); section != this->sections.end(); section++)
     410      if (!strcmp((*section).name, sectionName))
     411        break;
     412  }
     413  else
     414    section = this->currentSection;
     415
     416  if (section == this->sections.end())
     417  {
     418    IniSection sec;
     419    sec.comment = NULL;
     420    sec.name = new char[strlen(sectionName)+1];
     421    strcpy(sec.name, sectionName);
     422    section = this->sections.insert(this->sections.end(), sec);
     423  }
     424
     425  if (section == this->sections.end())
     426  {
     427    PRINTF(2)("section '%s' not found for value '%s'\n", sectionName, entryName);
     428    return false;
     429  }
     430  else
     431  {
     432    //try find item
     433    std::list<IniEntry>::iterator entry;
     434    for (entry = section->entries.begin(); entry!=section->entries.end(); entry++)
     435      if (!strcmp( entry->name, entryName ))
     436        break;
     437
     438    //found it?
     439    if ( entry != section->entries.end() )
     440    {
     441      if ( entry->value != NULL )
     442      {
     443        delete[] entry->value;
     444      }
     445      entry->value = new char[strlen(value)+1];
     446      strcpy(entry->value, value);
     447
     448      return true;
     449    }
     450
     451    //not found -> create it
     452    (*section).entries.push_back(IniEntry());
     453    (*section).entries.back().comment = NULL;
     454    (*section).entries.back().name = new char[strlen(entryName)+1];
     455    strcpy((*section).entries.back().name, entryName);
     456    (*section).entries.back().value = new char[strlen(value)+1];
     457    strcpy((*section).entries.back().value, value);
     458    PRINTF(5)("Added Entry %s with Value '%s' to Section %s\n",
     459    (*section).entries.back().name,
     460    (*section).entries.back().value,
     461    (*section).name);
     462    this->currentEntry = --(*section).entries.end();
     463    return true;
     464  }
     465}
     466
    394467
    395468/**
  • branches/preferences/src/orxonox.cc

    r7221 r7234  
    5858
    5959#include "state.h"
    60 
     60#include "lib/parser/preferences/cmd_line_prefs_reader.h"
    6161#include <string.h>
    6262
     
    403403int main(int argc, char** argv)
    404404{
    405   int i;
     405  CmdLinePrefsReader prefs(argc, argv);
     406
     407  /*int i;
    406408  for(i = 1; i < argc; ++i)
    407409  {
     
    416418    else if(!strcmp( "--license", argv[i])  || !strcmp("-l", argv[i]))
    417419      return PRINT(0)(ORXONOX_LICENSE_SHORT);
    418   }
    419 
    420   return startOrxonox(argc, argv, NULL, -1);
     420}
     421
     422  return startOrxonox(argc, argv, NULL, -1);*/
     423  return 0;
    421424}
    422425
Note: See TracChangeset for help on using the changeset viewer.