MCPcopy Create free account
hub / github.com/SIPp/sipp / GetHeaderGuardCPPVariable

Function GetHeaderGuardCPPVariable

cpplint.py:1111–1132  ·  view source on GitHub ↗

Returns the CPP variable that should be used as a header guard. Args: filename: The name of a C++ header file. Returns: The CPP variable that should be used as a header guard in the named file.

(filename)

Source from the content-addressed store, hash-verified

1109
1110
1111def GetHeaderGuardCPPVariable(filename):
1112 """Returns the CPP variable that should be used as a header guard.
1113
1114 Args:
1115 filename: The name of a C++ header file.
1116
1117 Returns:
1118 The CPP variable that should be used as a header guard in the
1119 named file.
1120
1121 """
1122
1123 # Restores original filename in case that cpplint is invoked from Emacs's
1124 # flymake.
1125 filename = re.sub(r'_flymake\.h$', '.h', filename)
1126 filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
1127
1128 fileinfo = FileInfo(filename)
1129 file_path_from_root = fileinfo.RepositoryName()
1130 if _root:
1131 file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
1132 return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_'
1133
1134
1135def CheckForHeaderGuard(filename, lines, error):

Callers 2

CheckForHeaderGuardFunction · 0.85
CheckStyleFunction · 0.85

Calls 2

RepositoryNameMethod · 0.95
FileInfoClass · 0.85

Tested by

no test coverage detected