| @@ 2313-2360 (lines=48) @@ | ||
| 2310 | return Match(r'^\s*(\btemplate\b)*.*class\s+\w+;\s*$', clean_lines[linenum]) |
|
| 2311 | ||
| 2312 | ||
| 2313 | class _BlockInfo(object): |
|
| 2314 | """Stores information about a generic block of code.""" |
|
| 2315 | ||
| 2316 | def __init__(self, linenum, seen_open_brace): |
|
| 2317 | self.starting_linenum = linenum |
|
| 2318 | self.seen_open_brace = seen_open_brace |
|
| 2319 | self.open_parentheses = 0 |
|
| 2320 | self.inline_asm = _NO_ASM |
|
| 2321 | self.check_namespace_indentation = False |
|
| 2322 | ||
| 2323 | def CheckBegin(self, filename, clean_lines, linenum, error): |
|
| 2324 | """Run checks that applies to text up to the opening brace. |
|
| 2325 | ||
| 2326 | This is mostly for checking the text after the class identifier |
|
| 2327 | and the "{", usually where the base class is specified. For other |
|
| 2328 | blocks, there isn't much to check, so we always pass. |
|
| 2329 | ||
| 2330 | Args: |
|
| 2331 | filename: The name of the current file. |
|
| 2332 | clean_lines: A CleansedLines instance containing the file. |
|
| 2333 | linenum: The number of the line to check. |
|
| 2334 | error: The function to call with any errors found. |
|
| 2335 | """ |
|
| 2336 | pass |
|
| 2337 | ||
| 2338 | def CheckEnd(self, filename, clean_lines, linenum, error): |
|
| 2339 | """Run checks that applies to text after the closing brace. |
|
| 2340 | ||
| 2341 | This is mostly used for checking end of namespace comments. |
|
| 2342 | ||
| 2343 | Args: |
|
| 2344 | filename: The name of the current file. |
|
| 2345 | clean_lines: A CleansedLines instance containing the file. |
|
| 2346 | linenum: The number of the line to check. |
|
| 2347 | error: The function to call with any errors found. |
|
| 2348 | """ |
|
| 2349 | pass |
|
| 2350 | ||
| 2351 | def IsBlockInfo(self): |
|
| 2352 | """Returns true if this block is a _BlockInfo. |
|
| 2353 | ||
| 2354 | This is convenient for verifying that an object is an instance of |
|
| 2355 | a _BlockInfo, but not an instance of any of the derived classes. |
|
| 2356 | ||
| 2357 | Returns: |
|
| 2358 | True for this class, False for derived classes. |
|
| 2359 | """ |
|
| 2360 | return self.__class__ == _BlockInfo |
|
| 2361 | ||
| 2362 | ||
| 2363 | class _ExternCInfo(_BlockInfo): |
|
| @@ 2313-2360 (lines=48) @@ | ||
| 2310 | return Match(r'^\s*(\btemplate\b)*.*class\s+\w+;\s*$', clean_lines[linenum]) |
|
| 2311 | ||
| 2312 | ||
| 2313 | class _BlockInfo(object): |
|
| 2314 | """Stores information about a generic block of code.""" |
|
| 2315 | ||
| 2316 | def __init__(self, linenum, seen_open_brace): |
|
| 2317 | self.starting_linenum = linenum |
|
| 2318 | self.seen_open_brace = seen_open_brace |
|
| 2319 | self.open_parentheses = 0 |
|
| 2320 | self.inline_asm = _NO_ASM |
|
| 2321 | self.check_namespace_indentation = False |
|
| 2322 | ||
| 2323 | def CheckBegin(self, filename, clean_lines, linenum, error): |
|
| 2324 | """Run checks that applies to text up to the opening brace. |
|
| 2325 | ||
| 2326 | This is mostly for checking the text after the class identifier |
|
| 2327 | and the "{", usually where the base class is specified. For other |
|
| 2328 | blocks, there isn't much to check, so we always pass. |
|
| 2329 | ||
| 2330 | Args: |
|
| 2331 | filename: The name of the current file. |
|
| 2332 | clean_lines: A CleansedLines instance containing the file. |
|
| 2333 | linenum: The number of the line to check. |
|
| 2334 | error: The function to call with any errors found. |
|
| 2335 | """ |
|
| 2336 | pass |
|
| 2337 | ||
| 2338 | def CheckEnd(self, filename, clean_lines, linenum, error): |
|
| 2339 | """Run checks that applies to text after the closing brace. |
|
| 2340 | ||
| 2341 | This is mostly used for checking end of namespace comments. |
|
| 2342 | ||
| 2343 | Args: |
|
| 2344 | filename: The name of the current file. |
|
| 2345 | clean_lines: A CleansedLines instance containing the file. |
|
| 2346 | linenum: The number of the line to check. |
|
| 2347 | error: The function to call with any errors found. |
|
| 2348 | """ |
|
| 2349 | pass |
|
| 2350 | ||
| 2351 | def IsBlockInfo(self): |
|
| 2352 | """Returns true if this block is a _BlockInfo. |
|
| 2353 | ||
| 2354 | This is convenient for verifying that an object is an instance of |
|
| 2355 | a _BlockInfo, but not an instance of any of the derived classes. |
|
| 2356 | ||
| 2357 | Returns: |
|
| 2358 | True for this class, False for derived classes. |
|
| 2359 | """ |
|
| 2360 | return self.__class__ == _BlockInfo |
|
| 2361 | ||
| 2362 | ||
| 2363 | class _ExternCInfo(_BlockInfo): |
|