Stores information about a generic block of code.
| 1995 | |
| 1996 | |
| 1997 | class _BlockInfo(object): |
| 1998 | """Stores information about a generic block of code.""" |
| 1999 | |
| 2000 | def __init__(self, seen_open_brace): |
| 2001 | self.seen_open_brace = seen_open_brace |
| 2002 | self.open_parentheses = 0 |
| 2003 | self.inline_asm = _NO_ASM |
| 2004 | self.check_namespace_indentation = False |
| 2005 | |
| 2006 | def CheckBegin(self, filename, clean_lines, linenum, error): |
| 2007 | """Run checks that applies to text up to the opening brace. |
| 2008 | |
| 2009 | This is mostly for checking the text after the class identifier |
| 2010 | and the "{", usually where the base class is specified. For other |
| 2011 | blocks, there isn't much to check, so we always pass. |
| 2012 | |
| 2013 | Args: |
| 2014 | filename: The name of the current file. |
| 2015 | clean_lines: A CleansedLines instance containing the file. |
| 2016 | linenum: The number of the line to check. |
| 2017 | error: The function to call with any errors found. |
| 2018 | """ |
| 2019 | pass |
| 2020 | |
| 2021 | def CheckEnd(self, filename, clean_lines, linenum, error): |
| 2022 | """Run checks that applies to text after the closing brace. |
| 2023 | |
| 2024 | This is mostly used for checking end of namespace comments. |
| 2025 | |
| 2026 | Args: |
| 2027 | filename: The name of the current file. |
| 2028 | clean_lines: A CleansedLines instance containing the file. |
| 2029 | linenum: The number of the line to check. |
| 2030 | error: The function to call with any errors found. |
| 2031 | """ |
| 2032 | pass |
| 2033 | |
| 2034 | def IsBlockInfo(self): |
| 2035 | """Returns true if this block is a _BlockInfo. |
| 2036 | |
| 2037 | This is convenient for verifying that an object is an instance of |
| 2038 | a _BlockInfo, but not an instance of any of the derived classes. |
| 2039 | |
| 2040 | Returns: |
| 2041 | True for this class, False for derived classes. |
| 2042 | """ |
| 2043 | return self.__class__ == _BlockInfo |
| 2044 | |
| 2045 | |
| 2046 | class _ExternCInfo(_BlockInfo): |