home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
classlib.tcl
< prev
next >
Wrap
Text File
|
1997-09-24
|
13KB
|
533 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 : @(#)classlib.tcl /main/titanic/13 17 Jun 1997
# Description : Classlib installation
#
#---------------------------------------------------------------------------
#
require "cppclldef.tcl"
Class CaynPtrDef : {CppPtrDef} {
method getIncludeList
method getTypeAttr
method genIsEmpty
method genIsNotEmpty
method genGet
method genSet
method genDtor
method genCtor
}
method CaynPtrDef::getIncludeList {this} {
return {}
}
method CaynPtrDef::getTypeAttr {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set type [[[$attr assocAttr] ooplType] generate $tgt]
$type isPointer 1
return $type
}
method CaynPtrDef::genIsEmpty {this attrName} {
return "${attrName}==0"
}
method CaynPtrDef::genIsNotEmpty {this attrName} {
return "${attrName}!=0"
}
method CaynPtrDef::genGet {this attrName} {
return "$attrName"
}
method CaynPtrDef::genSet {this attrName value} {
return "$attrName = $value"
}
method CaynPtrDef::genDtor {this} {
return ""
}
method CaynPtrDef::genCtor {this} {
return ""
}
Class CaynSetDef : {CppSetDef} {
method getIncludeList
method getTypeAttr
method getTypeGet
method genIsEmpty
method genIsNotEmpty
method genGet
method genAdd
method genRemove
method genIterator
method genDtor
method genCtor
}
method CaynSetDef::getIncludeList {this} {
return "PtrSet.hxx"
}
method CaynSetDef::getTypeAttr {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
set type [CppType new]
$contentsType isPointer 0
$contentsType includeInFile "cpp"
$type name "PtrSet"
$type addTemplateParam $contentsType
return $type
}
method CaynSetDef::getTypeGet {this} {
set type [$this getTypeAttr]
$type isConst 1
$type isReference 1
return $type
}
method CaynSetDef::genIsEmpty {this attrName} {
return "${attrName}.size()==0"
}
method CaynSetDef::genIsNotEmpty {this attrName} {
return "${attrName}.size()!=0"
}
method CaynSetDef::genGet {this attrName} {
return "${attrName}"
}
method CaynSetDef::genAdd {this attrName value} {
return "${attrName}.add(${value})"
}
method CaynSetDef::genRemove {this attrName value} {
return "${attrName}.remove(${value})"
}
method CaynSetDef::genIterator {this sect loopExpr} {
set attr [$this attr]
set attrName [$attr attrName]
set attrType [$attr attrType]
$sect append "$attrType *${attrName}Iter;\n"
$sect append "for (${attrName}Iter=${attrName}.first(); "
$sect append "${attrName}Iter!=0; "
$sect append "${attrName}Iter=${attrName}.next()) \{\n"
$sect indent +
set loopVar "${attrName}Iter"
if [regsub -all {\$loopVar} $loopExpr $loopVar expr] {
$sect append $expr
} else {
$sect append $loopExpr
}
$sect indent -
$sect append "\}\n"
}
method CaynSetDef::genDtor {this} {
return ""
}
method CaynSetDef::genCtor {this} {
return ""
}
Class CaynDictDef : {CppDictDef} {
method getIncludeList
method getTypeAttr
method getTypeGet
method genIsEmpty
method genIsNotEmpty
method genGet
method genAdd
method genRemove
method genIterator
method genDtor
method genCtor
}
method CaynDictDef::getIncludeList {this} {
return "PtrDict.hxx"
}
method CaynDictDef::getTypeAttr {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
$contentsType isPointer 0
$contentsType includeInFile "cpp"
set ktype [[[[$attr assocAttr] qualifier] ooplType] generate $tgt]
$ktype isPointer 0
set type [CppType new]
$type name "PtrDict"
$type addTemplateParam $ktype
$type addTemplateParam $contentsType
return $type
}
method CaynDictDef::getTypeGet {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set type [[[$attr assocAttr] ooplType] generate $tgt]
$type isPointer 1
return $type
}
method CaynDictDef::genIsEmpty {this attrName} {
return "${attrName}.firstValue()==0"
}
method CaynDictDef::genIsNotEmpty {this attrName} {
return "${attrName}.firstValue()!=0"
}
method CaynDictDef::genGet {this attrName keyName} {
return "${attrName}.get(${keyName})"
}
method CaynDictDef::genAdd {this attrName keyName value} {
return "${attrName}.set(${keyName},${value})"
}
method CaynDictDef::genRemove {this attrName keyName} {
return "${attrName}.remove(${keyName})"
}
method CaynDictDef::genIterator {this sect loopExpr} {
set attr [$this attr]
set attrName [$attr attrName]
set attrType [$attr attrType]
$sect append "${attrType}* ${attrName}Iter;\n"
$sect append "for (${attrName}Iter=${attrName}.firstValue(); "
$sect append "${attrName}Iter!=0; "
$sect append "${attrName}Iter=${attrName}.nextValue()) \{\n"
$sect indent +
set loopVar "${attrName}Iter"
if [regsub -all {\$loopVar} $loopExpr $loopVar expr] {
$sect append $expr
} else {
$sect append $loopExpr
}
$sect indent -
$sect append "\}\n"
}
method CaynDictDef::genDtor {this} {
return ""
}
method CaynDictDef::genCtor {this} {
return ""
}
Class CaynSetDictDef : {CppSetDictDef} {
method getIncludeList
method getTypeAttr
method getTypeGet
method genIsEmpty
method genIsNotEmpty
method genGet
method genAdd
method genRemove
method genIterator
method genDtor
method genCtor
}
method CaynSetDictDef::getIncludeList {this} {
return "PSetDict.hxx"
}
method CaynSetDictDef::getTypeAttr {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
$contentsType isPointer 0
$contentsType includeInFile "cpp"
set ktype [[[[$attr assocAttr] qualifier] ooplType] generate $tgt]
$ktype isPointer 0
set type [CppType new]
$type name "PSetDict"
$type addTemplateParam $ktype
$type addTemplateParam $contentsType
return $type
}
method CaynSetDictDef::getTypeGet {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
$contentsType isPointer 0
$contentsType includeInFile "cpp"
set type [CppType new]
$type name "PtrSet"
$type addTemplateParam $contentsType
$type isReference 1
$type isConst 1
return $type
}
method CaynSetDictDef::genIsEmpty {this attrName} {
return "${attrName}.firstValue()==0"
}
method CaynSetDictDef::genIsNotEmpty {this attrName} {
return "${attrName}.firstValue()!=0"
}
method CaynSetDictDef::genGet {this attrName keyName} {
return "*${attrName}.get(${keyName})"
}
method CaynSetDictDef::genAdd {this attrName keyName value} {
return "${attrName}.add(${keyName},${value})"
}
method CaynSetDictDef::genRemove {this attrName keyName value} {
return "${attrName}.remove(${keyName},${value})"
}
method CaynSetDictDef::genIterator {this sect loopExpr} {
set attr [$this attr]
set attrName [$attr attrName]
set attrType [$attr attrType]
$sect append "PtrSet<${attrType}>* ${attrName}Iter;\n"
$sect append "for (${attrName}Iter=${attrName}.firstValue(); "
$sect append "${attrName}Iter!=0; "
$sect append "${attrName}Iter=${attrName}.nextValue()) \{\n"
$sect indent +
$sect append "${attrType}* ${attrName}SubIter;\n"
$sect append "for (${attrName}SubIter=${attrName}Iter->first(); "
$sect append "${attrName}SubIter!=0; "
$sect append "${attrName}SubIter=${attrName}Iter->next()) \{\n"
$sect indent +
set loopVar "${attrName}SubIter"
if [regsub -all {\$loopVar} $loopExpr $loopVar expr] {
$sect append $expr
} else {
$sect append $loopExpr
}
$sect indent -
$sect append "\}\n"
$sect indent -
$sect append "\}\n"
}
method CaynSetDictDef::genDtor {this} {
return ""
}
method CaynSetDictDef::genCtor {this} {
return ""
}
Class CaynOSetDef : {CaynSetDef} {
method getIncludeList
method getTypeAttr
method getTypeGet
method genIsEmpty
method genIsNotEmpty
method genGet
method genAdd
method genRemove
method genIterator
method genDtor
method genCtor
}
method CaynOSetDef::getIncludeList {this} {
return "OPtrSet.hxx"
}
method CaynOSetDef::getTypeAttr {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
set type [CppType new]
$contentsType isPointer 0
$contentsType includeInFile "cpp"
$type name "OPtrSet"
$type addTemplateParam $contentsType
return $type
}
method CaynOSetDef::getTypeGet {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set type [$this getTypeAttr]
$type isConst 1
$type isReference 1
return $type
}
method CaynOSetDef::genIsEmpty {this attrName} {
return "${attrName}.size()==0"
}
method CaynOSetDef::genIsNotEmpty {this attrName} {
return "${attrName}.size()!=0"
}
method CaynOSetDef::genGet {this attrName} {
return "${attrName}"
}
method CaynOSetDef::genAdd {this attrName value} {
return "${attrName}.append(${value})"
}
method CaynOSetDef::genRemove {this attrName value} {
return "${attrName}.remove(${value})"
}
method CaynOSetDef::genIterator {this sect loopExpr} {
set attr [$this attr]
set attrName [$attr attrName]
set attrType [$attr attrType]
$sect append "int ${attrName}Cnt;\n"
$sect append "for (${attrName}Cnt=0; "
$sect append "${attrName}Cnt<${attrName}.size(); "
$sect append "${attrName}Cnt++) \{\n"
$sect indent +
set loopVar "${attrName}.at(${attrName}Cnt)"
if [regsub -all {\$loopVar} $loopExpr $loopVar expr] {
$sect append $expr
} else {
$sect append $loopExpr
}
$sect indent -
$sect append "\}\n"
}
method CaynOSetDef::genDtor {this} {
return ""
}
method CaynOSetDef::genCtor {this} {
return ""
}
Class CaynOSetDictDef : {CaynSetDictDef} {
method getIncludeList
method getTypeAttr
method getTypeGet
method genIsEmpty
method genIsNotEmpty
method genGet
method genAdd
method genRemove
method genIterator
method genDtor
method genCtor
}
method CaynOSetDictDef::getIncludeList {this} {
return "OPSetDict.hxx"
}
method CaynOSetDictDef::getTypeAttr {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
$contentsType isPointer 0
$contentsType includeInFile "cpp"
set ktype [[[[$attr assocAttr] qualifier] ooplType] generate $tgt]
$ktype isPointer 0
set type [CppType new]
$type name "OPSetDict"
$type addTemplateParam $ktype
$type addTemplateParam $contentsType
return $type
}
method CaynOSetDictDef::getTypeGet {this} {
set attr [$this attr]
set tgt [[$this clss] model]
set contentsType [[[$attr assocAttr] ooplType] generate $tgt]
set type [CppType new]
$type name "OPtrSet"
$type addTemplateParam $contentsType
$type isReference 1
$type isConst 1
return $type
}
method CaynOSetDictDef::genIsEmpty {this attrName} {
return "${attrName}.firstValue()==0"
}
method CaynOSetDictDef::genIsNotEmpty {this attrName} {
return "${attrName}.firstValue()!=0"
}
method CaynOSetDictDef::genGet {this attrName keyName} {
return "*${attrName}.get(${keyName})"
}
method CaynOSetDictDef::genAdd {this attrName keyName value} {
return "${attrName}.add(${keyName},${value})"
}
method CaynOSetDictDef::genRemove {this attrName keyName value} {
return "${attrName}.remove(${keyName},${value})"
}
method CaynOSetDictDef::genIterator {this sect loopExpr} {
set attr [$this attr]
set attrName [$attr attrName]
set attrType [$attr attrType]
$sect append "OPtrSet<${attrType}>* ${attrName}Iter;\n"
$sect append "for (${attrName}Iter=${attrName}.firstValue(); "
$sect append "${attrName}Iter!=0; "
$sect append "${attrName}Iter=${attrName}.nextValue()) \{\n"
$sect indent +
$sect append "int ${attrName}Cnt;\n"
$sect append "for (${attrName}Cnt=0; "
$sect append "${attrName}Cnt<${attrName}Iter->size(); "
$sect append "${attrName}Cnt++) \{\n"
$sect indent +
set loopVar "${attrName}Iter->at(${attrName}Cnt)"
if [regsub -all {\$loopVar} $loopExpr $loopVar expr] {
$sect append $expr
} else {
$sect append $loopExpr
}
$sect indent -
$sect append "\}\n"
$sect indent -
$sect append "\}\n"
}
method CaynOSetDictDef::genDtor {this} {
return ""
}
method CaynOSetDictDef::genCtor {this} {
return ""
}