| 798 | } |
| 799 | |
| 800 | size_t Prev(IterType what) override |
| 801 | { |
| 802 | const auto begin = this->string.begin(); |
| 803 | /* Already at the beginning? */ |
| 804 | if (this->cur_pos == begin) return END; |
| 805 | |
| 806 | switch (what) { |
| 807 | case ITER_CHARACTER: |
| 808 | --this->cur_pos; |
| 809 | return this->cur_pos.GetByteOffset(); |
| 810 | |
| 811 | case ITER_WORD: |
| 812 | /* Consume preceding whitespace. */ |
| 813 | do { |
| 814 | --this->cur_pos; |
| 815 | } while (this->cur_pos != begin && IsWhitespace(*this->cur_pos)); |
| 816 | /* Consume preceding word. */ |
| 817 | while (this->cur_pos != begin && !IsWhitespace(*this->cur_pos)) { |
| 818 | --this->cur_pos; |
| 819 | } |
| 820 | /* Move caret back to the beginning of the word. */ |
| 821 | if (IsWhitespace(*this->cur_pos)) ++this->cur_pos; |
| 822 | return this->cur_pos.GetByteOffset(); |
| 823 | |
| 824 | default: |
| 825 | NOT_REACHED(); |
| 826 | } |
| 827 | |
| 828 | return END; |
| 829 | } |
| 830 | }; |
| 831 | |
| 832 | #if defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN) |
nothing calls this directly
no test coverage detected