[Compbench-devel] CompBenchmarks++/System System-Cygwin.cpp, 1.2, 1.3
Brought to you by:
xfred
|
From: Frederic T. <xf...@us...> - 2006-11-01 10:31:21
|
Update of /cvsroot/compbench/CompBenchmarks++/System In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18559 Modified Files: System-Cygwin.cpp Log Message: Split() moved into CBMSystem. Chomp() used. Index: System-Cygwin.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/System/System-Cygwin.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** System-Cygwin.cpp 26 Sep 2006 16:03:14 -0000 1.2 --- System-Cygwin.cpp 1 Nov 2006 10:31:17 -0000 1.3 *************** *** 19,62 **** } - std::string CBMSystemCygwin::Split(const std::string& str, const std::string& delim, int wantedIndex) - { - unsigned int offset = 0; - unsigned int delimIndex = 0; - unsigned int nowIndex = 0; - - delimIndex = str.find(delim, offset); - - while (delimIndex != std::string::npos) - { - if (wantedIndex==nowIndex) - return(str.substr(offset, delimIndex - offset)); - offset += delimIndex - offset + delim.length(); - delimIndex = str.find(delim, offset); - nowIndex++; - } - if (wantedIndex==nowIndex) - return(str.substr(offset)); - else - return(""); - } - std::string CBMSystemCygwin::processor_name(void) { ! return(Split(cache, "\n", 2)); } std::string CBMSystemCygwin::processor_mhz(void) { ! return(Split(cache, "\n", 0)); } std::string CBMSystemCygwin::processor_cache(void) { ! return(Split(cache, "\n", 1)); } std::string CBMSystemCygwin::processor_number(void) { ! return(Split(cache, "\n", 3)); } --- 19,52 ---- } std::string CBMSystemCygwin::processor_name(void) { ! std::string r = Split(cache, "\n", 2); ! ! Chomp(r); ! return(r); } std::string CBMSystemCygwin::processor_mhz(void) { ! std::string r = Split(cache, "\n", 0); ! ! Chomp(r); ! return(r); } std::string CBMSystemCygwin::processor_cache(void) { ! std::string r = Split(cache, "\n", 1); ! ! Chomp(r); ! return(r); } std::string CBMSystemCygwin::processor_number(void) { ! std::string r = Split(cache, "\n", 3); ! ! Chomp(r); ! return(r); } |