MCPcopy Create free account
hub / github.com/BVLC/caffe / GetHeaderGuardCPPVariable

Function GetHeaderGuardCPPVariable

scripts/cpp_lint.py:1388–1409  ·  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

1386
1387
1388def GetHeaderGuardCPPVariable(filename):
1389 """Returns the CPP variable that should be used as a header guard.
1390
1391 Args:
1392 filename: The name of a C++ header file.
1393
1394 Returns:
1395 The CPP variable that should be used as a header guard in the
1396 named file.
1397
1398 """
1399
1400 # Restores original filename in case that cpplint is invoked from Emacs's
1401 # flymake.
1402 filename = re.sub(r'_flymake\.h$', '.h', filename)
1403 filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
1404
1405 fileinfo = FileInfo(filename)
1406 file_path_from_root = fileinfo.RepositoryName()
1407 if _root:
1408 file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
1409 return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_'
1410
1411
1412def 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