Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"CPPNumericType",
"CPPOperation", "CPPOperationParameter",
"CPPPointerType",
"CPPReferenceType",
"CPPSequenceType",
"CPPStringType",
"CPPStructType",
"CPPTarget",
]
class CPPConstruct:
def getParentQualifiedNameMacro( self ): return "_".join( self.getQualifiedName()[:-1] ).upper()
class CPPType(CPPConstruct):
def getComparableValue( self, identifier ): return identifier
def getConstant( self, identifier, value ): qname = self.getQualifiedName( "::" ); return "const static %(qname)s %(identifier)s = %(value)s;" % locals()
def getDeclarationTypeName( self ): return self.getQualifiedName( "::" )
def getDefaultValue( self ): return None
def getDummyValue( self ): raise NotImplementedError
def getGetterDefinition( self, identifier ): return self.getDeclarationTypeName() + " get_%(identifier)s() const { return %(identifier)s; }" % locals()
def getInConstructorDeclaration( self, identifier, default_value=None, with_stl=True ): return self.getDeclarationTypeName() + lpad( " ", identifier ) + ( default_value is not None and ( " = " + str( default_value ) ) or "" )
def getInConstructorInitialValue( self, identifier, with_stl=True ): return identifier
def getOutConstructorDeclaration( self, identifier, with_stl=True ): return self.getDeclarationTypeName() + ( not self.getDeclarationTypeName().endswith( "&" ) and "& " or "" ) + identifier
def getSetterDefinitions( self, identifier ): qname = self.getDeclarationTypeName(); return ( "void set_%(identifier)s( %(qname)s %(identifier)s ) { this->%(identifier)s = %(identifier)s; }" % locals(), )
def getTempValueTypeName( self ): return self.getName()
class CPPCompoundType(CPPType):
def getConstant( self, *args, **kwds ): raise NotImplementedError
def getDummyValue( self ): return self.getDeclarationTypeName() + "()"
def getInConstructorInitialValue( self, identifier, with_stl=True ): return identifier
def getOutConstructorDeclaration( self, identifier, with_stl=True ): return self.getDeclarationTypeName() + ( not self.getDeclarationTypeName().endswith( "&" ) and "& " or "" ) + identifier
def getSetterDefinitions( self, identifier ): qname = self.getDeclarationTypeName(); return ( "void set_%(identifier)s( %(qname)s %(identifier)s ) { this->%(identifier)s = %(identifier)s; }" % locals(), )
def getTempValueTypeName( self ): return self.getName()
class CPPCompoundType(CPPType):
def getConstant( self, *args, **kwds ): raise NotImplementedError
def getDummyValue( self ): return self.getDeclarationTypeName() + "()"
def getGetterDefinition( self, identifier ): return "const " + self.getDeclarationTypeName() + "& get_%(identifier)s() const { return %(identifier)s; }" % locals()
def getInConstructorDeclaration( self, identifier, default_value=None, with_stl=True ): return "const " + self.getDeclarationTypeName() + "& " + identifier
def getSetterDefinitions( self, identifier ): const_reference_decl = "const " + self.getDeclarationTypeName() + "& "; return ( """void set_%(identifier)s( %(const_reference_decl)s %(identifier)s ) { this->%(identifier)s = %(identifier)s; }""" % locals(), )
def getTempValueTypeName( self ): return self.getDeclarationTypeName()
class CPPConstant(CConstant, CPPConstruct):
def __repr__( self ):
return self.getType().getConstant( self.getIdentifier(), self.getValue() )
class CPPBoolType(CBoolType, CPPType):
def getDefaultValue( self ): return "false"
def getDummyValue( self ): return "false"
class CPPBufferType(CBufferType, CPPType): pass
class CPPEnumeratedType(CEnumeratedType, CPPType):
def getDefaultValue( self ):
return self.getEnumerators()[0].getIdentifier()
class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass
class CPPModule(CModule, CPPConstruct):
def __repr__( self ):
return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), " " ) + "\n};\n"
class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass
class CPPPointerType(CPointerType, CPPType):
def getDeclarationTypeName( self ):
if self.getName() == "ptr" or self.getName() == "any":
return "void*"
else:
return self.getQualifiedName( "::" )
class CPPReferenceType(CReferenceType, CPPType): pass
class CPPSequenceType(CSequenceType, CPPCompoundType): pass
class CPPStringType(CStringType, CPPType):
def getDeclarationTypeName( self ): return "std::string"
class CPPBufferType(CBufferType, CPPType): pass
class CPPEnumeratedType(CEnumeratedType, CPPType):
def getDefaultValue( self ):
return self.getEnumerators()[0].getIdentifier()
class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass
class CPPModule(CModule, CPPConstruct):
def __repr__( self ):
return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), " " ) + "\n};\n"
class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass
class CPPPointerType(CPointerType, CPPType):
def getDeclarationTypeName( self ):
if self.getName() == "ptr" or self.getName() == "any":
return "void*"
else:
return self.getQualifiedName( "::" )
class CPPBoolType(CBoolType, CPPType):
def getDefaultValue( self ): return "false"
def getDummyValue( self ): return "false"
class CPPBufferType(CBufferType, CPPType): pass
class CPPEnumeratedType(CEnumeratedType, CPPType):
def getDefaultValue( self ):
return self.getEnumerators()[0].getIdentifier()
class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass
class CPPModule(CModule, CPPConstruct):
def __repr__( self ):
return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), " " ) + "\n};\n"
class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass
class CPPPointerType(CPointerType, CPPType):
def getDeclarationTypeName( self ):
if self.getName() == "ptr" or self.getName() == "any":
class CPPBoolType(CBoolType, CPPType):
def getDefaultValue( self ): return "false"
def getDummyValue( self ): return "false"
class CPPBufferType(CBufferType, CPPType): pass
class CPPEnumeratedType(CEnumeratedType, CPPType):
def getDefaultValue( self ):
return self.getEnumerators()[0].getIdentifier()
class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass
class CPPModule(CModule, CPPConstruct):
def __repr__( self ):
return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), " " ) + "\n};\n"
class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass
class CPPPointerType(CPointerType, CPPType):
def getDeclarationTypeName( self ):
return self.getEnumerators()[0].getIdentifier()
class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass
class CPPModule(CModule, CPPConstruct):
def __repr__( self ):
return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), " " ) + "\n};\n"
class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass
class CPPPointerType(CPointerType, CPPType):
def getDeclarationTypeName( self ):
if self.getName() == "ptr" or self.getName() == "any":
return "void*"
else:
return self.getQualifiedName( "::" )
class CPPReferenceType(CReferenceType, CPPType): pass
class CPPSequenceType(CSequenceType, CPPCompoundType): pass
class CPPStringType(CStringType, CPPType):