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 | 0254ebaa5e056092461fd585b6851d15faa43035 (patch) | |
tree | 2bf41a1c189b92dc1b9ab89e3ce392f8132214c4 /src/isbnvalidator.cpp | |
parent | fa071926f015f39711632b3fb9fe16004d93d0ec (diff) | |
download | tellico-0254ebaa5e056092461fd585b6851d15faa43035.tar.gz tellico-0254ebaa5e056092461fd585b6851d15faa43035.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/isbnvalidator.cpp')
-rw-r--r-- | src/isbnvalidator.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/isbnvalidator.cpp b/src/isbnvalidator.cpp index a3a9034..6f33c67 100644 --- a/src/isbnvalidator.cpp +++ b/src/isbnvalidator.cpp @@ -73,7 +73,7 @@ void ISBNValidator::fixup(TQString& input_) const { void ISBNValidator::staticFixup(TQString& input_) { if((input_.startsWith(TQString::tqfromLatin1("978")) || input_.startsWith(TQString::tqfromLatin1("979"))) - && input_.tqcontains(TQRegExp(TQString::tqfromLatin1("\\d"))) > 10) { + && input_.contains(TQRegExp(TQString::tqfromLatin1("\\d"))) > 10) { return fixup13(input_); } return fixup10(input_); @@ -95,9 +95,9 @@ TQValidator::State ISBNValidator::validate10(TQString& input_, int& pos_) const } */ // two easy invalid cases are too many hyphens and the 'X' not in the last position - if(input_.tqcontains('-') > 3 - || input_.tqcontains('X', false) > 1 - || (input_.tqfind('X', 0, false) != -1 && input_[len-1].upper() != 'X')) { + if(input_.contains('-') > 3 + || input_.contains('X', false) > 1 + || (input_.find('X', 0, false) != -1 && input_[len-1].upper() != 'X')) { return TQValidator::Invalid; } @@ -114,7 +114,7 @@ TQValidator::State ISBNValidator::validate10(TQString& input_, int& pos_) const // fix the case where the user attempts to delete the checksum; the // solution is to delete the last digit as well static const TQRegExp digit(TQString::tqfromLatin1("\\d")); - if(atEnd && input_.tqcontains(digit) == 9 && input_[len-1] == '-') { + if(atEnd && input_.contains(digit) == 9 && input_[len-1] == '-') { input_.truncate(len-2); pos_ -= 2; len -= 2; @@ -142,9 +142,9 @@ TQValidator::State ISBNValidator::validate13(TQString& input_, int& pos_) const static const TQRegExp isbn(TQString::tqfromLatin1("(\\d-?){13,17}")); uint len = input_.length(); - const uint countX = input_.tqcontains('X', false); + const uint countX = input_.contains('X', false); // two easy invalid cases are too many hyphens or 'X' - if(input_.tqcontains('-') > 4 || countX > 1) { + if(input_.contains('-') > 4 || countX > 1) { return TQValidator::Invalid; } @@ -167,7 +167,7 @@ TQValidator::State ISBNValidator::validate13(TQString& input_, int& pos_) const // fix the case where the user attempts to delete the checksum; the // solution is to delete the last digit as well static const TQRegExp digit(TQString::tqfromLatin1("\\d")); - const uint countN = input_.tqcontains(digit); + const uint countN = input_.contains(digit); if(atEnd && (countN == 12 || countN == 9) && input_[len-1] == '-') { input_.truncate(len-2); pos_ -= 2; @@ -198,8 +198,8 @@ void ISBNValidator::fixup10(TQString& input_) { return; } - //tqreplace "x" with "X" - input_.tqreplace('x', TQString::tqfromLatin1("X")); + //replace "x" with "X" + input_.replace('x', TQString::tqfromLatin1("X")); // remove invalid chars static const TQRegExp badChars(TQString::tqfromLatin1("[^\\d-X]")); @@ -226,11 +226,11 @@ void ISBNValidator::fixup10(TQString& input_) { // the user inserts one, then be sure to put it back // Find the first hyphen. If there is none, - // input_.tqfind('-') returns -1 and hyphen2_position = 0 - int hyphen2_position = input_.tqfind('-') + 1; + // input_.find('-') returns -1 and hyphen2_position = 0 + int hyphen2_position = input_.find('-') + 1; // Find the second one. If none, hyphen2_position = -2 - hyphen2_position = input_.tqfind('-', hyphen2_position) - 1; + hyphen2_position = input_.find('-', hyphen2_position) - 1; // The second hyphen can not be in the last characters if(hyphen2_position >= 9) { @@ -240,7 +240,7 @@ void ISBNValidator::fixup10(TQString& input_) { // Remove all existing hyphens. We will insert ours. input_.remove('-'); // the only place that 'X' can be is last spot - for(int xpos = input_.tqfind('X'); xpos > -1; xpos = input_.tqfind('X', xpos+1)) { + for(int xpos = input_.find('X'); xpos > -1; xpos = input_.find('X', xpos+1)) { if(xpos < 9) { // remove if not 10th char input_.remove(xpos, 1); --xpos; @@ -307,11 +307,11 @@ void ISBNValidator::fixup13(TQString& input_) { } // Find the first hyphen. If there is none, - // input_.tqfind('-') returns -1 and hyphen2_position = 0 - int hyphen2_position = after.tqfind('-') + 1; + // input_.find('-') returns -1 and hyphen2_position = 0 + int hyphen2_position = after.find('-') + 1; // Find the second one. If none, hyphen2_position = -2 - hyphen2_position = after.tqfind('-', hyphen2_position) - 1; + hyphen2_position = after.find('-', hyphen2_position) - 1; // The second hyphen can not be in the last characters if(hyphen2_position >= 9) { |