Stores information about a generic block of code.
| 2697 | |
| 2698 | |
| 2699 | class _BlockInfo(object): |
| 2700 | """Stores information about a generic block of code.""" |
| 2701 | |
| 2702 | def __init__(self, linenum, seen_open_brace): |
| 2703 | self.starting_linenum = linenum |
| 2704 | self.seen_open_brace = seen_open_brace |
| 2705 | self.open_parentheses = 0 |
| 2706 | self.inline_asm = _NO_ASM |
| 2707 | self.check_namespace_indentation = False |
| 2708 | |
| 2709 | def CheckBegin(self, filename, clean_lines, linenum, error): |
| 2710 | """Run checks that applies to text up to the opening brace. |
| 2711 | |
| 2712 | This is mostly for checking the text after the class identifier |
| 2713 | and the "{", usually where the base class is specified. For other |
| 2714 | blocks, there isn't much to check, so we always pass. |
| 2715 | |
| 2716 | Args: |
| 2717 | filename: The name of the current file. |
| 2718 | clean_lines: A CleansedLines instance containing the file. |
| 2719 | linenum: The number of the line to check. |
| 2720 | error: The function to call with any errors found. |
| 2721 | """ |
| 2722 | pass |
| 2723 | |
| 2724 | def CheckEnd(self, filename, clean_lines, linenum, error): |
| 2725 | """Run checks that applies to text after the closing brace. |
| 2726 | |
| 2727 | This is mostly used for checking end of namespace comments. |
| 2728 | |
| 2729 | Args: |
| 2730 | filename: The name of the current file. |
| 2731 | clean_lines: A CleansedLines instance containing the file. |
| 2732 | linenum: The number of the line to check. |
| 2733 | error: The function to call with any errors found. |
| 2734 | """ |
| 2735 | pass |
| 2736 | |
| 2737 | def IsBlockInfo(self): |
| 2738 | """Returns true if this block is a _BlockInfo. |
| 2739 | |
| 2740 | This is convenient for verifying that an object is an instance of |
| 2741 | a _BlockInfo, but not an instance of any of the derived classes. |
| 2742 | |
| 2743 | Returns: |
| 2744 | True for this class, False for derived classes. |
| 2745 | """ |
| 2746 | return self.__class__ == _BlockInfo |
| 2747 | |
| 2748 | |
| 2749 | class _ExternCInfo(_BlockInfo): |