FV3 Bundle
cpplint._IncludeState Class Reference
Inheritance diagram for cpplint._IncludeState:
[legend]
Collaboration diagram for cpplint._IncludeState:
[legend]

Public Member Functions

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

Public Attributes

 include_list
 

Private Attributes

 _section
 
 _last_header
 

Static Private Attributes

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

Detailed Description

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

include_list contains list of lists of (header, line number) pairs.
It's a lists of lists rather than just one flat list to make it
easier to update across preprocessor boundaries.

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 797 of file ioda/tools/cpplint.py.

Constructor & Destructor Documentation

◆ __init__() [1/3]

def cpplint._IncludeState.__init__ (   self)

Definition at line 832 of file ioda/tools/cpplint.py.

Here is the caller graph for this function:

◆ __init__() [2/3]

def cpplint._IncludeState.__init__ (   self)

Definition at line 832 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ __init__() [3/3]

def cpplint._IncludeState.__init__ (   self)

Definition at line 832 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

Member Function Documentation

◆ CanonicalizeAlphabeticalOrder() [1/3]

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 874 of file ioda/tools/cpplint.py.

Here is the caller graph for this function:

◆ CanonicalizeAlphabeticalOrder() [2/3]

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 874 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ CanonicalizeAlphabeticalOrder() [3/3]

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 874 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

◆ CheckNextIncludeOrder() [1/3]

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 910 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

◆ CheckNextIncludeOrder() [2/3]

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 910 of file ioda/tools/cpplint.py.

Here is the caller graph for this function:

◆ CheckNextIncludeOrder() [3/3]

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 910 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ FindHeader() [1/3]

def cpplint._IncludeState.FindHeader (   self,
  header 
)
Check if a header has already been included.

Args:
  header: header to check.
Returns:
  Line number of previous occurrence, or -1 if the header has not
  been seen before.

Definition at line 838 of file ioda/tools/cpplint.py.

Here is the caller graph for this function:

◆ FindHeader() [2/3]

def cpplint._IncludeState.FindHeader (   self,
  header 
)
Check if a header has already been included.

Args:
  header: header to check.
Returns:
  Line number of previous occurrence, or -1 if the header has not
  been seen before.

Definition at line 838 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

◆ FindHeader() [3/3]

def cpplint._IncludeState.FindHeader (   self,
  header 
)
Check if a header has already been included.

Args:
  header: header to check.
Returns:
  Line number of previous occurrence, or -1 if the header has not
  been seen before.

Definition at line 838 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ IsInAlphabeticalOrder() [1/3]

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 889 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

◆ IsInAlphabeticalOrder() [2/3]

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 889 of file ioda/tools/cpplint.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsInAlphabeticalOrder() [3/3]

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 889 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ ResetSection() [1/3]

def cpplint._IncludeState.ResetSection (   self,
  directive 
)
Reset section checking for preprocessor directive.

Args:
  directive: preprocessor directive (e.g. "if", "else").

Definition at line 853 of file ioda/tools/cpplint.py.

Here is the caller graph for this function:

◆ ResetSection() [2/3]

def cpplint._IncludeState.ResetSection (   self,
  directive 
)
Reset section checking for preprocessor directive.

Args:
  directive: preprocessor directive (e.g. "if", "else").

Definition at line 853 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ ResetSection() [3/3]

def cpplint._IncludeState.ResetSection (   self,
  directive 
)
Reset section checking for preprocessor directive.

Args:
  directive: preprocessor directive (e.g. "if", "else").

Definition at line 853 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

◆ SetLastHeader() [1/3]

def cpplint._IncludeState.SetLastHeader (   self,
  header_path 
)

Definition at line 871 of file oops/tools/cpplint.py.

Here is the call graph for this function:

◆ SetLastHeader() [2/3]

def cpplint._IncludeState.SetLastHeader (   self,
  header_path 
)

Definition at line 871 of file ioda/tools/cpplint.py.

Here is the caller graph for this function:

◆ SetLastHeader() [3/3]

def cpplint._IncludeState.SetLastHeader (   self,
  header_path 
)

Definition at line 871 of file ufo/tools/cpplint.py.

Here is the call graph for this function:

Member Data Documentation

◆ _C_SECTION

int cpplint._IncludeState._C_SECTION = 2
staticprivate

Definition at line 813 of file ioda/tools/cpplint.py.

◆ _CPP_SECTION

int cpplint._IncludeState._CPP_SECTION = 3
staticprivate

Definition at line 814 of file ioda/tools/cpplint.py.

◆ _INITIAL_SECTION

int cpplint._IncludeState._INITIAL_SECTION = 0
staticprivate

Definition at line 811 of file ioda/tools/cpplint.py.

◆ _last_header

cpplint._IncludeState._last_header
private

Definition at line 835 of file ioda/tools/cpplint.py.

◆ _MY_H_SECTION

int cpplint._IncludeState._MY_H_SECTION = 1
staticprivate

Definition at line 812 of file ioda/tools/cpplint.py.

◆ _OTHER_H_SECTION

int cpplint._IncludeState._OTHER_H_SECTION = 4
staticprivate

Definition at line 815 of file ioda/tools/cpplint.py.

◆ _section

cpplint._IncludeState._section
private

Definition at line 834 of file ioda/tools/cpplint.py.

◆ _SECTION_NAMES

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

Definition at line 824 of file ioda/tools/cpplint.py.

◆ _TYPE_NAMES

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

Definition at line 817 of file ioda/tools/cpplint.py.

◆ include_list

cpplint._IncludeState.include_list

Definition at line 833 of file ioda/tools/cpplint.py.


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