MCPcopy Create free account
hub / github.com/Kitware/VTK / CheckWeirdConstructors

Method CheckWeirdConstructors

Testing/Core/HeaderTesting.py:467–492  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

465 self.Error("Multiple assignment operators")
466
467 def CheckWeirdConstructors(self):
468 if not self.HasClass:
469 return
470
471 count = 0
472 lines = []
473 oldlines = []
474 constructor = "^\\s*%s\\s*\\(([^ )]*)\\)" % self.ClassName
475 copyoperator = "^\\s*%s\\s*\\(\\s*const\\s*%s\\s*&\\s*\\)\\s*;\\s*\\/\\/\\s*Not\\s*implemented(\\.)*" % ( self.ClassName, self.ClassName)
476 regx1 = re.compile(constructor)
477 regx2 = re.compile(copyoperator)
478 cc = 0
479 for a in self.FileLines:
480 line = a.strip()
481 rm = regx1.match(line)
482 if rm:
483 arg = rm.group(1).strip()
484 if arg and not regx2.match(line):
485 lines.append(" %4d: %s" % (cc, line))
486 cc = cc + 1
487 if len(lines) > 0:
488 self.Print( "File: %s has weird constructor(s):" % self.FileName )
489 for a in lines:
490 self.Print( a )
491 self.Print( "There should be only:\n %s();" % self.ClassName )
492 self.Error("Weird constructor")
493
494 def CheckPrintSelf(self):
495 if not self.ClassName:

Callers 1

HeaderTesting.pyFile · 0.80

Calls 6

PrintMethod · 0.95
ErrorMethod · 0.95
compileMethod · 0.80
matchMethod · 0.45
groupMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected