* Check if the currently reached '*' or '&' character is * centered with one space on each side. * Only spaces are checked, not tabs. * If true then a space will be deleted on the output. * * @return whether current character is centered. */
| 2765 | * @return whether current character is centered. |
| 2766 | */ |
| 2767 | bool ASFormatter::isPointerOrReferenceCentered() const |
| 2768 | { |
| 2769 | assert(currentLine[charNum] == '*' || currentLine[charNum] == '&' || currentLine[charNum] == '^'); |
| 2770 | |
| 2771 | int prNum = charNum; |
| 2772 | int lineLength = (int) currentLine.length(); |
| 2773 | |
| 2774 | // check for end of line |
| 2775 | if (peekNextChar() == ' ') |
| 2776 | return false; |
| 2777 | |
| 2778 | // check space before |
| 2779 | if (prNum < 1 |
| 2780 | || currentLine[prNum - 1] != ' ') |
| 2781 | return false; |
| 2782 | |
| 2783 | // check no space before that |
| 2784 | if (prNum < 2 |
| 2785 | || currentLine[prNum - 2] == ' ') |
| 2786 | return false; |
| 2787 | |
| 2788 | // check for ** |
| 2789 | if (prNum + 1 < lineLength |
| 2790 | && currentLine[prNum + 1] == '*') |
| 2791 | prNum++; |
| 2792 | |
| 2793 | // check space after |
| 2794 | if (prNum + 1 <= lineLength |
| 2795 | && currentLine[prNum + 1] != ' ') |
| 2796 | return false; |
| 2797 | |
| 2798 | // check no space after that |
| 2799 | if (prNum + 2 < lineLength |
| 2800 | && currentLine[prNum + 2] == ' ') |
| 2801 | return false; |
| 2802 | |
| 2803 | return true; |
| 2804 | } |
| 2805 | |
| 2806 | /** |
| 2807 | * Check if a word is a pointer or reference variable type. |
nothing calls this directly
no outgoing calls
no test coverage detected