diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 20:34:22 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 20:34:22 +0000 |
commit | b09bffed6b43262948018dfb0f11890850ddf7c1 (patch) | |
tree | 138696bfcc7ac01070d0e8ecaa1cdf94611a2bd8 /lilo-config/common | |
parent | 6d43944a7130b9d1b4ae3fba37b774aced8612cf (diff) | |
download | tdeadmin-b09bffed6b43262948018dfb0f11890850ddf7c1.tar.gz tdeadmin-b09bffed6b43262948018dfb0f11890850ddf7c1.zip |
TQt4 port kdeadmin
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1237416 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 | 10 | ||||
-rw-r--r-- | lilo-config/common/lilo.cc | 56 | ||||
-rw-r--r-- | lilo-config/common/lilo.h | 4 | ||||
-rw-r--r-- | lilo-config/common/tests/String.cc | 16 |
5 files changed, 47 insertions, 47 deletions
diff --git a/lilo-config/common/String.cc b/lilo-config/common/String.cc index f8a0e35..6fda1fa 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::contains(String const &s, bool cs) const +bool String::tqcontains(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::replace(String const &what, String const &with, bool all) const +String &String::tqreplace(String const &what, String const &with, bool all) const { String *result; - if(!contains(what)) { + if(!tqcontains(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::contains(String const &s) const +bool StringList::tqcontains(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 354c427..5eaa77a 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 contains(String const &s, bool cs=true) const; + bool tqcontains(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,11 +63,11 @@ 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 &replace(String const &what, String const &with, bool all=true) const; + String &tqreplace(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 QString - char const *latin1() const { return cstr(); } // For compatibility with QString + int length() const { return size(); } // For compatibility with TQString + char const *latin1() const { return cstr(); } // For compatibility with TQString }; class StringList:public strlist { @@ -82,7 +82,7 @@ public: void operator +=(StringList const &s); void operator +=(StringList const * const s); operator String() const; - bool contains(String const &s) const; + bool tqcontains(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 6625f0d..6ce15dc 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).contains("image")) + if((*it).tqcontains("image")) return true; else return false; } -liloimage *liloimages::find(String const &s) const +liloimage *liloimages::tqfind(String const &s) const { String t = String::escapeForRegExp(s); @@ -61,7 +61,7 @@ liloimage *liloimages::find(String const &s) const } void liloimages::remove(String const &s) { - liloimage *i=find(s); + liloimage *i=tqfind(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.contains("/dev/hda")) { + if(drives.tqcontains("/dev/hda")) { defaults += "boot=/dev/hda"; // 1st IDE/ATAPI harddisk defaults += "lba32"; // otherwise it is assumed } - else if(drives.contains("/dev/sda")) { + else if(drives.tqcontains("/dev/sda")) { defaults += "boot=/dev/sda"; // 1st SCSI harddisk defaults += "linear"; // some SCSI disks need this - } else if(drives.contains("/dev/i2o/hda")) + } else if(drives.tqcontains("/dev/i2o/hda")) defaults += "boot=/dev/i2o/hda"; // 1st I2O harddisk - else if(drives.contains("/dev/eda")) + else if(drives.tqcontains("/dev/eda")) defaults += "boot=/dev/eda"; // 1st MCA ESDI harddisk - else if(drives.contains("/dev/pda")) + else if(drives.tqcontains("/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).contains("System.map") || (*it).contains("initrd")) // definitely not a kernel + if((*it).tqcontains("System.map") || (*it).tqcontains("initrd")) // definitely not a kernel continue; - if((*it).contains("vmlinux")) { + if((*it).tqcontains("vmlinux")) { // If the kernel exists both in compressed and in // uncompressed form, ignore the uncompressed one. - String compr=(*it).replace("vmlinux", "vmlinuz"); + String compr=(*it).tqreplace("vmlinux", "vmlinuz"); if(!access(compr, F_OK)) continue; } @@ -243,27 +243,27 @@ bool liloconf::probe() if (label.empty()) { label = (*it); - if (label.find('/') != string::npos) + if (label.tqfind('/') != 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).contains("vmlinuz")) { - initrd1=(*it).replace("vmlinux", "initrd")+".img"; - initrd2=(*it).replace("vmlinuz", "initrd.img"); + if((*it).tqcontains("vmlinuz")) { + 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("vmlinux")) { + initrd1=(*it).tqreplace("vmlinux", "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("kernel")) { + initrd1=(*it).tqreplace("kernel", "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 if((*it).tqcontains("linux")) { + initrd1=(*it).tqreplace("linux", "initrd")+".img"; + initrd2=(*it).tqreplace("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.contains("enterprise")) - label=label.replace("enterprise", "E"); + if(label.tqcontains("enterprise")) + label=label.tqreplace("enterprise", "E"); if(label.size()>15) label=label.left(15); @@ -399,8 +399,8 @@ bool liloconf::probe() case 0x40: // Venix 80286 addOther("Venix", *it); break; - case 0x4d: // QNX - addOther("QNX", *it); + case 0x4d: // TQNX + addOther("TQNX", *it); break; case 0x52: // CP/M (does anyone dual-boot between CP/M and // Linux? Would be interesting to see. ;) ) diff --git a/lilo-config/common/lilo.h b/lilo-config/common/lilo.h index c992df0..22d6517 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 *find(String const &s) const; - liloimage *operator[](String const &s) const { return find(s); } + liloimage *tqfind(String const &s) const; + liloimage *operator[](String const &s) const { return tqfind(s); } }; class liloconf { diff --git a/lilo-config/common/tests/String.cc b/lilo-config/common/tests/String.cc index 7b0b60e..cfd9744 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.contains("Red Hat")) { - cerr << "contains() seems to be broken." << endl; + if(!s.tqcontains("Red Hat")) { + cerr << "tqcontains() seems to be broken." << endl; bugs++; } - if(t.replace("Microsoft", "Windows", false) != "Windows sucks! Destroy Microsoft! Microsoft must die!") { - cerr << "replace() [once] seems to be broken." << endl; + if(t.tqreplace("Microsoft", "Windows", false) != "Windows sucks! Destroy Microsoft! Microsoft must die!") { + cerr << "tqreplace() [once] seems to be broken." << endl; bugs++; } - if(t.replace("Microsoft", "Windows") != "Windows sucks! Destroy Windows! Windows must die!") { - cerr << "replace() [all] seems to be broken." << endl; + if(t.tqreplace("Microsoft", "Windows") != "Windows sucks! Destroy Windows! Windows must die!") { + cerr << "tqreplace() [all] seems to be broken." << endl; bugs++; } - if(u.replace("Microsoft", "Windows") != "Windows sucks!") { - cerr << "replace() [all, test case 2] seems to be broken." << endl; + if(u.tqreplace("Microsoft", "Windows") != "Windows sucks!") { + cerr << "tqreplace() [all, test case 2] seems to be broken." << endl; bugs++; } |