| 1395 | """Stores information about a class.""" |
| 1396 | |
| 1397 | def __init__(self, name, class_or_struct, clean_lines, linenum): |
| 1398 | _BlockInfo.__init__(self, False) |
| 1399 | self.name = name |
| 1400 | self.starting_linenum = linenum |
| 1401 | self.is_derived = False |
| 1402 | if class_or_struct == 'struct': |
| 1403 | self.access = 'public' |
| 1404 | else: |
| 1405 | self.access = 'private' |
| 1406 | |
| 1407 | # Try to find the end of the class. This will be confused by things like: |
| 1408 | # class A { |
| 1409 | # } *x = { ... |
| 1410 | # |
| 1411 | # But it's still good enough for CheckSectionSpacing. |
| 1412 | self.last_line = 0 |
| 1413 | depth = 0 |
| 1414 | for i in range(linenum, clean_lines.NumLines()): |
| 1415 | line = clean_lines.elided[i] |
| 1416 | depth += line.count('{') - line.count('}') |
| 1417 | if not depth: |
| 1418 | self.last_line = i |
| 1419 | break |
| 1420 | |
| 1421 | def CheckBegin(self, filename, clean_lines, linenum, error): |
| 1422 | # Look for a bare ':' |