Stores information about a generic block of code.
| 2960 | |
| 2961 | |
| 2962 | class _BlockInfo: |
| 2963 | """Stores information about a generic block of code.""" |
| 2964 | |
| 2965 | def __init__(self, linenum, seen_open_brace): |
| 2966 | self.starting_linenum = linenum |
| 2967 | self.seen_open_brace = seen_open_brace |
| 2968 | self.open_parentheses = 0 |
| 2969 | self.inline_asm = _NO_ASM |
| 2970 | self.check_namespace_indentation = False |
| 2971 | |
| 2972 | def CheckBegin(self, filename, clean_lines, linenum, error): |
| 2973 | """Run checks that applies to text up to the opening brace. |
| 2974 | |
| 2975 | This is mostly for checking the text after the class identifier |
| 2976 | and the "{", usually where the base class is specified. For other |
| 2977 | blocks, there isn't much to check, so we always pass. |
| 2978 | |
| 2979 | Args: |
| 2980 | filename: The name of the current file. |
| 2981 | clean_lines: A CleansedLines instance containing the file. |
| 2982 | linenum: The number of the line to check. |
| 2983 | error: The function to call with any errors found. |
| 2984 | """ |
| 2985 | pass |
| 2986 | |
| 2987 | def CheckEnd(self, filename, clean_lines, linenum, error): |
| 2988 | """Run checks that applies to text after the closing brace. |
| 2989 | |
| 2990 | This is mostly used for checking end of namespace comments. |
| 2991 | |
| 2992 | Args: |
| 2993 | filename: The name of the current file. |
| 2994 | clean_lines: A CleansedLines instance containing the file. |
| 2995 | linenum: The number of the line to check. |
| 2996 | error: The function to call with any errors found. |
| 2997 | """ |
| 2998 | pass |
| 2999 | |
| 3000 | def IsBlockInfo(self): |
| 3001 | """Returns true if this block is a _BlockInfo. |
| 3002 | |
| 3003 | This is convenient for verifying that an object is an instance of |
| 3004 | a _BlockInfo, but not an instance of any of the derived classes. |
| 3005 | |
| 3006 | Returns: |
| 3007 | True for this class, False for derived classes. |
| 3008 | """ |
| 3009 | return self.__class__ == _BlockInfo |
| 3010 | |
| 3011 | |
| 3012 | class _ExternCInfo(_BlockInfo): |