home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-12-01 | 102.0 KB | 3,987 lines |
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1997 by Cayenne Software, Inc.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software, Inc.
- #
- #---------------------------------------------------------------------------
- #
- # File : cppgclasses.tcl
- # Author :
- # Original date : November 1997
- # Description : Classes for code generation
- #
- #---------------------------------------------------------------------------
-
- #---------------------------------------------------------------------------
- # File: @(#)cppgtype.tcl /main/titanic/8
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGType : {Object} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- attribute loopCheck
- }
-
- constructor CppGType {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- $this loopCheck 0
- # End constructor user section
- return $this
- }
-
- method CppGType::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGType::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- return $errorCnt
- }
-
- method CppGType::checkLocal {this} {
- return 0
- }
-
- method CppGType::generate {this tgt} {
- m4_fatal $F_ABSTRACT "CppGType::generate"
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMType] {
- Class CppGTypeD : {CppGType CMType} {
- }
- } else {
- Class CppGTypeD : {CppGType OPType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPType) CppGTypeD
-
- selfPromoter OPType {this} {
- CppGTypeD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgfeatur.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGFeature : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGFeature {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGFeature::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGFeature::check {this} {
- return 0
- }
-
- method CppGFeature::generate {this class} {
- m4_fatal $F_ABSTRACT "CppGFeature::generate"
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMFeature] {
- Class CppGFeatureD : {CppGFeature CMFeature} {
- }
- } else {
- Class CppGFeatureD : {CppGFeature OPFeature} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPFeature) CppGFeatureD
-
- selfPromoter OPFeature {this} {
- CppGFeatureD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgattrib.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAttribute : {CppGFeature} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGAttribute {class this name} {
- set this [CppGFeature::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGAttribute::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGAttribute::check {this} {
- return 0
- }
-
- method CppGAttribute::generate {this class} {
- m4_fatal $F_ABSTRACT "CppGAttribute::generate"
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMAttribute] {
- Class CppGAttributeD : {CppGAttribute CMAttribute} {
- }
- } else {
- Class CppGAttributeD : {CppGAttribute OPAttribute} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAttribute) CppGAttributeD
-
- selfPromoter OPAttribute {this} {
- CppGAttributeD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppggenass.tcl /main/titanic/10
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGGenAssocAttr : {CppGAttribute} {
- constructor
- method destructor
- method getClassLibDef
- method check
- method generate
- method generator
- attribute _generator
- attribute cppAssocAttr
- }
-
- constructor CppGGenAssocAttr {class this name} {
- set this [CppGAttribute::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGGenAssocAttr::destructor {this} {
- set ref [$this _generator]
- if {$ref != ""} {
- $ref _assocAttr ""
- }
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGGenAssocAttr::getClassLibDef {this assocKind clss attr} {
- global cplusplusClassLib
- global cplusplusClassLibDefault
- set classLibName [$this getPropertyValue "assoc_impl"]
- if {($classLibName == "") || ($classLibName == "default")} {
- set classLibName $cplusplusClassLibDefault
- }
- set implStrat [$this getPropertyValue "assoc_strategy"]
- if {$implStrat == ""} {
- set implStrat "default"
- }
- set aKind $assocKind
- if [$this isOrdered] {
- set aKind "O${assocKind}"
- }
- if {![info exists cplusplusClassLib($classLibName)]} {
- m4_error $E_NOCLASSLIB $classLibName
- set classLibName "default"
- }
- set bestCl ""
- foreach {kind impl cl} $cplusplusClassLib($classLibName) {
- if {($kind == $aKind) && ($impl == $implStrat)} {
- return [$cl new $clss $attr]
- }
- if {$kind == $aKind} {
- set bestCl $cl
- }
- }
- if {$bestCl == ""} {
- m4_fatal $E_NOCLASSLIB "$classLibName/$aKind/$implStrat"
- exit
- } else {
- m4_error $E_NOCLASSLIB "$classLibName/$aKind/$implStrat"
- return [$bestCl new $clss $attr]
- }
- }
-
- method CppGGenAssocAttr::check {this} {
- set errCnt 0
- set opp ""
- set oppA [$this opposite]
- if {$oppA != ""} {
- set opp [$oppA ooplClass]
- if {$opp != ""} {
- if {[$oppA isMandatory] && [$this isMandatory]} {
- m4_error $E_MANDMAND \
- [[$this ooplClass] getName] [$opp getName]
- incr errCnt
- }
- }
- }
- set type [$this ooplType]
- if {$type != ""} {
- incr errCnt [$type check]
- }
-
- return $errCnt
- }
-
- method CppGGenAssocAttr::generate {this class} {
- if [$this check] {
- return
- }
- return [[$this generator] generate $class]
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMGenAssocAttr] {
- Class CppGGenAssocAttrD : {CppGGenAssocAttr CMGenAssocAttr} {
- }
- } else {
- Class CppGGenAssocAttrD : {CppGGenAssocAttr OPGenAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPGenAssocAttr) CppGGenAssocAttrD
-
- selfPromoter OPGenAssocAttr {this} {
- CppGGenAssocAttrD promote $this
- }
- method CppGGenAssocAttr::generator {this args} {
- if {$args == ""} {
- return [$this _generator]
- }
- set ref [$this _generator]
- if {$ref != ""} {
- $ref _assocAttr ""
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- $obj _assocAttr $this
- }
- $this _generator $obj
- }
-
- #---------------------------------------------------------------------------
- # File: @(#)cppglinkat.tcl /main/titanic/12
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGLinkAttr : {CppGGenAssocAttr} {
- constructor
- method destructor
- method setGenerator
- }
-
- constructor CppGLinkAttr {class this name} {
- set this [CppGGenAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGLinkAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGLinkAttr::setGenerator {this clss} {
- set ofPart ""
- if {[$this opposite] != ""} {
- set oClassName [[[$this opposite] ooplClass] getName]
- set ofPart "Of${oClassName}"
- }
- if {[$this getMultiplicity]=="one"} {
- set assImpl [CppGAssocOne new]
- $assImpl attrName "[$this getName]${ofPart}Ptr"
- $this generator $assImpl
- set cldef [$this getClassLibDef "Ptr" $clss $assImpl]
- } else {
- set assImpl [CppGAssocMany new]
- $assImpl attrName "[$this getName]${ofPart}Set"
- $this generator $assImpl
- set cldef [$this getClassLibDef "Set" $clss $assImpl]
- }
- $assImpl cldef $cldef
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMLinkAttr] {
- Class CppGLinkAttrD : {CppGLinkAttr CMLinkAttr} {
- }
- } else {
- Class CppGLinkAttrD : {CppGLinkAttr OPLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPLinkAttr) CppGLinkAttrD
-
- selfPromoter OPLinkAttr {this} {
- CppGLinkAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgparame.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGParameter : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGParameter {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGParameter::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGParameter::check {this} {
- return 0
- }
-
- method CppGParameter::generate {this method} {
- m4_fatal $F_ABSTRACT "CppGParameter::generate"
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMParameter] {
- Class CppGParameterD : {CppGParameter CMParameter} {
- }
- } else {
- Class CppGParameterD : {CppGParameter OPParameter} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPParameter) CppGParameterD
-
- selfPromoter OPParameter {this} {
- CppGParameterD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgassoca.tcl /main/titanic/11
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAssocAttr : {CppGGenAssocAttr} {
- constructor
- method destructor
- method setGenerator
- }
-
- constructor CppGAssocAttr {class this name} {
- set this [CppGGenAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGAssocAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGAssocAttr::setGenerator {this clss} {
- if {[$this getMultiplicity]=="one"} {
- set assImpl [CppGAssocOne new]
- $assImpl attrName "[$this getName]Ptr"
- $this generator $assImpl
- set cldef [$this getClassLibDef "Ptr" $clss $assImpl]
- } else {
- set assImpl [CppGAssocMany new]
- $assImpl attrName "[$this getName]Set"
- $this generator $assImpl
- set cldef [$this getClassLibDef "Set" $clss $assImpl]
- }
- $assImpl cldef $cldef
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMAssocAttr] {
- Class CppGAssocAttrD : {CppGAssocAttr CMAssocAttr} {
- }
- } else {
- Class CppGAssocAttrD : {CppGAssocAttr OPAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAssocAttr) CppGAssocAttrD
-
- selfPromoter OPAssocAttr {this} {
- CppGAssocAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgassocg.tcl /main/titanic/15
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAssocGen : {GCObject} {
- constructor
- method destructor
- method check
- method checkLocal
- method getTypeDef
- method generate
- method generateInclude
- method generateSet
- method generateGet
- method generateAdd
- method generateRemove
- method generateCtor
- method generateDtor
- method assocAttr
- attribute attrName
- attribute attrType
- attribute cldef
- attribute _assocAttr
- }
-
- constructor CppGAssocGen {class this} {
- set this [GCObject::constructor $class $this]
- # Start constructor user section
- $this attrName ""
- $this attrType ""
- # End constructor user section
- return $this
- }
-
- method CppGAssocGen::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGAssocGen::check {this} {
- set errCnt 0
- incr errCnt [$this checkLocal]
- return $errCnt
- }
-
- method CppGAssocGen::checkLocal {this} {
- return 0
- }
-
- method CppGAssocGen::getTypeDef {this} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generate {this class} {
- if [$this checkLocal] {
- return
- }
- set opp ""
- set oppA [[$this assocAttr] opposite]
- if {$oppA != ""} {
- set opp [$oppA ooplClass]
- }
- set type [$this getTypeDef]
- set attr [CppAssocAttrib new $class Private $type]
- $attr comment [[$this assocAttr] getPropertyValue "freeText"]
- if {[$this attrName] == "" } {
- $this attrName [[$this assocAttr] getName]
- }
- if {[$this attrType] == ""} {
- set attrTypeObj [[[$this assocAttr] ooplType] generate [$class model]]
- $attrTypeObj isReference 0
- $attrTypeObj isPointer 0
- $this attrType [$attrTypeObj getTypeName cpp $class]
- }
- $attr name [$this attrName]
- [$this assocAttr] cppAssocAttr $attr
-
- if {$opp != ""} {
- set tgt [$class model]
- set oppcl [ $tgt findDefinition [$opp getName] ]
- if { $oppcl == "" } {
- set oppcl [ $opp generate $tgt ]
- $oppcl isSynthetic 1
- }
-
- $class addFriendClass $oppcl
- }
-
- $this generateInclude $class
- $this generateSet $class
- $this generateGet $class
- $this generateAdd $class
- $this generateRemove $class
- $this generateCtor $class
- $this generateDtor $class
-
- return $attr
- }
-
- method CppGAssocGen::generateInclude {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generateSet {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generateGet {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generateAdd {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generateRemove {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generateCtor {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- method CppGAssocGen::generateDtor {this class} {
- # Dummy function, should be overloaded in a sub class (when needed)
- }
-
- # Do not delete this line -- regeneration end marker
-
- method CppGAssocGen::assocAttr {this args} {
- if {$args == ""} {
- return [$this _assocAttr]
- }
- set ref [$this _assocAttr]
- if {$ref != ""} {
- $ref _generator ""
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- $obj _generator $this
- }
- $this _assocAttr $obj
- }
-
- #---------------------------------------------------------------------------
- # File: @(#)cppgassoci.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAssocInitializer : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGAssocInitializer {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGAssocInitializer::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGAssocInitializer::check {this} {
- return 0
- }
-
- method CppGAssocInitializer::generate {this ctor} {
- # No initializers are generated, all initializing is
- # done in the constructor
- # [[$this assoc] generator] generateInitializer $this $ctor
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMAssocInitializer] {
- Class CppGAssocInitializerD : {CppGAssocInitializer CMAssocInitializer} {
- }
- } else {
- Class CppGAssocInitializerD : {CppGAssocInitializer OPAssocInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAssocInitializer) CppGAssocInitializerD
-
- selfPromoter OPAssocInitializer {this} {
- CppGAssocInitializerD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgattrin.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAttrInitializer : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGAttrInitializer {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGAttrInitializer::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGAttrInitializer::check {this} {
- return 0
- }
-
- method CppGAttrInitializer::generate {this ctor} {
-
- set attr [$this attrib]
- set class [$ctor cl]
- set type [[$attr ooplType] generate [$class model]]
-
- if { [$type name] == "char" && [$type isArray] } {
- $class addExtIncl "string.h"
- set ctorSect [CppGenCode new $ctor]
- $ctorSect append "strcpy ([$attr getName], [$this getName]);\n"
- } else {
- set init [CppInitializer new $ctor]
- $init name [$attr getName]
-
- # Create value for this initializer
- set initVal [CppInitValue new $init]
- $initVal value [$this getName]
- return $init
- }
- return ""
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMAttribInitializer] {
- Class CppGAttrInitializerD : {CppGAttrInitializer CMAttribInitializer} {
- }
- } else {
- Class CppGAttrInitializerD : {CppGAttrInitializer OPAttribInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPAttribInitializer) CppGAttrInitializerD
-
- selfPromoter OPAttribInitializer {this} {
- CppGAttrInitializerD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgbasety.tcl /main/titanic/6
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGBaseType : {CppGType} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGBaseType {class this name} {
- set this [CppGType::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGBaseType::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGBaseType::check {this} {
- return 0
- }
-
- method CppGBaseType::generate {this tgt} {
- set type [CppType new]
- set type3gl [$this getType3GL]
- if [regexp {(var)?char\[[0-9][0-9]*]} $type3gl] {
- regsub {(var)?([^\[]*)\[([0-9][0-9]*)]} $type3gl {\2} name
- $type name $name
- regsub {([^\[]*)\[([0-9][0-9]*)]} $type3gl {\2} size
- if { $name == "char" } {
- $type arraySize [expr $size + 1]
- } else {
- $type arraySize $size
- }
- } else {
- $type name $type3gl
- }
- return $type
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMBaseType] {
- Class CppGBaseTypeD : {CppGBaseType CMBaseType} {
- }
- } else {
- Class CppGBaseTypeD : {CppGBaseType OPBaseType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPBaseType) CppGBaseTypeD
-
- selfPromoter OPBaseType {this} {
- CppGBaseTypeD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgclass.tcl /main/titanic/17
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGClass : {Object} {
- constructor
- method destructor
- method check
- method checkLocal
- method checkLoop
- method generate
- attribute loopTrace
- attribute checkStatus
- }
-
- constructor CppGClass {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGClass::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGClass::check {this} {
- if {[$this checkStatus] != ""} {
- return [$this checkStatus]
- }
- set errorCnt 0
- $this checkStatus 0
- if {[$this checkLoop] == 1} {
- incr errorCnt
- } else {
- foreach feature [$this featureSet] {
- incr errorCnt [$feature check]
- }
- foreach genNode [$this genNodeSet] {
- incr errorCnt [$genNode check]
- }
- }
- $this checkStatus $errorCnt
- return $errorCnt
- }
-
- method CppGClass::checkLocal {this} {
- set errorCnt 0
- incr errorCnt [$this checkLoop]
- return $errorCnt
- }
-
- method CppGClass::checkLoop {this {recursiveCall 0}} {
- if {[$this loopTrace] == 1} {
- return 1
- }
- $this loopTrace 1
- foreach genNode [$this genNodeSet] {
- set super [$genNode superClass]
- if {[$super checkLoop 1] == 1} {
- $this loopTrace 0
- return 1
- }
- }
- foreach assocAttr [$this genAssocAttrSet] {
- if [$assocAttr isMandatory] {
- set type [$assocAttr ooplType]
- if {$type != ""} {
- if [$type isA OPClassType] {
- set otherClass [$type ooplClass]
- if {$otherClass != ""} {
- if {[$otherClass checkLoop 1] == 1} {
- if {$recursiveCall == 0} {
- m4_error $E_ASSOCLOOP [$this getName]
- }
- $this loopTrace 0
- return 1
- }
- }
- }
- }
- }
- }
- $this loopTrace 0
- return 0
- }
-
- method CppGClass::generate {this tgt} {
- if {[$this checkLocal] > 0} {
- set cl [ $tgt findDefinition [$this getName] ]
- if {$cl == ""} {
- set cl [CppClass new $this $tgt]
- }
- $cl isSynthetic 1
- return $cl
- }
-
- set cl [ $tgt findDefinition [$this getName] ]
- if { $cl == "" } {
- set cl [CppClass new $this $tgt]
- $cl isSynthetic 0
- } else {
- $cl isSynthetic 0
- return $cl
- }
-
- $cl comment [$this getPropertyValue "freeText"]
-
- # Generate destructor
- set type [CppType new]
- set dtor [CppDestructor new $cl "Public" $type]
-
- set dynDtor 0
-
- foreach genAssocAttr [$this genAssocAttrSet] {
- $genAssocAttr setGenerator $cl
- }
-
- set ctor [$this constructor]
- if {$ctor != ""} {
- $ctor generate $cl
- }
-
- foreach dataAttr [$this dataAttrSet] {
- $dataAttr generate $cl
- }
-
- foreach genAssocAttr [$this genAssocAttrSet] {
- $genAssocAttr generate $cl
- }
-
- foreach operation [$this operationSet] {
- $operation generate $cl
- if [$operation isDynBound] {
- set dynDtor 1
- }
- }
-
- foreach genNode [$this genNodeSet] {
- $genNode generate $cl
- }
-
- if {[llength [$this specNodeSet]] > 0} {
- set dynDtor 1
- }
-
- switch [$this getPropertyValue "has_dyn_dtor"] {
- yes { set dynDtor 1 }
- no { set dynDtor 0 }
- }
-
- $dtor isDynamic $dynDtor
-
- return $cl
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClass] {
- Class CppGClassD : {CppGClass CMClass} {
- }
- } else {
- Class CppGClassD : {CppGClass OPClass} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClass) CppGClassD
-
- selfPromoter OPClass {this} {
- CppGClassD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgclasst.tcl /main/titanic/11
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGClassType : {CppGType} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGClassType {class this name} {
- set this [CppGType::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGClassType::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGClassType::check {this} {
- set errorCnt 0
- if {[$this ooplClass] != ""} {
- incr errorCnt [[$this ooplClass] check]
- }
- return $errorCnt
- }
-
- method CppGClassType::checkLocal {this} {
- set errorCnt 0
- return $errorCnt
- }
-
- method CppGClassType::generate {this tgt} {
- set type [CppType new]
- if {[$this checkLocal] > 0} {
- return $type
- }
- set oClass [$this ooplClass]
- if { $oClass == "" } {
- $type name [$this getType3GL]
- } else {
- set cl [$tgt findDefinition [$oClass getName]]
- if { $cl == "" } {
- set cl [$oClass generate $tgt]
- $cl isSynthetic 1
- }
- $type localType $cl
- }
- return $type
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassType] {
- Class CppGClassTypeD : {CppGClassType CMClassType} {
- }
- } else {
- Class CppGClassTypeD : {CppGClassType OPClassType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassType) CppGClassTypeD
-
- selfPromoter OPClassType {this} {
- CppGClassTypeD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgclenum.tcl /main/titanic/9
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGClEnum : {CppGClass} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGClEnum {class this name} {
- set this [CppGClass::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGClEnum::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGClEnum::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- foreach feat [$this featureSet] {
- incr errorCnt [$feat check]
- }
- return $errorCnt
- }
-
- method CppGClEnum::checkLocal {this} {
- return 0
- }
-
- method CppGClEnum::generate {this tgt} {
- set cl [ $tgt findDefinition [ $this getName ] ]
- if {$cl != ""} {
- $cl isSynthetic 0
- } else {
- set cl [CppEnum new $this $tgt]
- $cl isSynthetic 0
- $cl name [ $this getName ]
- $cl comment [ $this getPropertyValue "freeText" ]
- foreach feat [$this featureSet] {
- set item [CppEnumItem new $cl]
- $item item [$feat getName]
- $item value [$feat getPropertyValue initial_value]
- $item comment [$feat getPropertyValue "freeText"]
- }
- }
- return $cl
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassEnum] {
- Class CppGClEnumD : {CppGClEnum CMClassEnum} {
- }
- } else {
- Class CppGClEnumD : {CppGClEnum OPClassEnum} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassEnum) CppGClEnumD
-
- selfPromoter OPClassEnum {this} {
- CppGClEnumD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgclgent.tcl /main/titanic/14
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGClGenTDef : {CppGClass} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGClGenTDef {class this name} {
- set this [CppGClass::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGClGenTDef::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGClGenTDef::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- if {[$this loopTrace] == 1} {
- m4_error $E_REFERTYPED [$this getName]
- incr errorCnt
- } else {
- $this loopTrace 1
- set assoc [lindex [$this genAssocAttrSet] 0]
- if {$assoc != ""} {
- incr errorCnt [$assoc check]
- } else {
- incr errorCnt
- }
- $this loopTrace 0
- }
- return $errorCnt
- }
-
- method CppGClGenTDef::checkLocal {this} {
- return 0
- }
-
- method CppGClGenTDef::generate {this tgt} {
- set typeDef [$tgt findDefinition [$this getName]]
- if {$typeDef != ""} {
- if [$typeDef isSynthetic] {
- $typeDef isSynthetic 0
- } else {
- m4_error $E_EXISTS [$this getName]
- }
- } else {
- if {[$this check] > 0} {
- set typeDef [CppTypeDef new $this $tgt [CppType new]]
- $typeDef isSynthetic 1
- } else {
- # faking type, will set it right after setGenerator
- set typeDef [CppTypeDef new $this $tgt ""]
- set assoc [lindex [$this genAssocAttrSet] 0]
- $assoc setGenerator $typeDef
- set type [[$assoc generator] getTypeDef]
- $typeDef type $type
- $typeDef isSynthetic 0
- $typeDef comment [$this getPropertyValue "freeText"]
- $typeDef name [$this getName]
- [$assoc generator] generateInclude $typeDef
- }
- }
- return $typeDef
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassGenericTypeDef] {
- Class CppGClGenTDefD : {CppGClGenTDef CMClassGenericTypeDef} {
- }
- } else {
- Class CppGClGenTDefD : {CppGClGenTDef OPClassGenericTypeDef} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassGenericTypeDef) CppGClGenTDefD
-
- selfPromoter OPClassGenericTypeDef {this} {
- CppGClGenTDefD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgcltdef.tcl /main/titanic/10
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGClTDef : {CppGClass} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGClTDef {class this name} {
- set this [CppGClass::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGClTDef::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGClTDef::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- if {[$this loopTrace] == 1} {
- m4_error $E_REFERTYPED [$this getName]
- incr errorCnt
- } else {
- $this loopTrace 1
- if {[$this dataAttrSet] != ""} {
- set feat [lindex [$this dataAttrSet] 0]
- incr errorCnt [[$feat ooplType] check]
- }
- $this loopTrace 0
- }
- return $errorCnt
- }
-
- method CppGClTDef::checkLocal {this} {
- if {[$this dataAttrSet] == ""} {
- return 1
- }
- return 0
- }
-
- method CppGClTDef::generate {this tgt} {
- if {[$this checkLocal] > 0} {
- set cl [CppTypeDef new $this $tgt [CppType new]]
- $cl isSynthetic 1
- return $cl
- }
- set cl [ $tgt findDefinition [ $this getName ] ]
- if {$cl == ""} {
- set feat [lindex [$this dataAttrSet] 0]
- set type [[$feat ooplType] generate $tgt]
- set cl [CppTypeDef new $this $tgt $type]
- $cl name [ $this getName ]
- $cl comment [ $this getPropertyValue "freeText" ]
- }
- $cl isSynthetic 0
- return $cl
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMClassTDef] {
- Class CppGClTDefD : {CppGClTDef CMClassTDef} {
- }
- } else {
- Class CppGClTDefD : {CppGClTDef OPClassTDef} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPClassTDef) CppGClTDefD
-
- selfPromoter OPClassTDef {this} {
- CppGClTDefD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgconstr.tcl /main/titanic/8
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGConstructor : {CppGFeature} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGConstructor {class this name} {
- set this [CppGFeature::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGConstructor::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGConstructor::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- foreach param [[$this ooplClass] fullCreationParamSet] {
- incr errorCnt [$param check]
- }
- foreach initializer [$this fullInitializerSet] {
- incr errorCnt [$initializer check]
- }
- return $errorCnt
- }
-
- method CppGConstructor::checkLocal {this} {
- set errorCnt 0
- return $errorCnt
- }
-
- method CppGConstructor::generate {this class} {
- if {[$this checkLocal] > 0} {
- return [CppConstructor new $class "Private" [CppType new]]
- }
- # class is the Cpp target class of this ctor
- set access [$this getPropertyValue "method_access"]
- set type [CppType new]
- set ctor [CppConstructor new $class $access $type]
- $ctor comment [$this getPropertyValue "freeText"]
-
- foreach param [[$this ooplClass] fullCreationParamSet] {
- $param generate $ctor
- }
-
- foreach initializer [$this fullInitializerSet] {
- $initializer generate $ctor
- }
- return $ctor
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMConstructor] {
- Class CppGConstructorD : {CppGConstructor CMConstructor} {
- }
- } else {
- Class CppGConstructorD : {CppGConstructor OPConstructor} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPConstructor) CppGConstructorD
-
- selfPromoter OPConstructor {this} {
- CppGConstructorD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgctorpa.tcl /main/titanic/10
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGCtorParameter : {CppGParameter} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGCtorParameter {class this name} {
- set this [CppGParameter::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGCtorParameter::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGCtorParameter::check {this} {
- set errorCnt 0
- incr errorCnt [[$this ooplType] check]
- return $errorCnt
- }
-
- method CppGCtorParameter::generate {this method} {
- set type [[$this ooplType] generate [[$method cl] model]]
- switch [$this getPropertyValue "modifier"] {
- "Value" {}
- "Pointer" { $type isPointer 1 }
- "Reference" { $type isReference 1 }
- "Pointer to Const" { $type isPointer 1 ; $type isConst 1 }
- "Reference to Const" { $type isReference 1 ; $type isConst 1 }
- default { if {[$type localType]!=""} {$type isReference 1 ; $type isConst 1} }
- }
- set param [CppParam new $type $method]
- $param name [$this getName]
- set defaultValue [$this getPropertyValue "default_value"]
- set attrib [$this attrib]
- if {($defaultValue == "") && ($attrib != "")} {
- set defaultValue [$attrib getInitialValue]
- }
- $param defaultValue $defaultValue
- return $param
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMCtorParameter] {
- Class CppGCtorParameterD : {CppGCtorParameter CMCtorParameter} {
- }
- } else {
- Class CppGCtorParameterD : {CppGCtorParameter OPCtorParameter} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPCtorParameter) CppGCtorParameterD
-
- selfPromoter OPCtorParameter {this} {
- CppGCtorParameterD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdataat.tcl /main/titanic/16
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDataAttr : {CppGAttribute} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGDataAttr {class this name} {
- set this [CppGAttribute::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDataAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGDataAttr::check {this} {
- set errorCnt 0
- if {(![$this isNullable]) && ([$this getInitialValue]!="")} {
- set clName [[$this ooplClass] getName]
- set attrName [$this getName]
- m4_warning $W_NONULLDEFAULT $clName $attrName
- }
- incr errorCnt [[$this ooplType] check]
- return $errorCnt
- }
-
- method CppGDataAttr::generate {this class} {
- set type [[$this ooplType] generate [$class model]]
- set accessTxt [$this getPropertyValue "attrib_access"]
- set visibility [$this getPropertyValue "attrib_visibility"]
- if {$visibility == ""} {
- set visibility "Private"
- }
- set attr [CppUserAttrib new $class $visibility $type]
- $attr name [$this getName]
- $attr comment [$this getFreeText]
- set defValue [$this getInitialValue]
- if {![$this isNullable] && ($defValue!="")} {
- set defValue ""
- m4_warning $W_NONULLDEFAULT [$class name] [$attr name]
- }
- if {$defValue != ""} {
- $attr defaultValue $defValue
- if {! [$this isClassFeature]} {
- set ctor ""
- [$class featureSet] foreach feature {
- if [$feature isA CppConstructor] {
- set ctor $feature
- break
- }
- }
-
- if {$ctor != ""} {
- if {[$type name] == "char" && [$type isArray] } {
- $class addExtIncl "string.h"
- set ctorSect [CppGenCode new $ctor]
- $ctorSect append "strcpy ([$this getName], $defValue);\n"
- } else {
- set init [CppInitializer new $ctor]
- $init name [$this getName]
- set initVal [CppInitValue new $init]
- if [regexp {\((.*)\)} $defValue mtv expression] {
- $initVal value $expression
- } else {
- $initVal value $defValue
- }
- }
- }
- }
- }
-
- # generate get and set methods
- set firstUp [string toupper [string range [$attr name] 0 0]]
- set uName "${firstUp}[string range [$attr name] 1 end]"
-
- set accessList [split $accessTxt -]
- set readAccess [lindex $accessList 0]
- if {$readAccess == ""} {
- set readAccess "Public"
- }
- if {$readAccess != "None"} {
- set getType [[$this ooplType] generate [$class model]]
- set getMethd [CppAccMethod new $class $readAccess $getType $attr]
- $getMethd name [$getMethd getMethodName "attrib-get" [$attr name]]
- $getMethd isConst 1
- $getMethd isInline 1
- $getMethd kind "get"
-
- set getGenCodeSect [CppGenCode new $getMethd]
- $getGenCodeSect append "return [$attr name];\n"
- if [$this isClassFeature] {
- $getType isStatic 1
- $getMethd isConst 0
- }
- }
-
- set writeAccess [lindex $accessList 1]
- if {$writeAccess == ""} {
- set writeAccess "Public"
- }
- if {$writeAccess != "None"} {
- set setType [CppType new]
- set setMethd [CppAccMethod new $class $writeAccess $setType $attr]
- $setMethd name [$setMethd getMethodName "attrib-set" [$attr name]]
- $setMethd isInline 1
- $setMethd kind "set"
-
- set setPType [[$this ooplType] generate [$class model]]
- set setParam [CppParam new $setPType $setMethd]
- $setParam name "new${uName}"
-
- set setGenCodeSect [CppGenCode new $setMethd]
- if { [$type name] == "char" && [$type isArray] } {
- $class addExtIncl "string.h"
- $setGenCodeSect append "strcpy ([$attr name], new${uName});\n"
- } else {
- $setGenCodeSect append "[$attr name] = new${uName};\n"
- }
- if [$this isClassFeature] {
- $setType isStatic 1
- }
- }
-
- if [$this isClassFeature] {
- $type isStatic 1
- }
- return $attr
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDataAttr] {
- Class CppGDataAttrD : {CppGDataAttr CMDataAttr} {
- }
- } else {
- Class CppGDataAttrD : {CppGDataAttr OPDataAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDataAttr) CppGDataAttrD
-
- selfPromoter OPDataAttr {this} {
- CppGDataAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgenumty.tcl /main/titanic/9
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGEnumType : {CppGType} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGEnumType {class this name} {
- set this [CppGType::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGEnumType::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGEnumType::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- return $errorCnt
- }
-
- method CppGEnumType::checkLocal {this} {
- if {[$this ooplClass] == ""} {
- return 1
- }
- return 0
- }
-
- method CppGEnumType::generate {this tgt} {
- if {[$this checkLocal] > 0} {
- return ""
- }
- set cl [$tgt findDefinition [[$this ooplClass] getName]]
- if {$cl == ""} {
- set cl [[$this ooplClass] generate $tgt]
- $cl isSynthetic 1
- }
- set type [CppType new]
- $type localType $cl
- return $type
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMEnumType] {
- Class CppGEnumTypeD : {CppGEnumType CMEnumType} {
- }
- } else {
- Class CppGEnumTypeD : {CppGEnumType OPEnumType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPEnumType) CppGEnumTypeD
-
- selfPromoter OPEnumType {this} {
- CppGEnumTypeD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppginhgro.tcl /main/titanic/11
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGInhGroup : {Object} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGInhGroup {class this} {
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGInhGroup::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGInhGroup::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- set super [$this superClass]
- if {$super != ""} {
- incr errorCnt [$super check]
- }
- return $errorCnt
- }
-
- method CppGInhGroup::checkLocal {this} {
- return 0
- }
-
- method CppGInhGroup::generate {this cl} {
- # Note that cl is our sub class
- set accessTxt [$this getPropertyValue "inher_access"]
- set access "public"
- switch $accessTxt {
- "Public" {set access "public"}
- "Protected" {set access "protected"}
- "Private" {set access "private"}
- default {set access "public"}
- }
- set tgt [$cl model]
-
- set super [$this superClass]
- set supercl [$tgt findDefinition [$super getName]]
- if {$supercl == ""} {
- set supercl [$super generate $tgt]
- $supercl isSynthetic 1
- }
- set gen [CppGen new $supercl $access]
- if [$this isOverlapping] {
- $gen isVirtual 1
- }
- $cl addGen $gen
- return $gen
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMInhGroup] {
- Class CppGInhGroupD : {CppGInhGroup CMInhGroup} {
- }
- } else {
- Class CppGInhGroupD : {CppGInhGroup OPInhGroup} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPInhGroup) CppGInhGroupD
-
- selfPromoter OPInhGroup {this} {
- CppGInhGroupD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppginhkey.tcl /main/titanic/2
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGInhKeyInitializer : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGInhKeyInitializer {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGInhKeyInitializer::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGInhKeyInitializer::check {this} {
- return 0
- }
-
- method CppGInhKeyInitializer::generate {this ctor} {
- # empty
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMInhKeyInitializer] {
- Class CppGInhKeyInitializerD : {CppGInhKeyInitializer CMInhKeyInitializer} {
- }
- } else {
- Class CppGInhKeyInitializerD : {CppGInhKeyInitializer OPInhKeyInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPInhKeyInitializer) CppGInhKeyInitializerD
-
- selfPromoter OPInhKeyInitializer {this} {
- CppGInhKeyInitializerD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppglinkcl.tcl /main/titanic/8
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGLinkClass : {CppGClass} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGLinkClass {class this name} {
- set this [CppGClass::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGLinkClass::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGLinkClass::check {this} {
- return [$this CppGClass::check]
- }
-
- method CppGLinkClass::checkLocal {this} {
- return 0
- }
-
- method CppGLinkClass::generate {this tgt} {
- return [$this CppGClass::generate $tgt]
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMLinkClass] {
- Class CppGLinkClassD : {CppGLinkClass CMLinkClass} {
- }
- } else {
- Class CppGLinkClassD : {CppGLinkClass OPLinkClass} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPLinkClass) CppGLinkClassD
-
- selfPromoter OPLinkClass {this} {
- CppGLinkClassD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgoperat.tcl /main/titanic/15
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGOperation : {CppGFeature} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGOperation {class this name} {
- set this [CppGFeature::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGOperation::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGOperation::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- foreach param [$this parameterSet] {
- incr errorCnt [$param check]
- }
- return $errorCnt
- }
-
- method CppGOperation::checkLocal {this} {
- set errorCnt 0
- if {[$this getName] == [[$this ooplClass] getName]} {
- m4_warning $W_USECTOR [[$this ooplClass] getName]
- }
- if {[$this isClassFeature] &&
- ([$this isAbstract] || [$this isDynBound])} {
- set name [[$this ooplClass] getName]::[$this getName]
- m4_error $E_STATICABSTRACT $name
- incr errorCnt
- }
- return $errorCnt
- }
-
- method CppGOperation::generate {this class} {
- set operationNameMap {
- {"operatorDIV" "operator/"}
- {"operatorPLUS" "operator+"}
- {"operatorMIN" "operator-"}
- {"operatorASSIGN" "operator="}
- {"operatorASS_PLUS" "operator+="}
- {"operatorASS_MIN" "operator-="}
- {"operatorASS_STAR" "operator*="}
- {"operatorASS_DIV" "operator/="}
- {"operatorASS_MOD" "operator%="}
- {"operatorASS_CIRCUM" "operator^="}
- {"operatorASS_AMPER" "operator&="}
- {"operatorASS_PIPE" "operator|="}
- {"operatorASS_LSHIFT" "operator<<="}
- {"operatorASS_RSHIFT" "operator>>="}
- {"operatorEQ" "operator=="}
- {"operatorNEQ" "operator!="}
- {"operatorLE" "operator<="}
- {"operatorGE" "operator>="}
- {"operatorCOMMA" "operator,"}
- {"operatorFUNC" "operator()"}
- {"operatornew" "operator new"}
- {"operatorNEW" "operator new"}
- {"operatordelete" "operator delete"}
- {"operatorDELETE" "operator delete"}
- }
-
- if {[$this checkLocal] > 0} {
- set mthd [CppUserMethod new $class "Private" [CppType new]]
- $mthd name [$this getName]
- return $mthd
- }
-
- set access [$this getPropertyValue method_access]
- if {$access == ""} {
- set access "Public"
- }
-
- set oType [$this ooplType]
- if {$oType != ""} {
- set returnType [$oType generate [$class model]]
- } else {
- set returnType [CppType new]
- $returnType name "void"
- }
-
- switch [$this getPropertyValue "modifier"] {
- "Default" { if {[$returnType localType]!=""} {$type isReference 1} }
- "Value" {}
- "Pointer" { $returnType isPointer 1 }
- "Reference" { $returnType isReference 1 }
- "Pointer to Const" { $returnType isPointer 1 ; $returnType isConst 1 }
- "Reference to Const" { $returnType isReference 1 ; $returnType isConst 1 }
- "Other" { $returnType otherModifier [$this getPropertyValue "other_modifier"] }
- }
-
- if {[$this getName] == "type_conv"} {
- set mthd [CppUserMethod new $class $access ""]
- $mthd name [$this getName]
- } else {
- set mthd [CppUserMethod new $class $access $returnType]
- $mthd name [$this getName]
- }
-
- foreach onmap $operationNameMap {
- if {[lindex $onmap 0] == [$this getName]} {
- $mthd name [lindex $onmap 1]
- break
- }
- }
-
- $returnType isStatic [$this isClassFeature]
-
- if {[$this getName] == "type_conv"} {
- $returnType isConst 0
- $mthd name "operator [$returnType getTypeName {} {}]"
- }
-
- $mthd isConst [$this isConstFunc]
- $mthd isDynamic [$this isDynBound]
- $mthd isAbstract [$this isAbstract]
- $mthd comment [$this getPropertyValue "freeText"]
-
- if {[$this getPropertyValue "inline_method"] == "1"} {
- $mthd isInline 1
- }
-
- foreach param [$this parameterSet] {
- $param generate $mthd
- }
-
- return $mthd
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMOperation] {
- Class CppGOperationD : {CppGOperation CMOperation} {
- }
- } else {
- Class CppGOperationD : {CppGOperation OPOperation} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPOperation) CppGOperationD
-
- selfPromoter OPOperation {this} {
- CppGOperationD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgoperpa.tcl /main/titanic/11
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGOperParameter : {CppGParameter} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGOperParameter {class this name} {
- set this [CppGParameter::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGOperParameter::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGOperParameter::check {this} {
- set errorCnt 0
- incr errorCnt [[$this ooplType] check]
- return $errorCnt
- }
-
- method CppGOperParameter::generate {this method} {
- set type [[$this ooplType] generate [[$method cl] model]]
- set param [CppParam new $type $method]
- switch [$this getPropertyValue "modifier"] {
- "Default" { if {[$type localType]!=""} {$type isReference 1 ; $type isConst 1} }
- "Value" {}
- "Pointer" { $type isPointer 1 }
- "Reference" { $type isReference 1 }
- "Pointer to Const" { $type isPointer 1 ; $type isConst 1 }
- "Reference to Const" { $type isReference 1 ; $type isConst 1 }
- "Other" { $type otherModifier [$this getPropertyValue "other_modifier"] }
- }
- $param name [$this getName]
- $param defaultValue [$this getPropertyValue "default_value"]
- $param comment [$this getPropertyValue "freeText"]
- return $param
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMOperParameter] {
- Class CppGOperParameterD : {CppGOperParameter CMOperParameter} {
- }
- } else {
- Class CppGOperParameterD : {CppGOperParameter OPOperParameter} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPOperParameter) CppGOperParameterD
-
- selfPromoter OPOperParameter {this} {
- CppGOperParameterD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgqualas.tcl /main/titanic/11
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGQualAssocAttr : {CppGGenAssocAttr} {
- constructor
- method destructor
- method setGenerator
- }
-
- constructor CppGQualAssocAttr {class this name} {
- set this [CppGGenAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGQualAssocAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGQualAssocAttr::setGenerator {this clss} {
- if {[$this getMultiplicity]=="one"} {
- set assImpl [CppGOneQual new]
- $assImpl attrName "[$this getName]Dict"
- $this generator $assImpl
- set cldef [$this getClassLibDef "Dict" $clss $assImpl]
- } else {
- set assImpl [CppGManyQual new]
- $assImpl attrName "[$this getName]DictSet"
- $this generator $assImpl
- set cldef [$this getClassLibDef "SetDict" $clss $assImpl]
- }
- $assImpl cldef $cldef
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMQualAssocAttr] {
- Class CppGQualAssocAttrD : {CppGQualAssocAttr CMQualAssocAttr} {
- }
- } else {
- Class CppGQualAssocAttrD : {CppGQualAssocAttr OPQualAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualAssocAttr) CppGQualAssocAttrD
-
- selfPromoter OPQualAssocAttr {this} {
- CppGQualAssocAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgqualin.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGQualInitializer : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGQualInitializer {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGQualInitializer::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGQualInitializer::check {this} {
- return 0
- }
-
- method CppGQualInitializer::generate {this ctor} {
- # No initializer is created for the keys of qual assocs
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMQualInitializer] {
- Class CppGQualInitializerD : {CppGQualInitializer CMQualInitializer} {
- }
- } else {
- Class CppGQualInitializerD : {CppGQualInitializer OPQualInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualInitializer) CppGQualInitializerD
-
- selfPromoter OPQualInitializer {this} {
- CppGQualInitializerD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgqualli.tcl /main/titanic/11
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGQualLinkAttr : {CppGGenAssocAttr} {
- constructor
- method destructor
- method setGenerator
- }
-
- constructor CppGQualLinkAttr {class this name} {
- set this [CppGGenAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGQualLinkAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGQualLinkAttr::setGenerator {this clss} {
- set ofPart ""
- if {[$this opposite] != ""} {
- set oClassName [[[$this opposite] ooplClass] getName]
- set ofPart "Of${oClassName}"
- }
- if {[$this getMultiplicity]=="one"} {
- set assImpl [CppGOneQual new]
- $assImpl attrName "[$this getName]${ofPart}Dict"
- $this generator $assImpl
- set cldef [$this getClassLibDef "Dict" $clss $assImpl]
- } else {
- set assImpl [CppGManyQual new]
- $assImpl attrName "[$this getName]${ofPart}DictSet"
- $this generator $assImpl
- set cldef [$this getClassLibDef "SetDict" $clss $assImpl]
- }
- $assImpl cldef $cldef
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMQualLinkAttr] {
- Class CppGQualLinkAttrD : {CppGQualLinkAttr CMQualLinkAttr} {
- }
- } else {
- Class CppGQualLinkAttrD : {CppGQualLinkAttr OPQualLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPQualLinkAttr) CppGQualLinkAttrD
-
- selfPromoter OPQualLinkAttr {this} {
- CppGQualLinkAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgrevers.tcl /main/titanic/10
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGReverseLinkAttr : {CppGGenAssocAttr} {
- constructor
- method destructor
- method setGenerator
- }
-
- constructor CppGReverseLinkAttr {class this name} {
- set this [CppGGenAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGReverseLinkAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGReverseLinkAttr::setGenerator {this clss} {
- set assImpl [CppGAssocOne new]
- $assImpl attrName "[$this getName]Ptr"
- $this generator $assImpl
- set opp [$this opposite]
- if {$opp == ""} {
- set opp $this
- }
- set cldef [$opp getClassLibDef "Ptr" $clss $assImpl]
- $assImpl cldef $cldef
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMReverseLinkAttr] {
- Class CppGReverseLinkAttrD : {CppGReverseLinkAttr CMReverseLinkAttr} {
- }
- } else {
- Class CppGReverseLinkAttrD : {CppGReverseLinkAttr OPReverseLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPReverseLinkAttr) CppGReverseLinkAttrD
-
- selfPromoter OPReverseLinkAttr {this} {
- CppGReverseLinkAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgsuperc.tcl /main/titanic/7
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGSuperClassInitializer : {Object} {
- constructor
- method destructor
- method check
- method generate
- }
-
- constructor CppGSuperClassInitializer {class this name} {
- set this [Object::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGSuperClassInitializer::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGSuperClassInitializer::check {this} {
- set errorCnt 0
- foreach param [$this fullParameterSet] {
- incr errorCnt [$param check]
- }
- return $errorCnt
- }
-
- method CppGSuperClassInitializer::generate {this ctor} {
- # Create Initializer
- set init [CppInitializer new $ctor]
- $init name [[$this ooplClass] getName]
-
- foreach param [$this fullParameterSet] {
- # Create value for this initializer
- set initVal [CppInitValue new $init]
- $initVal value [$param getName]
- }
- return $init
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMSuperClassInitializer] {
- Class CppGSuperClassInitializerD : {CppGSuperClassInitializer CMSuperClassInitializer} {
- }
- } else {
- Class CppGSuperClassInitializerD : {CppGSuperClassInitializer OPSuperClassInitializer} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPSuperClassInitializer) CppGSuperClassInitializerD
-
- selfPromoter OPSuperClassInitializer {this} {
- CppGSuperClassInitializerD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdataba.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDatabaseClass : {CppGClass} {
- constructor
- method destructor
- }
-
- constructor CppGDatabaseClass {class this name} {
- set this [CppGClass::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDatabaseClass::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDatabaseClass] {
- Class CppGDatabaseClassD : {CppGDatabaseClass CMDatabaseClass} {
- }
- } else {
- Class CppGDatabaseClassD : {CppGDatabaseClass OPDatabaseClass} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDatabaseClass) CppGDatabaseClassD
-
- selfPromoter OPDatabaseClass {this} {
- CppGDatabaseClassD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdbaatt.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBAAttr : {CppGAssocAttr} {
- constructor
- method destructor
- }
-
- constructor CppGDBAAttr {class this name} {
- set this [CppGAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBAAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBAssocAttr] {
- Class CppGDBAAttrD : {CppGDBAAttr CMDBAssocAttr} {
- }
- } else {
- Class CppGDBAAttrD : {CppGDBAAttr OPDBAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBAssocAttr) CppGDBAAttrD
-
- selfPromoter OPDBAssocAttr {this} {
- CppGDBAAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdbdatt.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBDAttr : {CppGDataAttr} {
- constructor
- method destructor
- }
-
- constructor CppGDBDAttr {class this name} {
- set this [CppGDataAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBDAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBDataAttr] {
- Class CppGDBDAttrD : {CppGDBDAttr CMDBDataAttr} {
- }
- } else {
- Class CppGDBDAttrD : {CppGDBDAttr OPDBDataAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBDataAttr) CppGDBDAttrD
-
- selfPromoter OPDBDataAttr {this} {
- CppGDBDAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdblatt.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBLAttr : {CppGLinkAttr} {
- constructor
- method destructor
- }
-
- constructor CppGDBLAttr {class this name} {
- set this [CppGLinkAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBLAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBLinkAttr] {
- Class CppGDBLAttrD : {CppGDBLAttr CMDBLinkAttr} {
- }
- } else {
- Class CppGDBLAttrD : {CppGDBLAttr OPDBLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBLinkAttr) CppGDBLAttrD
-
- selfPromoter OPDBLinkAttr {this} {
- CppGDBLAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdblcla.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBLClass : {CppGLinkClass} {
- constructor
- method destructor
- }
-
- constructor CppGDBLClass {class this name} {
- set this [CppGLinkClass::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBLClass::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBLinkClass] {
- Class CppGDBLClassD : {CppGDBLClass CMDBLinkClass} {
- }
- } else {
- Class CppGDBLClassD : {CppGDBLClass OPDBLinkClass} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBLinkClass) CppGDBLClassD
-
- selfPromoter OPDBLinkClass {this} {
- CppGDBLClassD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdbqaat.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBQAAttr : {CppGQualAssocAttr} {
- constructor
- method destructor
- }
-
- constructor CppGDBQAAttr {class this name} {
- set this [CppGQualAssocAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBQAAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBQualAssocAttr] {
- Class CppGDBQAAttrD : {CppGDBQAAttr CMDBQualAssocAttr} {
- }
- } else {
- Class CppGDBQAAttrD : {CppGDBQAAttr OPDBQualAssocAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBQualAssocAttr) CppGDBQAAttrD
-
- selfPromoter OPDBQualAssocAttr {this} {
- CppGDBQAAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdbqlat.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBQLAttr : {CppGQualLinkAttr} {
- constructor
- method destructor
- }
-
- constructor CppGDBQLAttr {class this name} {
- set this [CppGQualLinkAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBQLAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBQualLinkAttr] {
- Class CppGDBQLAttrD : {CppGDBQLAttr CMDBQualLinkAttr} {
- }
- } else {
- Class CppGDBQLAttrD : {CppGDBQLAttr OPDBQualLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBQualLinkAttr) CppGDBQLAttrD
-
- selfPromoter OPDBQualLinkAttr {this} {
- CppGDBQLAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgdbrlat.tcl /main/titanic/3
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGDBRLAttr : {CppGReverseLinkAttr} {
- constructor
- method destructor
- }
-
- constructor CppGDBRLAttr {class this name} {
- set this [CppGReverseLinkAttr::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGDBRLAttr::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMDBReverseLinkAttr] {
- Class CppGDBRLAttrD : {CppGDBRLAttr CMDBReverseLinkAttr} {
- }
- } else {
- Class CppGDBRLAttrD : {CppGDBRLAttr OPDBReverseLinkAttr} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPDBReverseLinkAttr) CppGDBRLAttrD
-
- selfPromoter OPDBReverseLinkAttr {this} {
- CppGDBRLAttrD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgtypede.tcl /main/titanic/10
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGTypeDefType : {CppGType} {
- constructor
- method destructor
- method check
- method checkLocal
- method generate
- }
-
- constructor CppGTypeDefType {class this name} {
- set this [CppGType::constructor $class $this $name]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGTypeDefType::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CppGTypeDefType::check {this} {
- set errorCnt 0
- incr errorCnt [$this checkLocal]
- if {[$this ooplClass] != ""} {
- incr errorCnt [[$this ooplClass] check]
- }
- return $errorCnt
- }
-
- method CppGTypeDefType::checkLocal {this} {
- if {[$this ooplClass] == ""} {
- return 1
- }
- return 0
- }
-
- method CppGTypeDefType::generate {this tgt} {
- set cl [$tgt findDefinition [[$this ooplClass] getName]]
- if {$cl == ""} {
- if [$this check] {
- return [CppType new]
- }
- set cl [[$this ooplClass] generate $tgt]
- $cl isSynthetic 1
- }
- set type [CppType new]
- $type localType $cl
- return $type
- }
-
- # Do not delete this line -- regeneration end marker
-
- if [isCommand CMTypeDefType] {
- Class CppGTypeDefTypeD : {CppGTypeDefType CMTypeDefType} {
- }
- } else {
- Class CppGTypeDefTypeD : {CppGTypeDefType OPTypeDefType} {
- }
- }
-
- global mostDerivedOOPL ; set mostDerivedOOPL(OPTypeDefType) CppGTypeDefTypeD
-
- selfPromoter OPTypeDefType {this} {
- CppGTypeDefTypeD promote $this
- }
- #---------------------------------------------------------------------------
- # File: @(#)cppgmanyqu.tcl /main/titanic/18
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGManyQual : {CppGAssocGen} {
- constructor
- method destructor
- method getTypeDef
- method generateInclude
- method generateAdd
- method generateGet
- method generateRemove
- method generateCtor
- method generateDtor
- method generateOppSet
- method generateOppAdd
- method generateOppRemove
- }
-
- constructor CppGManyQual {class this} {
- set this [CppGAssocGen::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGManyQual::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CppGAssocGen::destructor
- }
-
- method CppGManyQual::getTypeDef {this} {
- if [$this checkLocal] {
- return [CppType new]
- }
- set cldef [$this cldef]
- return [$cldef getTypeAttr]
- }
-
- method CppGManyQual::generateInclude {this class} {
- set cldef [$this cldef]
- set includeList [$cldef getIncludeList]
- lappend includeList [CppProtect::getInclude]
- foreach file $includeList {
- $class addExtIncl $file
- }
- }
-
- method CppGManyQual::generateAdd {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-add" [$attr getName]]
- $methd kind "add"
-
- set cldef [$this cldef]
-
- set ktype [[[$attr qualifier] ooplType] generate [$class model]]
- if {[$ktype localType] != ""} {
- $ktype isConst 1
- $ktype isReference 1
- }
- set keyParam [CppParam new $ktype $methd]
- set keyName [[$attr qualifier] getName]
- $keyParam name $keyName
-
- set ptype [[$attr ooplType] generate [$class model]]
- $ptype isPointer 1
- set param [CppParam new $ptype $methd]
- set pname "new${uName}"
- $param name $pname
-
- set genCode [CppGenCode new $methd]
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode "$pname!=0"
- }
-
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppSet $genCode $this \
- [$oppGenerator attrName] $pname [$this attrName] \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- if {![$attr isMandatory]} {
- $genCode append "if ($pname!=0) \{\n"
- $genCode indent +
- }
- $genCode append [$cldef genAdd [$this attrName] $keyName $pname]
- $genCode append ";\n"
- if {![$attr isMandatory]} {
- $genCode indent -
- $genCode append "\}\n"
- }
- }
-
- method CppGManyQual::generateGet {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 0]
- if {$access == ""} {
- set access "Public"
- }
-
- set cldef [$this cldef]
- set rtype [$cldef getTypeGet]
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set assoc [[$this assocAttr] cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-get-set" [$attr getName]]
- $methd kind "get"
- $methd isConst 1
- $methd isInline 1
-
- set ktype [[[$attr qualifier] ooplType] generate [$class model]]
- if {[$ktype localType] != ""} {
- $ktype isConst 1
- $ktype isReference 1
- }
- set keyParam [CppParam new $ktype $methd]
- set keyName [[$attr qualifier] getName]
- $keyParam name $keyName
-
- set genCode [CppGenCode new $methd]
-
- $genCode append "return "
- $genCode append [$cldef genGet [$this attrName] $keyName]
- $genCode append ";\n"
- }
-
- method CppGManyQual::generateRemove {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
-
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- if {[$oAttr isMandatory] && [$oAttr getMultiplicity] != "many"} {
- m4_warning $W_NOGENREMOVE [$class getName] [$this attrName]
- return
- }
- }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-remove" [$attr getName]]
- $methd kind "remove"
-
- set cldef [$this cldef]
-
- set ktype [[[$attr qualifier] ooplType] generate [$class model]]
- if {[$ktype localType] != ""} {
- $ktype isConst 1
- $ktype isReference 1
- }
- set keyParam [CppParam new $ktype $methd]
- set keyName [[$attr qualifier] getName]
- $keyParam name $keyName
-
- set ptype [[$attr ooplType] generate [$class model]]
- $ptype isPointer 1
- set param [CppParam new $ptype $methd]
- set pname "old${uName}"
- $param name $pname
-
- set genCode [CppGenCode new $methd]
-
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $genCode $this \
- [$oppGenerator attrName] "this" $pname \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- $genCode append [$cldef genRemove [$this attrName] $keyName $pname]
- $genCode append ";\n"
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode [$cldef genIsNotEmpty [$this attrName]]
- }
- }
-
- method CppGManyQual::generateCtor {this class} {
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set cldef [$this cldef]
-
- [$class featureSet] foreach feature {
- if [$feature isA CppConstructor] {
- set genCode [CppGenCode new $feature]
- $genCode append [$cldef genCtor]
- }
- }
- }
-
- method CppGManyQual::generateDtor {this class} {
- set attr [$this assocAttr]
- if {$attr == "" } { return }
-
- set cldef [$this cldef]
-
- [$class featureSet] foreach feature {
- if [$feature isA CppDestructor] {
- set genCode [CppGenCode new $feature]
- set tmpSec [TextSection new]
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- if [$oAttr isMandatory] {
- CppProtect::genCheck $genCode [$cldef genIsEmpty [$this attrName]]
- } else {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $tmpSec $this \
- [$oppGenerator attrName] "this" {$loopVar} \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- $cldef genIterator $genCode [$tmpSec contents]
- }
- }
- $genCode append [$cldef genDtor]
- }
- }
- }
-
- method CppGManyQual::generateOppSet {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- }
-
- method CppGManyQual::generateOppAdd {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- }
-
- method CppGManyQual::generateOppRemove {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- }
-
- # Do not delete this line -- regeneration end marker
-
- #---------------------------------------------------------------------------
- # File: @(#)cppgassoco.tcl /main/titanic/15
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAssocOne : {CppGAssocGen} {
- constructor
- method destructor
- method getTypeDef
- method generateInclude
- method generateSet
- method generateGet
- method generateRemove
- method generateCtor
- method generateDtor
- method generateOppSet
- method generateOppAdd
- method generateOppRemove
- }
-
- constructor CppGAssocOne {class this} {
- set this [CppGAssocGen::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGAssocOne::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CppGAssocGen::destructor
- }
-
- method CppGAssocOne::getTypeDef {this} {
- if [$this checkLocal] {
- return [CppType new]
- }
- return [[$this cldef] getTypeAttr]
- }
-
- method CppGAssocOne::generateInclude {this class} {
- set includeList [[$this cldef] getIncludeList]
- lappend includeList [CppProtect::getInclude]
- foreach file $includeList {
- $class addExtIncl $file
- }
- }
-
- method CppGAssocOne::generateSet {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set oAttr [$attr opposite]
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENUPDATE [$class getName] [$this attrName]
- return
- }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-set" [$attr getName]]
- $methd kind "set"
-
- set cldef [$this cldef]
-
- set ptype [[$attr ooplType] generate [$class model]]
- $ptype isPointer 1
- set param [CppParam new $ptype $methd]
- set pname "new${uName}"
- $param name $pname
-
- set genCode [CppGenCode new $methd]
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode "$pname!=0"
- }
-
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $genCode $this \
- [$oppGenerator attrName] "this" [$this attrName] \
- [$oAttr isMandatory] [$attr isMandatory]
-
- $oppGenerator generateOppSet $genCode $this \
- [$oppGenerator attrName] $pname [$this attrName] \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- $genCode append [$cldef genSet [$this attrName] $pname]
- $genCode append ";\n"
- }
-
- method CppGAssocOne::generateGet {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 0]
- if {$access == ""} {
- set access "Public"
- }
-
- set cldef [$this cldef]
- set rtype [$cldef getTypeAttr]
- $rtype isConst 1
-
- set assoc [[$this assocAttr] cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-get" [$attr getName]]
- $methd kind "get"
- $methd isConst 1
- $methd isInline 1
-
- set genCode [CppGenCode new $methd]
- $genCode append "return "
- $genCode append [$cldef genGet [$this attrName]]
- $genCode append ";\n"
- }
-
- method CppGAssocOne::generateRemove {this class} {
- # equal to set..(0)
- }
-
- method CppGAssocOne::generateCtor {this class} {
-
- set cldef [$this cldef]
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set oAttr [$attr opposite]
-
- set pname "(&[$attr getName])"
- set aname "[$this attrName]"
-
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENCTOR [$class getName] [$this attrName]
- return
- }
-
- [$class featureSet] foreach feature {
- if [$feature isA CppConstructor] {
- set genCode [CppGenCode new $feature]
- $genCode append [$cldef genCtor]
-
- if [$attr isMandatory] {
- $genCode append "[$cldef genSet $aname $pname];\n"
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppSet $genCode $this \
- [$oppGenerator attrName] $pname $aname \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
- }
- }
- }
- }
-
- method CppGAssocOne::generateDtor {this class} {
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set oAttr [$attr opposite]
- set cldef [$this cldef]
-
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENDTOR [$class getName] [$this attrName]
- return
- }
-
- [$class featureSet] foreach feature {
- if [$feature isA CppDestructor] {
- set genCode [CppGenCode new $feature]
- set oAttr [$attr opposite]
- set aname "[$this attrName]"
- set pname "this"
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $genCode $this \
- [$oppGenerator attrName] $pname $aname \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
- $genCode append [$cldef genDtor]
- }
- }
- }
-
- method CppGAssocOne::generateOppSet {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
-
- set cldef [$this cldef]
- set newOAttr "${paramName}->${attrName}"
- set oldOAttr "${oppAttrName}->${attrName}"
-
- if { $oppAttrMand } {
- CppProtect::genCheck $sec [$cldef genIsEmpty $newOAttr]
- } else {
- $sec append "if ([$cldef genIsNotEmpty $paramName]) \{\n"
- $sec indent +
- if { $other != "" } {
- $other generateOppRemove $sec "" \
- $oppAttrName $paramName $newOAttr \
- $oppAttrMand $attrMand
- }
- }
- $sec append [$cldef genSet $newOAttr "this"]
- $sec append ";\n"
- if { ! $oppAttrMand } {
- $sec indent -
- $sec append "\}\n"
- }
- }
-
- method CppGAssocOne::generateOppAdd {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- $this generateOppSet $sec $attrName $paramName \
- $oppAttrName $attrMand $oppAttrMand
- }
-
- method CppGAssocOne::generateOppRemove {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- set cldef [$this cldef]
- set oAttr "${oppAttrName}->${attrName}"
-
- if { $attrMand } {
- CppProtect::genCheck $sec [$cldef genIsEmpty $oppAttrName]
- } else {
- if { ! $oppAttrMand } {
- $sec append "if ([$cldef genIsNotEmpty ${oppAttrName}]) \{\n"
- $sec indent +
- }
- $sec append [$cldef genSet $oAttr "0"]
- $sec append ";\n"
- if { ! $oppAttrMand } {
- $sec indent -
- $sec append "\}\n"
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- #---------------------------------------------------------------------------
- # File: @(#)cppgoneopp.tcl /main/titanic/4
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGOneOppQual : {CppGAssocOne} {
- constructor
- method destructor
- method getTypeDef
- method generateSet
- method generateGet
- method generateRemove
- method generateCtor
- method generateDtor
- method generateOppSet
- method generateOppAdd
- method generateOppRemove
- }
-
- constructor CppGOneOppQual {class this} {
- set this [CppGAssocOne::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGOneOppQual::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CppGAssocOne::destructor
- }
-
- method CppGOneOppQual::getTypeDef {this} {
- $this CppGAssocOne::getTypeDef
- }
-
- method CppGOneOppQual::generateSet {this class} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateGet {this class} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateRemove {this class} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateCtor {this class} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateDtor {this class} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateOppSet {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateOppAdd {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- # !! Implement this function !!
- }
-
- method CppGOneOppQual::generateOppRemove {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- # !! Implement this function !!
- }
-
- # Do not delete this line -- regeneration end marker
-
- #---------------------------------------------------------------------------
- # File: @(#)cppgonequa.tcl /main/titanic/17
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGOneQual : {CppGAssocGen} {
- constructor
- method destructor
- method getTypeDef
- method generateInclude
- method generateSet
- method generateGet
- method generateRemove
- method generateCtor
- method generateDtor
- method generateOppSet
- method generateOppAdd
- method generateOppRemove
- }
-
- constructor CppGOneQual {class this} {
- set this [CppGAssocGen::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGOneQual::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CppGAssocGen::destructor
- }
-
- method CppGOneQual::getTypeDef {this} {
- if [$this checkLocal] {
- return [CppType new]
- }
- return [[$this cldef] getTypeAttr]
- }
-
- method CppGOneQual::generateInclude {this class} {
- set includeList [[$this cldef] getIncludeList]
- lappend includeList [CppProtect::getInclude]
- foreach file $includeList {
- $class addExtIncl $file
- }
- }
-
- method CppGOneQual::generateSet {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-set" [$attr getName]]
- $methd kind "set"
-
- set ktype [[[$attr qualifier] ooplType] generate [$class model]]
- if {[$ktype localType] != "" } {
- $ktype isConst 1
- $ktype isReference 1
- }
- set keyParam [CppParam new $ktype $methd]
- set keyName [[$attr qualifier] getName]
- $keyParam name $keyName
-
- set ptype [[$attr ooplType] generate [$class model]]
- $ptype isPointer 1
- set param [CppParam new $ptype $methd]
- set pname "new${uName}"
- $param name $pname
-
- set genCode [CppGenCode new $methd]
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode "$pname!=0"
- }
-
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppSet $genCode $this \
- [$oppGenerator attrName] $pname [$this attrName] \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- if {![$attr isMandatory]} {
- $genCode append "if ($pname!=0) \{\n"
- $genCode indent +
- }
- $genCode append [[$this cldef] genAdd [$this attrName] $keyName $pname]
- $genCode append ";\n"
- if {![$attr isMandatory]} {
- $genCode indent -
- $genCode append "\}\n"
- }
- }
-
- method CppGOneQual::generateGet {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 0]
- if {$access == ""} {
- set access "Public"
- }
-
- set cldef [$this cldef]
-
- set rtype [$cldef getTypeGet]
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set assoc [[$this assocAttr] cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-get" [$attr getName]]
- $methd kind "get"
- $methd isConst 1
- $methd isInline 1
-
- set ktype [[[$attr qualifier] ooplType] generate [$class model]]
- if {[$ktype localType] != "" } {
- $ktype isConst 1
- $ktype isReference 1
- }
- set keyParam [CppParam new $ktype $methd]
- set keyName [[$attr qualifier] getName]
- $keyParam name $keyName
-
- set genCode [CppGenCode new $methd]
-
- $genCode append "return "
- $genCode append [$cldef genGet [$this attrName] $keyName]
- $genCode append ";\n"
- }
-
- method CppGOneQual::generateRemove {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
-
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- if {[$oAttr isMandatory] && [$oAttr getMultiplicity] != "many"} {
- m4_warning $W_NOGENREMOVE [$class getName] [$this attrName]
- return
- }
- }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-remove" [$attr getName]]
- $methd kind "remove"
-
- set cldef [$this cldef]
-
- set ktype [[[$attr qualifier] ooplType] generate [$class model]]
- if {[$ktype localType] != "" } {
- $ktype isConst 1
- $ktype isReference 1
- }
- set keyParam [CppParam new $ktype $methd]
- set keyName [[$attr qualifier] getName]
- $keyParam name $keyName
-
- set genCode [CppGenCode new $methd]
-
- if {$oAttr != ""} {
- set opptype [$cldef getTypeGet]
- $opptype isConst 0
- $opptype generate "opposite" $genCode "" ""
- $genCode append "=[$cldef genGet [$this attrName] $keyName];\n"
-
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $genCode $this \
- [$oppGenerator attrName] "this" "opposite" \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- $genCode append [$cldef genRemove [$this attrName] $keyName]
- $genCode append ";\n"
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode [$cldef genIsNotEmpty [$this attrName]]
- }
- }
-
- method CppGOneQual::generateCtor {this class} {
- set cldef [$this cldef]
-
- [$class featureSet] foreach feature {
- if [$feature isA CppConstructor] {
- set genCode [CppGenCode new $feature]
- $genCode append [$cldef genCtor]
- }
- }
- }
-
- method CppGOneQual::generateDtor {this class} {
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set cldef [$this cldef]
-
- [$class featureSet] foreach feature {
- if [$feature isA CppDestructor] {
- set genCode [CppGenCode new $feature]
- set tmpSec [TextSection new]
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- if [$oAttr isMandatory] {
- CppProtect::genCheck $genCode [$cldef genIsEmpty [$this attrName]]
- } else {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $tmpSec $this \
- [$oppGenerator attrName] "this" {$loopVar} \
- [$oAttr isMandatory] [$attr isMandatory]
- }
-
- $cldef genIterator $genCode [$tmpSec contents]
- }
- }
- $genCode append [$cldef genDtor]
- }
- }
- }
-
- method CppGOneQual::generateOppSet {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- }
-
- method CppGOneQual::generateOppAdd {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- $this generateOppSet $sec $other $attrName $paramName \
- $oppAttrName $attrMand $oppAttrMand
- }
-
- method CppGOneQual::generateOppRemove {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
- }
-
- # Do not delete this line -- regeneration end marker
-
- #---------------------------------------------------------------------------
- # File: @(#)cppgassocm.tcl /main/titanic/17
- #---------------------------------------------------------------------------
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CppGAssocMany : {CppGAssocGen} {
- constructor
- method destructor
- method getTypeDef
- method generateInclude
- method generateAdd
- method generateGet
- method generateRemove
- method generateCtor
- method generateDtor
- method generateOppSet
- method generateOppAdd
- method generateOppRemove
- }
-
- constructor CppGAssocMany {class this} {
- set this [CppGAssocGen::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CppGAssocMany::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CppGAssocGen::destructor
- }
-
- method CppGAssocMany::getTypeDef {this} {
- if [$this checkLocal] {
- return [CppType new]
- }
- return [[$this cldef] getTypeAttr]
- }
-
- method CppGAssocMany::generateInclude {this class} {
- set includeList [[$this cldef] getIncludeList]
- lappend includeList [CppProtect::getInclude]
- foreach file $includeList {
- $class addExtIncl $file
- }
- }
-
- method CppGAssocMany::generateAdd {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set oAttr [$attr opposite]
-
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENUPDATE [$class getName] [$this attrName]
- return
- }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-add" [$attr getName]]
- $methd kind "add"
-
- set cldef [$this cldef]
-
- set ptype [[$attr ooplType] generate [$class model]]
- $ptype isPointer 1
- set param [CppParam new $ptype $methd]
- set pname "new${uName}"
- $param name $pname
-
- set genCode [CppGenCode new $methd]
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode "$pname!=0"
- }
-
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppSet $genCode $this \
- [$oppGenerator attrName] $pname [$this attrName] \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- if {![$attr isMandatory]} {
- $genCode append "if ($pname!=0) \{\n"
- $genCode indent +
- }
- $genCode append [$cldef genAdd [$this attrName] $pname]
- $genCode append ";\n"
- if {![$attr isMandatory]} {
- $genCode indent -
- $genCode append "\}\n"
- }
- }
-
- method CppGAssocMany::generateGet {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 0]
- if {$access == ""} {
- set access "Public"
- }
-
- set cldef [$this cldef]
-
- set rtype [$cldef getTypeGet]
- set assoc [[$this assocAttr] cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-get-set" [$attr getName]]
- $methd kind "get"
- $methd isConst 1
- $methd isInline 1
-
- set genCode [CppGenCode new $methd]
- $genCode append "return "
- $genCode append [$cldef genGet [$this attrName]]
- $genCode append ";\n"
- }
-
- method CppGAssocMany::generateRemove {this class} {
-
- set attr [$this assocAttr]
- if {$attr == "" } { return }
-
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- if {[$oAttr isMandatory] && [$oAttr getMultiplicity] != "many"} {
- m4_warning $W_NOGENREMOVE [$class getName] [$this attrName]
- return
- }
- }
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENUPDATE [$class getName] [$this attrName]
- return
- }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
-
- set accessList [split [$attr getPropertyValue assoc_access] -]
- set access [lindex $accessList 1]
- if {$access == "None"} {
- return
- }
- if {$access == ""} {
- set access "Public"
- }
-
- set rtype [CppType new]
-
- set assoc [$attr cppAssocAttr]
- set methd [CppAccMethod new $class $access $rtype $assoc]
- $methd name [$methd getMethodName "assoc-remove" [$attr getName]]
- $methd kind "remove"
-
- set cldef [$this cldef]
-
- set ptype [[$attr ooplType] generate [$class model]]
- $ptype isPointer 1
- set param [CppParam new $ptype $methd]
- set pname "old${uName}"
- $param name $pname
-
- set genCode [CppGenCode new $methd]
-
- if {$oAttr != ""} {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $genCode $this \
- [$oppGenerator attrName] "this" $pname \
- [$oAttr isMandatory] [$attr isMandatory]
- }
- }
-
- $genCode append [$cldef genRemove [$this attrName] $pname]
- $genCode append ";\n"
-
- if [$attr isMandatory] {
- CppProtect::genCheck $genCode [$cldef genIsNotEmpty [$this attrName]]
- }
- }
-
- method CppGAssocMany::generateCtor {this class} {
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set oAttr [$attr opposite]
- set cldef [$this cldef]
-
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENCTOR [$class getName] [$this attrName]
- return
- }
-
- set firstUp [string toupper [string range [$attr getName] 0 0]]
- set uName "${firstUp}[string range [$attr getName] 1 end]"
- [$class featureSet] foreach feature {
- if [$feature isA CppConstructor] {
- set genCode [CppGenCode new $feature]
- $genCode append [$cldef genCtor]
- }
- }
- }
-
- method CppGAssocMany::generateDtor {this class} {
- set attr [$this assocAttr]
- if {$attr == "" } { return }
- set oAttr [$attr opposite]
- set cldef [$this cldef]
-
- if {($oAttr != "") &&
- ([$oAttr isA OPQualAssocAttr] || [$oAttr isA OPQualLinkAttr])} {
- m4_warning $W_NOGENDTOR [$class getName] [$this attrName]
- return
- }
-
- [$class featureSet] foreach feature {
- if [$feature isA CppDestructor] {
- set genCode [CppGenCode new $feature]
- set tmpSec [TextSection new]
- set oAttr [$attr opposite]
- if {$oAttr != ""} {
- if [$oAttr isMandatory] {
- CppProtect::genCheck $genCode [$cldef genIsEmpty [$this attrName]]
- } else {
- set oppGenerator [$oAttr generator]
- if {$oppGenerator != ""} {
- $oppGenerator generateOppRemove $tmpSec $this \
- [$oppGenerator attrName] "this" {$loopVar} \
- [$oAttr isMandatory] [$attr isMandatory]
- }
-
- $cldef genIterator $genCode [$tmpSec contents]
- }
- }
- $genCode append [$cldef genDtor]
- }
- }
- }
-
- method CppGAssocMany::generateOppSet {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
-
- $this generateOppAdd $sec $other $attrName $paramName $oppAttrName $attrMand $oppAttrMand
- }
-
- method CppGAssocMany::generateOppAdd {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
-
- set newOAttr "${paramName}->${attrName}"
- set cldef [$this cldef]
-
- if {!$oppAttrMand} {
- $sec append "if (${paramName}!=0) \{\n"
- $sec indent +
- }
- $sec append [$cldef genAdd $newOAttr "this"]
- $sec append ";\n"
- if {!$oppAttrMand} {
- $sec indent -
- $sec append "\}\n"
- }
- }
-
- method CppGAssocMany::generateOppRemove {this sec other attrName paramName oppAttrName attrMand oppAttrMand} {
-
- set oAttr "${oppAttrName}->${attrName}"
- set cldef [$this cldef]
-
- if { $attrMand } {
- CppProtect::genCheck $sec [$cldef genIsEmpty $oAttr]
- } else {
- if {!$oppAttrMand} {
- $sec append "if (${oppAttrName}!=0) \{\n"
- $sec indent +
- }
- $sec append [$cldef genRemove $oAttr "$paramName"]
- $sec append ";\n"
- if {!$oppAttrMand} {
- $sec indent -
- $sec append "\}\n"
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-