remove P21CommentRep, change return type of P21Comment to std::string
This commit is contained in:
parent
0b42e29c2f
commit
219957d2bb
4 changed files with 26 additions and 44 deletions
|
|
@ -2267,7 +2267,7 @@ STEPfile::WriteHeader( ostream & out ) {
|
|||
void
|
||||
STEPfile::WriteHeaderInstance( SCLP23( Application_instance )* obj, ostream & out ) {
|
||||
std::string tmp;
|
||||
if( obj->P21CommentRep() ) {
|
||||
if( !obj->P21Comment().empty() ) {
|
||||
out << obj->P21Comment();
|
||||
}
|
||||
out << StrToUpper( obj->EntityName(), tmp ) << "(";
|
||||
|
|
|
|||
|
|
@ -508,8 +508,8 @@ void STEPcomplex::STEPread_error( char c, int index, istream & in ) {
|
|||
** original names but not according to their renamed names (DAR 6/5/97).
|
||||
*/
|
||||
void STEPcomplex::STEPwrite( ostream & out, const char * currSch, int writeComment ) {
|
||||
if( writeComment && p21Comment && !p21Comment->empty() ) {
|
||||
out << p21Comment->c_str();
|
||||
if( writeComment && !p21Comment.empty() ) {
|
||||
out << p21Comment;
|
||||
}
|
||||
out << "#" << STEPfile_id << "=(";
|
||||
WriteExtMapEntities( out, currSch );
|
||||
|
|
|
|||
|
|
@ -30,13 +30,12 @@ SCLP23( Application_instance ) NilSTEPentity;
|
|||
*/
|
||||
|
||||
SCLP23( Application_instance )::SCLP23_NAME( Application_instance )()
|
||||
: _cur( 0 ), STEPfile_id( 0 ), p21Comment( 0 ), headMiEntity( 0 ), nextMiEntity( 0 ),
|
||||
: _cur( 0 ), STEPfile_id( 0 ), headMiEntity( 0 ), nextMiEntity( 0 ),
|
||||
_complex( 0 ) {
|
||||
}
|
||||
|
||||
SCLP23( Application_instance )::SCLP23_NAME( Application_instance )( int fileid, int complex )
|
||||
: _cur( 0 ), STEPfile_id( fileid ), p21Comment( 0 ),
|
||||
headMiEntity( 0 ), nextMiEntity( 0 ), _complex( complex ) {
|
||||
: _cur( 0 ), STEPfile_id( fileid ), headMiEntity( 0 ), nextMiEntity( 0 ), _complex( complex ) {
|
||||
}
|
||||
|
||||
SCLP23( Application_instance )::~SCLP23_NAME( Application_instance )() {
|
||||
|
|
@ -45,7 +44,6 @@ SCLP23( Application_instance )::~SCLP23_NAME( Application_instance )() {
|
|||
if( MultipleInheritance() ) {
|
||||
delete nextMiEntity;
|
||||
}
|
||||
delete p21Comment;
|
||||
}
|
||||
|
||||
SCLP23( Application_instance ) * SCLP23( Application_instance )::Replicate() {
|
||||
|
|
@ -68,34 +66,26 @@ SCLP23( Application_instance ) * SCLP23( Application_instance )::Replicate() {
|
|||
}
|
||||
}
|
||||
|
||||
void SCLP23( Application_instance )::AddP21Comment( const char * s, int replace ) {
|
||||
void SCLP23( Application_instance )::AddP21Comment( const char * s, bool replace ) {
|
||||
if( replace ) {
|
||||
delete p21Comment;
|
||||
p21Comment = 0;
|
||||
p21Comment.clear();
|
||||
}
|
||||
if( s ) {
|
||||
if( !p21Comment ) {
|
||||
p21Comment = new std::string( "" );
|
||||
} else {
|
||||
p21Comment->clear();
|
||||
}
|
||||
p21Comment->append( s );
|
||||
//NOTE MAP Sept 2011 - originally, this cleared and then appended -
|
||||
// I don't think that's right, since it makes 'replace' useless
|
||||
//Also, function name contains 'Add', not 'Set'
|
||||
p21Comment.append( s );
|
||||
}
|
||||
}
|
||||
|
||||
void SCLP23( Application_instance )::AddP21Comment( std::string & s, int replace ) {
|
||||
void SCLP23( Application_instance )::AddP21Comment( const std::string & s, bool replace ) {
|
||||
if( replace ) {
|
||||
delete p21Comment;
|
||||
p21Comment = 0;
|
||||
}
|
||||
if( !s.empty() ) {
|
||||
if( !p21Comment ) {
|
||||
p21Comment = new std::string( "" );
|
||||
} else {
|
||||
p21Comment->clear();
|
||||
}
|
||||
p21Comment->append( const_cast<char *>( s.c_str() ) );
|
||||
p21Comment.clear();
|
||||
}
|
||||
//NOTE MAP Sept 2011 - originally, this cleared and then appended -
|
||||
// I don't think that's right, since it makes 'replace' useless
|
||||
//Also, function name contains 'Add', not 'Set'
|
||||
p21Comment.append( s );
|
||||
}
|
||||
|
||||
void SCLP23( Application_instance )::STEPwrite_reference( ostream & out ) {
|
||||
|
|
@ -282,8 +272,8 @@ void SCLP23( Application_instance )::beginSTEPwrite( ostream & out ) {
|
|||
void SCLP23( Application_instance )::STEPwrite( ostream & out, const char * currSch,
|
||||
int writeComments ) {
|
||||
std::string tmp;
|
||||
if( writeComments && p21Comment && !p21Comment->empty() ) {
|
||||
out << p21Comment->c_str();
|
||||
if( writeComments && !p21Comment.empty() ) {
|
||||
out << p21Comment;
|
||||
}
|
||||
out << "#" << STEPfile_id << "=" << StrToUpper( EntityName( currSch ), tmp )
|
||||
<< "(";
|
||||
|
|
@ -310,8 +300,8 @@ void SCLP23( Application_instance )::WriteValuePairs( ostream & out,
|
|||
int writeComments, int mixedCase ) {
|
||||
std::string s, tmp, tmp2;
|
||||
|
||||
if( writeComments && p21Comment && !p21Comment->empty() ) {
|
||||
out << p21Comment->c_str();
|
||||
if( writeComments && !p21Comment.empty() ) {
|
||||
out << p21Comment;
|
||||
}
|
||||
if( mixedCase ) {
|
||||
out << "#" << STEPfile_id << " "
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
|
|||
STEPattributeList attributes;
|
||||
int STEPfile_id;
|
||||
ErrorDescriptor _error;
|
||||
std::string *p21Comment;
|
||||
std::string p21Comment;
|
||||
// registry additions
|
||||
EntityDescriptor *eDesc;
|
||||
|
||||
|
|
@ -53,19 +53,11 @@ class SCLP23_NAME(Application_instance) : public SCLP23_NAME(DAObject_SDAI)
|
|||
void StepFileId (int fid) { STEPfile_id = fid; }
|
||||
int StepFileId() const { return STEPfile_id; }
|
||||
|
||||
void AddP21Comment(std::string &s, int replace = 1);
|
||||
void AddP21Comment(const char *s, int replace = 1);
|
||||
void DeleteP21Comment() { delete p21Comment; p21Comment = 0; }
|
||||
void AddP21Comment(const std::string &s, bool replace = true);
|
||||
void AddP21Comment(const char *s, bool replace = true);
|
||||
void DeleteP21Comment() { p21Comment = ""; }
|
||||
|
||||
/// guaranteed a string (may be null string)
|
||||
const char *P21Comment()
|
||||
{ return ( p21Comment ? const_cast<char *>(p21Comment->c_str()) : "" ); }
|
||||
/** returns null if no comment exists
|
||||
// NOTE: Jul-24-2011, confirm that we want to change p21Comment->rep() to
|
||||
// const_cast<char *>(p21Comment->c_str())
|
||||
*/
|
||||
const char *P21CommentRep()
|
||||
{ return ( p21Comment ? const_cast<char *>(p21Comment->c_str()) : 0 ); }
|
||||
const std::string P21Comment() const { return p21Comment; }
|
||||
|
||||
const char *EntityName( const char *schnm =NULL) const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue