File tree Expand file tree Collapse file tree 5 files changed +24
-27
lines changed
Expand file tree Collapse file tree 5 files changed +24
-27
lines changed Original file line number Diff line number Diff line change @@ -19,11 +19,8 @@ SDAI_String & SDAI_String::operator= ( const char * s ) {
1919
2020void SDAI_String::STEPwrite ( ostream & out ) const {
2121 const char * str = 0 ;
22- // strings that exist but do not contain any chars should be written as '',
23- // not $ --Josh L, 4/28/95
24- // if (is_null ())
2522 if ( empty () ) {
26- out << " $ " ;
23+ out << " \'\' " ;
2724 } else {
2825 out << " \' " ;
2926 str = c_str ();
@@ -40,11 +37,8 @@ void SDAI_String::STEPwrite( ostream & out ) const {
4037
4138void SDAI_String::STEPwrite ( std::string & s ) const {
4239 const char * str = 0 ;
43- // null strings should be represented by '', not $ --Josh L, 4/28/95
44- // if (is_null ())
4540 if ( empty () ) {
46- // s.set_null(); // this would free up space? nope
47- s = " $" ;
41+ s = " \'\' " ;
4842 } else {
4943 s = " \' " ;
5044 str = c_str ();
Original file line number Diff line number Diff line change @@ -538,7 +538,7 @@ class Global_rule : public Dictionary_instance {
538538 return _parent_schema;
539539 }
540540 const char * rule_text_ () {
541- return const_cast < char *>( _rule_text.c_str () );
541+ return _rule_text.c_str ();
542542 }
543543
544544 void name_ ( Express_id & n ) {
@@ -1558,7 +1558,7 @@ class EntityDescriptor : public TypeDescriptor {
15581558 _supertype_stmt = s;
15591559 }
15601560 const char * Supertype_Stmt () {
1561- return const_cast < char *>( _supertype_stmt.c_str () );
1561+ return _supertype_stmt.c_str ();
15621562 }
15631563 std::string & supertype_stmt_ () {
15641564 return _supertype_stmt;
Original file line number Diff line number Diff line change @@ -791,20 +791,8 @@ int STEPattribute::is_null() const {
791791 }
792792}
793793
794- /* *****************************************************************
795- ** Procedure: operator ==
796- ** Parameters: STEPattribute & a1 and a2
797- ** Returns: int -- if 0 => not equal
798- ** Description: evaluates the equality of two attributes
799- ** Side Effects: none
800- ** Status: stub -- needs alot of work
801- ******************************************************************/
802- int operator == ( STEPattribute & a1, STEPattribute & a2 ) {
803- cerr << " Internal error: " << __FILE__ << " : " << __LINE__
804- << " \n " << _POC_ " \n " ;
805- if ( a1.aDesc ->NonRefType () == a2.aDesc ->NonRefType () )
806- ;
807- return 0 ;
794+ bool operator == ( STEPattribute & a1, STEPattribute & a2 ) {
795+ return a1.aDesc == a2.aDesc ;
808796}
809797
810798
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ class STEPattribute {
226226 // UNDEFINED
227227 STEPattribute ( const class AttrDescriptor & d, SCLundefined * p );
228228
229- friend int operator == ( STEPattribute & a1, STEPattribute & a2 );
229+ friend bool operator == ( STEPattribute & a1, STEPattribute & a2 );
230230};
231231
232232#endif
Original file line number Diff line number Diff line change @@ -54,8 +54,23 @@ int STEPattributeList::list_length() {
5454}
5555
5656void STEPattributeList::push ( STEPattribute * a ) {
57- AttrListNode * saln = new AttrListNode ( a );
58- AppendNode ( saln );
57+ bool push = true ;
58+
59+ // if the attribute already exists in the list, we don't push it
60+ // TODO: does it break anything?
61+ AttrListNode * a2 = ( AttrListNode * )head;
62+ while ( a2 && push ) {
63+ if ( *a == *( a2 -> attr ) ) {
64+ push = false ;
65+ break ;
66+ }
67+ a2 = ( AttrListNode * )( a2->next );
68+ }
69+
70+ if ( push ) {
71+ AttrListNode * saln = new AttrListNode ( a );
72+ AppendNode ( saln );
73+ }
5974}
6075
6176
You can’t perform that action at this time.
0 commit comments