Skip to content

Commit 9db54ad

Browse files
author
Nicholas Reed
committed
apply SCL git e72ca29; remove some superfluous boolean types and use std bool more often
1 parent ad0ba3d commit 9db54ad

15 files changed

Lines changed: 115 additions & 167 deletions

src/cleditor/cmdmgr.cc

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
* and is not subject to copyright.
1111
*/
1212

13-
/* $Id: cmdmgr.cc,v 3.0.1.2 1997/11/05 22:11:41 sauderd DP3.1 $ */
14-
1513
#include <cmdmgr.h>
1614

1715

@@ -27,61 +25,45 @@ ReplicateLinkNode * ReplicateList::FindNode( MgrNode * mn ) {
2725
return 0;
2826
}
2927

30-
BOOLEAN ReplicateList::IsOnList( MgrNode * mn ) {
28+
bool ReplicateList::IsOnList( MgrNode * mn ) {
3129
return ( FindNode( mn ) != 0 );
32-
/*
33-
ReplicateLinkNode *rln = (ReplicateLinkNode *)GetHead();
34-
int numEntries = EntryCount();
35-
int found = 0;
36-
while(numEntries--)
37-
{
38-
if(rln->ReplicateNode() == mn)
39-
{
40-
found = 1;
41-
numEntries = 0;
42-
}
43-
rln = (ReplicateLinkNode *)rln->NextNode();
44-
}
45-
return found;
46-
*/
4730
}
4831

4932
///////////////////////////////////////////////////////////////////////////////
5033
// returns true if it could delete the node
5134
///////////////////////////////////////////////////////////////////////////////
52-
BOOLEAN ReplicateList::Remove( ReplicateLinkNode * rln ) {
35+
bool ReplicateList::Remove( ReplicateLinkNode * rln ) {
5336
ReplicateLinkNode * rnFollow = ( ReplicateLinkNode * )GetHead();
5437
if( !rnFollow || !rln ) {
55-
return 0;
38+
return false;
5639
} else {
5740
if( rnFollow == rln ) {
5841
head = rln->NextNode();
5942
delete rln;
60-
return 1;
43+
return true;
6144
} else {
6245
ReplicateLinkNode * rn = ( ReplicateLinkNode * )rnFollow->NextNode();
6346
while( rn ) {
6447
if( rn == rln ) {
6548
rnFollow->next = ( SingleLinkNode * )rln->NextNode();
6649
delete rln;
67-
return 1;
50+
return true;
6851
}
6952
rnFollow = rn;
7053
rn = ( ReplicateLinkNode * )rn->NextNode();
7154
} // end while(rn)
7255
} // end else
7356
} // end else
74-
return 0;
57+
return false;
7558
}
7659

77-
BOOLEAN ReplicateList::Remove( MgrNode * rn ) {
60+
bool ReplicateList::Remove( MgrNode * rn ) {
7861
return Remove( FindNode( rn ) );
7962
}
8063

8164
CmdMgr::CmdMgr() {
8265
completeList = new MgrNodeList( completeSE );
8366
incompleteList = new MgrNodeList( incompleteSE );
84-
// newList = new MgrNodeList(newSE);
8567
deleteList = new MgrNodeList( deleteSE );
8668

8769
mappedWriteList = new DisplayNodeList( mappedWrite );
@@ -90,40 +72,21 @@ CmdMgr::CmdMgr() {
9072
replicateList = new ReplicateList();
9173
}
9274

93-
int CmdMgr::ReplicateCmdList( MgrNode * mn ) {
75+
void CmdMgr::ReplicateCmdList( MgrNode * mn ) {
9476
if( !( replicateList->IsOnList( mn ) ) ) {
9577
replicateList->AddNode( mn );
9678
}
97-
return 1;
98-
}
99-
100-
/*
101-
void CmdMgr::ModifyCmdList(MgrNode *mn)
102-
{
103-
mn->ChangeList(mappedWriteList);
104-
}
105-
106-
void CmdMgr::ViewCmdList(MgrNode *mn)
107-
{
108-
mn->ChangeList(mappedViewList);
10979
}
11080

111-
void CmdMgr::CloseCmdList(MgrNode *mn)
112-
{
113-
mn->ChangeList(closeList);
114-
}
115-
*/
116-
11781
void CmdMgr::ClearInstances() {
11882
completeList->ClearEntries();
11983
incompleteList->ClearEntries();
12084
cancelList->ClearEntries();
12185
deleteList->ClearEntries();
12286
replicateList->Empty();
12387

124-
// newList->ClearEntries();
12588
}
126-
// searches current list for fileId
89+
/// searches current list for fileId
12790
MgrNode * CmdMgr::StateFindFileId( stateEnum s, int fileId ) {
12891
switch( s ) {
12992
case completeSE:

src/cleditor/cmdmgr.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@
1212
* and is not subject to copyright.
1313
*/
1414

15-
/* $Id: cmdmgr.h,v 3.0.1.2 1997/11/05 22:11:41 sauderd DP3.1 $ */
16-
17-
1815
#include <gennode.h>
1916
#include <gennodelist.h>
20-
//#include <gennode.inline.h>
2117
#include <gennodearray.h>
2218

2319
#include <editordefines.h>
@@ -27,8 +23,6 @@
2723
#include <dispnodelist.h>
2824
#include <SingleLinkList.h>
2925

30-
typedef unsigned short BOOLEAN;
31-
3226
//#define NUM_CMDMGR_CMDS 9
3327
// this is the number of columns that contain cmds (as opposed
3428
// to state info)
@@ -115,7 +109,7 @@ class ReplicateList : public SingleLinkList {
115109
return new ReplicateLinkNode;
116110
}
117111

118-
BOOLEAN IsOnList( MgrNode * mn );
112+
bool IsOnList( MgrNode * mn );
119113
ReplicateLinkNode * FindNode( MgrNode * mn );
120114

121115
ReplicateLinkNode * AddNode( MgrNode * rn ) {
@@ -125,8 +119,8 @@ class ReplicateList : public SingleLinkList {
125119
return node;
126120
}
127121

128-
BOOLEAN Remove( ReplicateLinkNode * rln );
129-
BOOLEAN Remove( MgrNode * rn );
122+
bool Remove( ReplicateLinkNode * rln );
123+
bool Remove( MgrNode * rn );
130124

131125
const char * ClassName() {
132126
return "ReplicateList";
@@ -195,14 +189,8 @@ class CmdMgr {
195189
( mn->DisplayState() == mappedView ) ) ?
196190
mn->ChangeList( closeList ) : 0;
197191
}
198-
/*
199-
// { if(mn->DisplayState() == mappedWrite ||
200-
// mn->DisplayState() == mappedView)
201-
// return mn->ChangeList(closeList);
202-
// else return 0;
203-
// }
204-
*/
205-
int ReplicateCmdList( MgrNode * mn );
192+
193+
void ReplicateCmdList( MgrNode * mn );
206194

207195
void ClearInstances();
208196
protected:

src/cleditor/instmgr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323

2424

25-
typedef unsigned boolean;
2625
extern char * EntityClassName( char * );
2726

2827
// IT IS VERY IMPORTANT THAT THE ORDER OF THE FOLLOWING INCLUDE FILES

src/clstepcore/ExpDict.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ class SchRename {
11351135
int operator< ( SchRename & schrnm ) {
11361136
return ( strcmp( schName, schrnm.schName ) < 0 );
11371137
}
1138-
int choice( const char * nm ) const;
1138+
bool choice( const char * nm ) const;
11391139
// is nm one of our possible choices?
11401140
char * rename( const char * schm, char * newnm ) const;
11411141
// given a schema name, returns new object name if exists
@@ -1282,9 +1282,9 @@ class TypeDescriptor {
12821282
protected:
12831283
// Functions used to check the current name of the type (may
12841284
// != _name if altNames has diff name for current schema).
1285-
int PossName( const char * ) const;
1286-
int OurName( const char * ) const;
1287-
int AltName( const char * ) const;
1285+
bool PossName( const char * ) const;
1286+
bool OurName( const char * ) const;
1287+
bool AltName( const char * ) const;
12881288

12891289
public:
12901290

@@ -1416,7 +1416,7 @@ class TypeDescriptor {
14161416
const char * schNm = 0 ) const {
14171417
return ( CurrName( n, schNm ) ? this : 0 );
14181418
}
1419-
int CurrName( const char *, const char * = 0 ) const;
1419+
bool CurrName( const char *, const char * = 0 ) const;
14201420
void addAltName( const char * schnm, const char * newnm );
14211421
// Adds an additional name, newnm, to be use when schema schnm
14221422
// is USE/REFERENCE'ing us (added to altNames).

src/clstepcore/ExpDict.inline.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ const TypeDescriptor * TypeDescriptor::BaseTypeIsA( const TypeDescriptor * td )
254254
* case if schNm USEs or REFERENCEs type and renames it in the process
255255
* (e.g., "USE (X as Y)".
256256
*/
257-
int TypeDescriptor::CurrName( const char * other, const char * schNm ) const {
257+
bool TypeDescriptor::CurrName( const char * other, const char * schNm ) const {
258258
if( !schNm || *schNm == '\0' ) {
259259
// If there's no current schema, accept any possible name of this.
260260
// (I.e., accept its actual name or any substitute):
@@ -274,19 +274,19 @@ int TypeDescriptor::CurrName( const char * other, const char * schNm ) const {
274274
/**
275275
* return true if nm is either our name or one of the possible alternates.
276276
*/
277-
int TypeDescriptor::PossName( const char * nm ) const {
277+
bool TypeDescriptor::PossName( const char * nm ) const {
278278
return ( OurName( nm ) || AltName( nm ) );
279279
}
280280

281-
int TypeDescriptor::OurName( const char * nm ) const {
281+
bool TypeDescriptor::OurName( const char * nm ) const {
282282
return !StrCmpIns( nm, _name );
283283
}
284284

285-
int TypeDescriptor::AltName( const char * nm ) const {
285+
bool TypeDescriptor::AltName( const char * nm ) const {
286286
if( altNames ) {
287287
return ( altNames->choice( nm ) );
288288
}
289-
return 0;
289+
return false;
290290
}
291291

292292
/**
@@ -316,14 +316,14 @@ void TypeDescriptor::addAltName( const char * schnm, const char * newnm ) {
316316
* See if nm = one of our choices (either ours or that of a SchRename
317317
* later in the list.
318318
*/
319-
int SchRename::choice( const char * nm ) const {
319+
bool SchRename::choice( const char * nm ) const {
320320
if( !StrCmpIns( nm, newName ) ) {
321-
return 1;
321+
return true;
322322
}
323323
if( next ) {
324324
return ( next->choice( nm ) );
325325
}
326-
return 0;
326+
return false;
327327
}
328328

329329
/**

src/clstepcore/Registry.inline.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ SDAI_Application_instance * Registry::ObjCreate( const char * nm, const char * s
273273
( ( EntityDescriptor * )entd ) -> NewSTEPentity();
274274

275275
// See comment in previous function.
276-
if( entd->AbstractEntity().asInt() == TRUE ) {
276+
if( entd->AbstractEntity().asInt() == true ) {
277277
se->Error().severity( SEVERITY_WARNING );
278278
se->Error().UserMsg( "ENTITY is abstract supertype" );
279-
} else if( entd->ExtMapping().asInt() == TRUE ) {
279+
} else if( entd->ExtMapping().asInt() == true ) {
280280
se->Error().severity( SEVERITY_WARNING );
281281
se->Error().UserMsg( "ENTITY requires external mapping" );
282282
}

src/clstepcore/STEPcomplex.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ STEPcomplex::Initialize( const char ** names, const char * schnm )
7070
enDesc = _registry->FindEntity( *eptr, schnm );
7171
if( enDesc ) {
7272
if( enDesc->Supertypes().EntryCount() > 1 ) {
73-
eptr->multSuprs( TRUE );
73+
eptr->multSuprs( true );
7474
}
7575
if( StrCmpIns( *eptr, enDesc->Name() ) ) {
7676
// If this entity was referred by another name rather than the

src/clstepcore/collect.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ ComplexList * ComplexCollect::find( char * name ) {
8686
* Determines if the parent schema supports the instantiation of a complex
8787
* type consisting of the the entities named in ents. Does so by attempt-
8888
* ing to match ents against the ComplexLists in clists. If one of the
89-
* nodes of ents has multSupers set to TRUE (it has >1 supertype), it
89+
* nodes of ents has multSupers set to true (it has >1 supertype), it
9090
* should be included in >1 CList. A more complicated algorithm is applied
9191
* to match it, as described in the commenting.
9292
*/
93-
int ComplexCollect::supports( EntNode * ents ) const {
93+
bool ComplexCollect::supports( EntNode * ents ) const {
9494
EntNode * node = ents, *nextnode;
9595
AndList * alist = 0;
9696
ComplexList * clist = clists, *cl = NULL, *current;
97-
int retval;
97+
bool retval;
9898
EntList * elist, *next;
9999

100100
// Loop through the nodes of ents. If 1+ of them have >1 supertype, build
@@ -137,15 +137,15 @@ int ComplexCollect::supports( EntNode * ents ) const {
137137
// which had mult supers. Simply go through each CList separately:
138138
while( clist != NULL ) {
139139
if( clist->matches( ents ) ) {
140-
return TRUE;
140+
return true;
141141
}
142142
clist = clist->next;
143143
}
144144
// Went through whole list without match:
145-
return FALSE;
145+
return false;
146146
} else {
147147
// Use cl to test that the conditions of all supertypes are met:
148-
cl->multSupers = TRUE;
148+
cl->multSupers = true;
149149
cl->buildList();
150150
retval = cl->matches( ents );
151151

0 commit comments

Comments
 (0)