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