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