Public Member Functions | Private Attributes | Static Private Attributes | List of all members
cpplint._IncludeState Class Reference
Inheritance diagram for cpplint._IncludeState:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self)
 
def CanonicalizeAlphabeticalOrder (self, header_path)
 
def CheckNextIncludeOrder (self, header_type)
 
def IsInAlphabeticalOrder (self, clean_lines, linenum, header_path)
 
def ResetSection (self)
 
def SetLastHeader (self, header_path)
 

Private Attributes

 _last_header
 
 _section
 

Static Private Attributes

int _C_SECTION = 2
 
int _CPP_SECTION = 3
 
int _INITIAL_SECTION = 0
 
int _MY_H_SECTION = 1
 
int _OTHER_H_SECTION = 4
 
dictionary _SECTION_NAMES
 
dictionary _TYPE_NAMES
 

Detailed Description

Tracks line numbers for includes, and the order in which includes appear.

As a dict, an _IncludeState object serves as a mapping between include
filename and line number on which that file was included.

Call CheckNextIncludeOrder() once for each header in the file, passing
in the type constants defined above. Calls in an illegal order will
raise an _IncludeError with an appropriate error message.

Definition at line 542 of file cpplint.py.

Constructor & Destructor Documentation

def cpplint._IncludeState.__init__ (   self)

Definition at line 576 of file cpplint.py.

Member Function Documentation

def cpplint._IncludeState.CanonicalizeAlphabeticalOrder (   self,
  header_path 
)
Returns a path canonicalized for alphabetical comparison.

- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.

Args:
  header_path: Path to be canonicalized.

Returns:
  Canonicalized path.

Definition at line 589 of file cpplint.py.

def cpplint._IncludeState.CheckNextIncludeOrder (   self,
  header_type 
)
Returns a non-empty error message if the next header is out of order.

This function also updates the internal state to be ready to check
the next include.

Args:
  header_type: One of the _XXX_HEADER constants defined above.

Returns:
  The empty string if the header is in the right order, or an
  error message describing what's wrong.

Definition at line 625 of file cpplint.py.

def cpplint._IncludeState.IsInAlphabeticalOrder (   self,
  clean_lines,
  linenum,
  header_path 
)
Check if a header is in alphabetical order with the previous header.

Args:
  clean_lines: A CleansedLines instance containing the file.
  linenum: The number of the line to check.
  header_path: Canonicalized header to be checked.

Returns:
  Returns true if the header is in alphabetical order.

Definition at line 604 of file cpplint.py.

def cpplint._IncludeState.ResetSection (   self)

Definition at line 580 of file cpplint.py.

def cpplint._IncludeState.SetLastHeader (   self,
  header_path 
)

Definition at line 586 of file cpplint.py.

Member Data Documentation

int cpplint._IncludeState._C_SECTION = 2
staticprivate

Definition at line 557 of file cpplint.py.

int cpplint._IncludeState._CPP_SECTION = 3
staticprivate

Definition at line 558 of file cpplint.py.

int cpplint._IncludeState._INITIAL_SECTION = 0
staticprivate

Definition at line 555 of file cpplint.py.

cpplint._IncludeState._last_header
private

Definition at line 584 of file cpplint.py.

int cpplint._IncludeState._MY_H_SECTION = 1
staticprivate

Definition at line 556 of file cpplint.py.

int cpplint._IncludeState._OTHER_H_SECTION = 4
staticprivate

Definition at line 559 of file cpplint.py.

cpplint._IncludeState._section
private

Definition at line 582 of file cpplint.py.

dictionary cpplint._IncludeState._SECTION_NAMES
staticprivate
Initial value:
1 = {
2  _INITIAL_SECTION: "... nothing. (This can't be an error.)",
3  _MY_H_SECTION: 'a header this file implements',
4  _C_SECTION: 'C system header',
5  _CPP_SECTION: 'C++ system header',
6  _OTHER_H_SECTION: 'other header',
7  }

Definition at line 568 of file cpplint.py.

dictionary cpplint._IncludeState._TYPE_NAMES
staticprivate
Initial value:
1 = {
2  _C_SYS_HEADER: 'C system header',
3  _CPP_SYS_HEADER: 'C++ system header',
4  _LIKELY_MY_HEADER: 'header this file implements',
5  _POSSIBLE_MY_HEADER: 'header this file may implement',
6  _OTHER_HEADER: 'other header',
7  }

Definition at line 561 of file cpplint.py.


The documentation for this class was generated from the following file:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:27