Stores information about a generic block of code.
| 2208 | |
| 2209 | |
| 2210 | class _BlockInfo(object): |
| 2211 | """Stores information about a generic block of code.""" |
| 2212 | |
| 2213 | def __init__(self, linenum, seen_open_brace): |
| 2214 | self.starting_linenum = linenum |
| 2215 | self.seen_open_brace = seen_open_brace |
| 2216 | self.open_parentheses = 0 |
| 2217 | self.inline_asm = _NO_ASM |
| 2218 | self.check_namespace_indentation = False |
| 2219 | |
| 2220 | def CheckBegin(self, filename, clean_lines, linenum, error): |
| 2221 | """Run checks that applies to text up to the opening brace. |
| 2222 | |
| 2223 | This is mostly for checking the text after the class identifier |
| 2224 | and the "{", usually where the base class is specified. For other |
| 2225 | blocks, there isn't much to check, so we always pass. |
| 2226 | |
| 2227 | Args: |
| 2228 | filename: The name of the current file. |
| 2229 | clean_lines: A CleansedLines instance containing the file. |
| 2230 | linenum: The number of the line to check. |
| 2231 | error: The function to call with any errors found. |
| 2232 | """ |
| 2233 | pass |
| 2234 | |
| 2235 | def CheckEnd(self, filename, clean_lines, linenum, error): |
| 2236 | """Run checks that applies to text after the closing brace. |
| 2237 | |
| 2238 | This is mostly used for checking end of namespace comments. |
| 2239 | |
| 2240 | Args: |
| 2241 | filename: The name of the current file. |
| 2242 | clean_lines: A CleansedLines instance containing the file. |
| 2243 | linenum: The number of the line to check. |
| 2244 | error: The function to call with any errors found. |
| 2245 | """ |
| 2246 | pass |
| 2247 | |
| 2248 | def IsBlockInfo(self): |
| 2249 | """Returns true if this block is a _BlockInfo. |
| 2250 | |
| 2251 | This is convenient for verifying that an object is an instance of |
| 2252 | a _BlockInfo, but not an instance of any of the derived classes. |
| 2253 | |
| 2254 | Returns: |
| 2255 | True for this class, False for derived classes. |
| 2256 | """ |
| 2257 | return self.__class__ == _BlockInfo |
| 2258 | |
| 2259 | |
| 2260 | class _ExternCInfo(_BlockInfo): |