diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 4a25ca5c80d9b88fdc1a0d44d1db47da47206899 (patch) | |
tree | 8a1d1e893a80df8ad5233802c2b0e39220b86168 /lilo-config/common | |
parent | 441266d591a9064dd619da0e1bd49b871d6a9c70 (diff) | |
download | tdeadmin-4a25ca5c80d9b88fdc1a0d44d1db47da47206899.tar.gz tdeadmin-4a25ca5c80d9b88fdc1a0d44d1db47da47206899.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lilo-config/common')
-rw-r--r-- | lilo-config/common/String.cc | 8 | ||||
-rw-r--r-- | lilo-config/common/String.h | 6 | ||||
-rw-r--r-- | lilo-config/common/lilo.cc | 52 | ||||
-rw-r--r-- | lilo-config/common/lilo.h | 4 | ||||
-rw-r--r-- | lilo-config/common/tests/String.cc | 16 |
5 files changed, 43 insertions, 43 deletions
diff --git a/lilo-config/common/String.cc b/lilo-config/common/String.cc index 6fda1fa..f8a0e35 100644 --- a/lilo-config/common/String.cc +++ b/lilo-config/common/String.cc @@ -98,7 +98,7 @@ bool String::casecmp(char const * const s) const return false; return (strncasecmp(data(), s, size())==0); } -bool String::tqcontains(String const &s, bool cs) const +bool String::contains(String const &s, bool cs) const { if(cs) if(strstr(cstr(), s.cstr())) @@ -226,10 +226,10 @@ String &String::regex(String const &expr, bool cs) const } return *ret; } -String &String::tqreplace(String const &what, String const &with, bool all) const +String &String::replace(String const &what, String const &with, bool all) const { String *result; - if(!tqcontains(what)) { + if(!contains(what)) { result=new String(*this); return *result; } @@ -331,7 +331,7 @@ void StringList::operator +=(StringList const * const s) for(const_iterator it=s->begin(); it!=s->end(); it++) insert(end(), *it); } -bool StringList::tqcontains(String const &s) const +bool StringList::contains(String const &s) const { for(const_iterator it=begin(); it!=end(); it++) if(*it == s) diff --git a/lilo-config/common/String.h b/lilo-config/common/String.h index 5eaa77a..77caa61 100644 --- a/lilo-config/common/String.h +++ b/lilo-config/common/String.h @@ -54,7 +54,7 @@ public: char * cstr() const; bool cmp(char const * const s) const; bool casecmp(char const * const s) const; - bool tqcontains(String const &s, bool cs=true) const; + bool contains(String const &s, bool cs=true) const; int locate(String const &s, bool cs=true, unsigned int startat=0) const; void sprintf(const char *format, ...); bool readfile(String filename); @@ -63,7 +63,7 @@ public: String right(unsigned int num=1) const; String mid(unsigned int start, unsigned int num=0) const; String ®ex(String const &expr, bool cs=true) const; - String &tqreplace(String const &what, String const &with, bool all=true) const; + String &replace(String const &what, String const &with, bool all=true) const; static String escapeForRegExp(String const &s); char chr(unsigned int index) const { if(index>=size()) return 0; else return data()[index]; } int length() const { return size(); } // For compatibility with TQString @@ -82,7 +82,7 @@ public: void operator +=(StringList const &s); void operator +=(StringList const * const s); operator String() const; - bool tqcontains(String const &s) const; + bool contains(String const &s) const; void remove(String const &s); void add(String const &s) { insert(end(), s); } String const &grep(String const &s) const; diff --git a/lilo-config/common/lilo.cc b/lilo-config/common/lilo.cc index 6ce15dc..c61429a 100644 --- a/lilo-config/common/lilo.cc +++ b/lilo-config/common/lilo.cc @@ -42,13 +42,13 @@ using namespace std; bool liloimage::isLinux() const { const_iterator it=begin(); - if((*it).tqcontains("image")) + if((*it).contains("image")) return true; else return false; } -liloimage *liloimages::tqfind(String const &s) const +liloimage *liloimages::find(String const &s) const { String t = String::escapeForRegExp(s); @@ -61,7 +61,7 @@ liloimage *liloimages::tqfind(String const &s) const } void liloimages::remove(String const &s) { - liloimage *i=tqfind(s); + liloimage *i=find(s); for(iterator it=begin(); it!=end(); it++) if(*it==*i) { erase(it); @@ -186,18 +186,18 @@ bool liloconf::probe() images.clear(); /* Set some reasonable defaults... */ // Try to figure out the boot device first... - if(drives.tqcontains("/dev/hda")) { + if(drives.contains("/dev/hda")) { defaults += "boot=/dev/hda"; // 1st IDE/ATAPI harddisk defaults += "lba32"; // otherwise it is assumed } - else if(drives.tqcontains("/dev/sda")) { + else if(drives.contains("/dev/sda")) { defaults += "boot=/dev/sda"; // 1st SCSI harddisk defaults += "linear"; // some SCSI disks need this - } else if(drives.tqcontains("/dev/i2o/hda")) + } else if(drives.contains("/dev/i2o/hda")) defaults += "boot=/dev/i2o/hda"; // 1st I2O harddisk - else if(drives.tqcontains("/dev/eda")) + else if(drives.contains("/dev/eda")) defaults += "boot=/dev/eda"; // 1st MCA ESDI harddisk - else if(drives.tqcontains("/dev/pda")) + else if(drives.contains("/dev/pda")) defaults += "boot=/dev/pda"; // 1st Parallel port IDE disk else defaults += "boot=Insert_your_boot_device_here"; // shouldn't happen @@ -226,12 +226,12 @@ bool liloconf::probe() continue; if(s.st_size<131072) // if you managed to compile a kernel at less than 128k, you're cheating. ;) continue; - if((*it).tqcontains("System.map") || (*it).tqcontains("initrd")) // definitely not a kernel + if((*it).contains("System.map") || (*it).contains("initrd")) // definitely not a kernel continue; - if((*it).tqcontains("vmlinux")) { + if((*it).contains("vmlinux")) { // If the kernel exists both in compressed and in // uncompressed form, ignore the uncompressed one. - String compr=(*it).tqreplace("vmlinux", "vmlinuz"); + String compr=(*it).replace("vmlinux", "vmlinuz"); if(!access(compr, F_OK)) continue; } @@ -243,27 +243,27 @@ bool liloconf::probe() if (label.empty()) { label = (*it); - if (label.tqfind('/') != string::npos) + if (label.find('/') != string::npos) label = label.right(label.length()-1-label.rfind('/')); } // Check if we have an initial ramdisk (initrd) for this kernel... String initrd1; // first guess String initrd2; // second guess - if((*it).tqcontains("vmlinuz")) { - initrd1=(*it).tqreplace("vmlinux", "initrd")+".img"; - initrd2=(*it).tqreplace("vmlinuz", "initrd.img"); + if((*it).contains("vmlinuz")) { + initrd1=(*it).replace("vmlinux", "initrd")+".img"; + initrd2=(*it).replace("vmlinuz", "initrd.img"); } - else if((*it).tqcontains("vmlinux")) { - initrd1=(*it).tqreplace("vmlinux", "initrd")+".img"; - initrd2=(*it).tqreplace("vmlinuz", "initrd.img"); + else if((*it).contains("vmlinux")) { + initrd1=(*it).replace("vmlinux", "initrd")+".img"; + initrd2=(*it).replace("vmlinuz", "initrd.img"); } - else if((*it).tqcontains("kernel")) { - initrd1=(*it).tqreplace("kernel", "initrd")+".img"; - initrd2=(*it).tqreplace("vmlinuz", "initrd.img"); + else if((*it).contains("kernel")) { + initrd1=(*it).replace("kernel", "initrd")+".img"; + initrd2=(*it).replace("vmlinuz", "initrd.img"); } - else if((*it).tqcontains("linux")) { - initrd1=(*it).tqreplace("linux", "initrd")+".img"; - initrd2=(*it).tqreplace("vmlinuz", "initrd.img"); + else if((*it).contains("linux")) { + initrd1=(*it).replace("linux", "initrd")+".img"; + initrd2=(*it).replace("vmlinuz", "initrd.img"); } else { initrd1="/boot/initrd-"+version+".img"; @@ -277,8 +277,8 @@ bool liloconf::probe() initrd = initrd2; if(label.size()>15) // LILO can't handle this - if(label.tqcontains("enterprise")) - label=label.tqreplace("enterprise", "E"); + if(label.contains("enterprise")) + label=label.replace("enterprise", "E"); if(label.size()>15) label=label.left(15); diff --git a/lilo-config/common/lilo.h b/lilo-config/common/lilo.h index 22d6517..c992df0 100644 --- a/lilo-config/common/lilo.h +++ b/lilo-config/common/lilo.h @@ -39,8 +39,8 @@ public: class liloimages:public std::list<liloimage> { public: void remove(String const &s); - liloimage *tqfind(String const &s) const; - liloimage *operator[](String const &s) const { return tqfind(s); } + liloimage *find(String const &s) const; + liloimage *operator[](String const &s) const { return find(s); } }; class liloconf { diff --git a/lilo-config/common/tests/String.cc b/lilo-config/common/tests/String.cc index cfd9744..7b0b60e 100644 --- a/lilo-config/common/tests/String.cc +++ b/lilo-config/common/tests/String.cc @@ -54,20 +54,20 @@ int main(int argc, char **argv) cerr << "regex() seems to be broken." << endl; bugs++; } - if(!s.tqcontains("Red Hat")) { - cerr << "tqcontains() seems to be broken." << endl; + if(!s.contains("Red Hat")) { + cerr << "contains() seems to be broken." << endl; bugs++; } - if(t.tqreplace("Microsoft", "Windows", false) != "Windows sucks! Destroy Microsoft! Microsoft must die!") { - cerr << "tqreplace() [once] seems to be broken." << endl; + if(t.replace("Microsoft", "Windows", false) != "Windows sucks! Destroy Microsoft! Microsoft must die!") { + cerr << "replace() [once] seems to be broken." << endl; bugs++; } - if(t.tqreplace("Microsoft", "Windows") != "Windows sucks! Destroy Windows! Windows must die!") { - cerr << "tqreplace() [all] seems to be broken." << endl; + if(t.replace("Microsoft", "Windows") != "Windows sucks! Destroy Windows! Windows must die!") { + cerr << "replace() [all] seems to be broken." << endl; bugs++; } - if(u.tqreplace("Microsoft", "Windows") != "Windows sucks!") { - cerr << "tqreplace() [all, test case 2] seems to be broken." << endl; + if(u.replace("Microsoft", "Windows") != "Windows sucks!") { + cerr << "replace() [all, test case 2] seems to be broken." << endl; bugs++; } |