OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 if (string.is8Bit()) { | 543 if (string.is8Bit()) { |
544 const LChar* characters8 = string.characters8(); | 544 const LChar* characters8 = string.characters8(); |
545 vector.reserveCapacity(vector.size() + length); | 545 vector.reserveCapacity(vector.size() + length); |
546 for (size_t i = 0; i < length; ++i) | 546 for (size_t i = 0; i < length; ++i) |
547 vector.uncheckedAppend(characters8[i]); | 547 vector.uncheckedAppend(characters8[i]); |
548 } else { | 548 } else { |
549 vector.append(string.characters16(), length); | 549 vector.append(string.characters16(), length); |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 template<typename CharacterType> | |
554 inline void appendNumber(Vector<CharacterType>& vector, unsigned char number) | |
555 { | |
556 int numberLength = number > 99 ? 3 : (number > 9 ? 2 : 1); | |
557 size_t vectorSize = vector.size(); | |
558 vector.grow(vectorSize + numberLength); | |
559 | |
560 switch (numberLength) { | |
561 case 3: | |
562 vector[vectorSize + 2] = number % 10 + '0'; | |
563 number /= 10; | |
564 | |
565 case 2: | |
566 vector[vectorSize + 1] = number % 10 + '0'; | |
567 number /= 10; | |
568 | |
569 case 1: | |
570 vector[vectorSize] = number % 10 + '0'; | |
571 } | |
572 } | |
573 | |
574 template<bool isSpecialCharacter(UChar), typename CharacterType> | 553 template<bool isSpecialCharacter(UChar), typename CharacterType> |
575 inline bool isAllSpecialCharacters(const CharacterType* characters, size_t lengt
h) | 554 inline bool isAllSpecialCharacters(const CharacterType* characters, size_t lengt
h) |
576 { | 555 { |
577 for (size_t i = 0; i < length; ++i) { | 556 for (size_t i = 0; i < length; ++i) { |
578 if (!isSpecialCharacter(characters[i])) | 557 if (!isSpecialCharacter(characters[i])) |
579 return false; | 558 return false; |
580 } | 559 } |
581 return true; | 560 return true; |
582 } | 561 } |
583 | 562 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(String); | 634 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(String); |
656 | 635 |
657 using WTF::CString; | 636 using WTF::CString; |
658 using WTF::KeepTrailingZeros; | 637 using WTF::KeepTrailingZeros; |
659 using WTF::StrictUTF8Conversion; | 638 using WTF::StrictUTF8Conversion; |
660 using WTF::StrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD; | 639 using WTF::StrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD; |
661 using WTF::String; | 640 using WTF::String; |
662 using WTF::emptyString; | 641 using WTF::emptyString; |
663 using WTF::emptyString16Bit; | 642 using WTF::emptyString16Bit; |
664 using WTF::append; | 643 using WTF::append; |
665 using WTF::appendNumber; | |
666 using WTF::charactersAreAllASCII; | 644 using WTF::charactersAreAllASCII; |
667 using WTF::charactersToIntStrict; | 645 using WTF::charactersToIntStrict; |
668 using WTF::charactersToUIntStrict; | 646 using WTF::charactersToUIntStrict; |
669 using WTF::charactersToInt64Strict; | 647 using WTF::charactersToInt64Strict; |
670 using WTF::charactersToUInt64Strict; | 648 using WTF::charactersToUInt64Strict; |
671 using WTF::charactersToInt; | 649 using WTF::charactersToInt; |
672 using WTF::charactersToUInt; | 650 using WTF::charactersToUInt; |
673 using WTF::charactersToInt64; | 651 using WTF::charactersToInt64; |
674 using WTF::charactersToUInt64; | 652 using WTF::charactersToUInt64; |
675 using WTF::charactersToDouble; | 653 using WTF::charactersToDouble; |
676 using WTF::charactersToFloat; | 654 using WTF::charactersToFloat; |
677 using WTF::equal; | 655 using WTF::equal; |
678 using WTF::equalIgnoringCase; | 656 using WTF::equalIgnoringCase; |
679 using WTF::find; | 657 using WTF::find; |
680 using WTF::isAllSpecialCharacters; | 658 using WTF::isAllSpecialCharacters; |
681 using WTF::isSpaceOrNewline; | 659 using WTF::isSpaceOrNewline; |
682 using WTF::reverseFind; | 660 using WTF::reverseFind; |
683 | 661 |
684 #include "wtf/text/AtomicString.h" | 662 #include "wtf/text/AtomicString.h" |
685 #endif // WTFString_h | 663 #endif // WTFString_h |
OLD | NEW |