[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Compiler Compiler-OptionSet.cpp, 1.1, 1.2 Comp
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-30 17:02:00
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14232 Modified Files: Compiler-OptionSet.cpp Compiler-OptionSet.h Log Message: Identifier fixed; few changes on XML I/O. Index: Compiler-OptionSet.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-OptionSet.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Compiler-OptionSet.cpp 17 May 2007 14:29:47 -0000 1.1 --- Compiler-OptionSet.cpp 30 May 2007 17:01:35 -0000 1.2 *************** *** 27,34 **** } ! CBM::CompilerOptions *CompilerOptionSet::add(void) { CBM::CompilerOptions *result; ! result=new CBM::CompilerOptions(); options.push_back(result); --- 27,48 ---- } ! CBM::CompilerOptions *CompilerOptionSet::get(std::string _id) ! { ! int i; ! int n = optionNumber(); ! CBM::CompilerOptions *O = 0; ! ! for(i=0; i<n; i++) { ! O=options[i]; ! if (O->Id() == _id) ! return(O); ! } ! return(0); ! } ! ! CBM::CompilerOptions *CompilerOptionSet::add(std::string _id) { CBM::CompilerOptions *result; ! result=new CBM::CompilerOptions(_id); options.push_back(result); *************** *** 37,40 **** --- 51,61 ---- } + CBM::CompilerOptions *CompilerOptionSet::add(CBM::CompilerOptions *_options) + { + options.push_back(_options); + + return(_options); + } + int CompilerOptionSet::remove(CBM::CompilerOptions *_options) { *************** *** 43,46 **** --- 64,68 ---- CBM::CompilerOptions *O = 0; std::vector<CBM::CompilerOptions*> noptions; + int found = 0; for(i=0; i<n; i++) { *************** *** 48,57 **** if (O != _options) noptions.push_back(O); ! else ! delete(O); } ! options=noptions; ! return(1); } --- 70,90 ---- if (O != _options) noptions.push_back(O); ! else { ! found=1; ! // delete(O); ! } } ! if (found) ! options=noptions; ! return(found); ! } + int CompilerOptionSet::remove(std::string _id) + { + CBM::CompilerOptions *O = get(_id); + if (O) + return(remove(O)); + else + return(0); } *************** *** 89,93 **** if (N->Name() != "options") continue; ! O=add(); O->restore(N); } --- 122,126 ---- if (N->Name() != "options") continue; ! O=add(""); O->restore(N); } *************** *** 99,108 **** } ! std::string CompilerOptionSet::Options(int i) { if (i<optionNumber()) ! return(options[i]->Options()); else ! return(""); } --- 132,141 ---- } ! CBM::CompilerOptions *CompilerOptionSet::Options(int i) { if (i<optionNumber()) ! return(options[i]); else ! return(0); } Index: Compiler-OptionSet.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-OptionSet.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Compiler-OptionSet.h 17 May 2007 14:29:47 -0000 1.1 --- Compiler-OptionSet.h 30 May 2007 17:01:35 -0000 1.2 *************** *** 45,51 **** virtual void setId(std::string _id); ! virtual CBM_CO *add(void); virtual int remove(CBM_CO *_options); virtual XMLNode *XML(void); --- 45,56 ---- virtual void setId(std::string _id); ! virtual CBM_CO *get(std::string _id); ! ! virtual CBM_CO *add(std::string _id); ! virtual CBM_CO *add(CBM_CO *_options); virtual int remove(CBM_CO *_options); + virtual int remove(std::string _id); + virtual XMLNode *XML(void); *************** *** 53,57 **** virtual int optionNumber(void); ! virtual std::string Options(int i); virtual ~CompilerOptionSet(); --- 58,62 ---- virtual int optionNumber(void); ! virtual CBM_CO *Options(int i); virtual ~CompilerOptionSet(); |