streams do not need strings converted with c_str()

This commit is contained in:
Mark Pictor
2011-09-26 17:26:36 -04:00
parent 239ce49af1
commit b759a0ee97
8 changed files with 34 additions and 34 deletions
+8 -8
View File
@@ -588,7 +588,7 @@ STEPfile::ReadData1( istream & in ) {
tmpbuf.clear();
FindStartOfInstance( in, tmpbuf );
cout << "ERROR: trying to recover from invalid data. skipping: "
<< tmpbuf.c_str() << endl;
<< tmpbuf << endl;
in >> c;
ReadTokenSeparator( in );
}
@@ -698,7 +698,7 @@ STEPfile::ReadData1( istream & in ) {
tmpbuf.set_null();
SkipInstance( in, tmpbuf );
cout << "ERROR: trying to recover from invalid data. skipping: "
<< tmpbuf.c_str() << endl;
<< tmpbuf << endl;
ReadTokenSeparator( in );
}
@@ -771,7 +771,7 @@ STEPfile::ReadData1( istream & in ) {
tmpbuf.set_null();
SkipInstance( in, tmpbuf );
cout << "ERROR: trying to recover from invalid data. skipping: "
<< tmpbuf.c_str() << endl;
<< tmpbuf << endl;
ReadTokenSeparator( in );
}
if( c == ENTITY_NAME_DELIM ) {
@@ -1005,7 +1005,7 @@ STEPfile::ReadData2( istream & in, int useTechCor ) {
tmpbuf.clear();
FindStartOfInstance( in, tmpbuf );
cout << "ERROR: trying to recover from invalid data. skipping: "
<< tmpbuf.c_str() << endl;
<< tmpbuf << endl;
in >> c;
ReadTokenSeparator( in, &cmtStr );
}
@@ -1178,7 +1178,7 @@ STEPfile::ReadData2( istream & in ) {
tmpbuf.set_null();
SkipInstance( in, tmpbuf );
cout << "ERROR: trying to recover from invalid data. skipping: "
<< tmpbuf.c_str() << endl;
<< tmpbuf << endl;
ReadTokenSeparator( in );
}
@@ -1512,7 +1512,7 @@ STEPfile::CreateInstance( istream & in, ostream & out ) {
SkipInstance( in, tmpbuf );
out << "WARNING: instance #" << fileid
<< " User Defined Entity in DATA section ignored.\n"
<< "\tData lost: \'!" << objnm.c_str() << "\': " << tmpbuf
<< "\tData lost: \'!" << objnm << "\': " << tmpbuf
<< endl;
return ENTITY_NULL;
} else {
@@ -1539,7 +1539,7 @@ STEPfile::CreateInstance( istream & in, ostream & out ) {
if( obj == ENTITY_NULL ) {
SkipInstance( in, tmpbuf );
out << "ERROR: instance #" << fileid << " \'" << objnm.c_str()
out << "ERROR: instance #" << fileid << " \'" << objnm
<< "\': " << result.UserMsg()
<< ".\n\tData lost: " << tmpbuf << "\n\n";
return ENTITY_NULL;
@@ -1990,7 +1990,7 @@ STEPfile::ReadInstance( istream & in, ostream & out, std::string & cmtStr,
SkipInstance( in, tmpbuf );
out << "WARNING: #" << fileid <<
". Ignoring User defined entity.\n\tdata lost: !"
<< objnm.c_str() << tmpbuf << "\n";
<< objnm << tmpbuf << "\n";
++_warningCount;
return ENTITY_NULL;
}
+7 -7
View File
@@ -477,10 +477,10 @@ Schema::GenerateUseRefExpress( ostream & out ) const {
}
if( !( ( *( is->explicit_items_() ) )[k]->original_id_().size() ) ) {
// not renamed
out << ( *( is->explicit_items_() ) )[k]->new_id_().c_str();
out << ( *( is->explicit_items_() ) )[k]->new_id_();
} else { // renamed
out << ( *( is->explicit_items_() ) )[k]->original_id_().c_str();
out << " AS " << ( *( is->explicit_items_() ) )[k]->new_id_().c_str();
out << ( *( is->explicit_items_() ) )[k]->original_id_();
out << " AS " << ( *( is->explicit_items_() ) )[k]->new_id_();
}
}
out << ");" << endl;
@@ -505,7 +505,7 @@ Schema::GenerateUseRefExpress( ostream & out ) const {
if( count > 0 ) {
// out << " REFERENCE FROM " << (*(is->explicit_items_()))[0]->foreign_schema_().c_str() << endl;
// out << " REFERENCE FROM " << (*(is->explicit_items_()))[0]->foreign_schema_() << endl;
out << endl << " REFERENCE FROM "
<< StrToLower( is->foreign_schema_id_().c_str(), tmp ) << endl;
out << " (";
@@ -519,11 +519,11 @@ Schema::GenerateUseRefExpress( ostream & out ) const {
}
if( ( !( *( is->explicit_items_() ) )[k]->original_id_().size() ) ) {
// not renamed
out << ( *( is->explicit_items_() ) )[k]->new_id_().c_str();
out << ( *( is->explicit_items_() ) )[k]->new_id_();
} else { // renamed
out << ( *( is->explicit_items_() ) )[k]->original_id_().c_str();
out << ( *( is->explicit_items_() ) )[k]->original_id_();
out << " AS "
<< ( *( is->explicit_items_() ) )[k]->new_id_().c_str();
<< ( *( is->explicit_items_() ) )[k]->new_id_();
}
}
out << ");" << endl;
+3 -3
View File
@@ -299,7 +299,7 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
instance_set, in,
currSch );
else {
cout << "ERROR: complex entity part \"" << typeNm.c_str()
cout << "ERROR: complex entity part \"" << typeNm
<< "\" does not exist.\n";
_error.AppendToDetailMsg(
"Complex entity part of instance does not exist.\n" );
@@ -361,7 +361,7 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
in.putback( c );
}
cout << s.c_str() << endl;
cout << s << endl;
BuildAttrs( s.c_str() );
SCLP23( Application_instance )::STEPread( id, addFileId, instance_set,
in, currSch );
@@ -389,7 +389,7 @@ Severity STEPcomplex::STEPread( int id, int addFileId, class InstMgr * instance_
in.putback( c );
}
cout << s.c_str() << endl; // diagnostics DAS
cout << s << endl; // diagnostics DAS
STEPcomplex * stepc = new STEPcomplex( _registry );
AppendEntity( stepc );
+3 -3
View File
@@ -56,14 +56,14 @@ Severity SCLundefined::STEPread( istream & in, ErrorDescriptor * err ) {
in.putback( c );
PushPastImbedAggr( in, str, err );
ss << str.c_str();
ss << str;
break;
case '\'':
in.putback( c );
PushPastString( in, str, err );
ss << str.c_str();
ss << str;
break;
case ',':
@@ -118,7 +118,7 @@ void SCLundefined:: STEPwrite( ostream & out ) {
if( val.empty()) {
out << "$";
} else {
out << val.c_str();
out << val;
}
}
+1 -1
View File
@@ -82,7 +82,7 @@ ErrorDescriptor::GetCorrSeverity( const char * s ) {
if( s && s[0] != 0 ) {
std::string s2;
StrToUpper( s, s2 );
// cout << "s after if is (" << s << ") \n" << "s2 is (" << s2.c_str() << ")\n";
// cout << "s after if is (" << s << ") \n" << "s2 is (" << s2 << ")\n";
if( !strcmp( s2.c_str(), "SEVERITY_NULL" ) ) {
// cout << "SEVERITY_NULL" << endl;
return SEVERITY_NULL;
+5 -5
View File
@@ -929,14 +929,14 @@ AGGRprint_access_methods( CONST char * entnm, Variable a, FILE * file, Type t,
fprintf( file, " {\n" );
fprintf( file, "\t(*seq)[i] = CORBA::string_dupl( ((StringNode*)n)->value.c_str() );\n" );
fprintf( file, "\tstd::cout << \"returning entity %s, attr _%s: aggr string element: \" << ((StringNode*)n)->value.c_str() << std::endl;\n", entnm, attrnm );
fprintf( file, "\tstd::cout << \"returning entity %s, attr _%s: aggr string element: \" << ((StringNode*)n)->value << std::endl;\n", entnm, attrnm );
/* /////////////////////////////////////////// */
if( print_logging ) {
fprintf( file, "#ifdef SCL_LOGGING\n" );
fprintf( file, "\tif(*logStream)\n\t{\n" );
fprintf( file,
"\t logStream->open(SCLLOGFILE,ios::app);\n" );
fprintf( file, "\t *logStream << time(NULL) << \" SDAI returning entity: %s, attr: _%s, aggr string element: \" << ((StringNode*)n)->value.c_str() << std::endl;\n", entnm, attrnm );
fprintf( file, "\t *logStream << time(NULL) << \" SDAI returning entity: %s, attr: _%s, aggr string element: \" << ((StringNode*)n)->value << std::endl;\n", entnm, attrnm );
fprintf( file, "\t logStream->close();\n" );
fprintf( file, "\t}\n" );
fprintf( file, "#endif\n" );
@@ -1216,14 +1216,14 @@ AGGRprint_access_methods( CONST char * entnm, Variable a, FILE * file, Type t,
fprintf( file, "\t _%s.AppendNode( (StringNode*)n );\n", attrnm );
fprintf( file, "\t}\n" );
fprintf( file, "\t((StringNode*)n)->value = x[i];\n");
fprintf( file, "\tstd::cout << \"Assigning aggr string element: \" << ((StringNode*)n)->value.c_str();\n" );
fprintf( file, "\tstd::cout << \"Assigning aggr string element: \" << ((StringNode*)n)->value;\n" );
/* /////////////////////////////////////////// */
if( print_logging ) {
fprintf( file, "#ifdef SCL_LOGGING\n" );
fprintf( file, "\tif(*logStream)\n\t{\n" );
fprintf( file,
"\t logStream->open(SCLLOGFILE,ios::app);\n" );
fprintf( file, "\t *logStream << time(NULL) << \" SDAI assigning entity: %s, attr: _%s, aggr string element: \" << ((StringNode*)n)->value.c_str() << std::endl;\n", entnm, attrnm );
fprintf( file, "\t *logStream << time(NULL) << \" SDAI assigning entity: %s, attr: _%s, aggr string element: \" << ((StringNode*)n)->value << std::endl;\n", entnm, attrnm );
fprintf( file, "\t logStream->close();\n" );
fprintf( file, "\t}\n" );
fprintf( file, "#endif\n" );
@@ -1536,7 +1536,7 @@ ATTRprint_access_methods( CONST char * entnm, Variable a, FILE * file ) {
fprintf( file, "\t *logStream << time(NULL) << \" SDAI %s::%s() returned: \";\n",
entnm, funcnm );
fprintf( file,
"\t *logStream << _%s.c_str() << std::endl;\n", attrnm );
"\t *logStream << _%s << std::endl;\n", attrnm );
fprintf( file, "\t}\n\telse\n\t{\n" );
fprintf( file, "\t *logStream << time(NULL) << \" SDAI %s::%s() returned: \";\n",
entnm, funcnm );
+6 -6
View File
@@ -1486,19 +1486,19 @@ TYPEselect_lib_part21( const Type type, FILE * f, Schema schema ) {
case integer_:
/* fprintf(f, " out << \"%s(\" << _%s << \")\";\n else ",
StrToUpper(TYPEget_name(t)), dm);*/
fprintf( f, " out << tmp.c_str() << \"(\" << _%s << \")\";\n else ",
fprintf( f, " out << tmp << \"(\" << _%s << \")\";\n else ",
dm );
break;
case real_:
case number_:
fprintf( f, " {\n out << tmp.c_str() << \"(\";\n" );
fprintf( f, " {\n out << tmp << \"(\";\n" );
fprintf( f, " WriteReal(_%s,out);\n", dm );
fprintf( f, " out << \")\";\n }\n else " );
break;
case entity_:
fprintf( f, " {\n out << tmp.c_str() << \"(\";\n" );
fprintf( f, " {\n out << tmp << \"(\";\n" );
fprintf( f, " _%s -> STEPwrite_reference (out);\n", dm );
fprintf( f, " out << \")\";\n }\n else " );
break;
@@ -1507,7 +1507,7 @@ TYPEselect_lib_part21( const Type type, FILE * f, Schema schema ) {
case logical_:
case boolean_:
case binary_:
fprintf( f, " {\n out << tmp.c_str() << \"(\";\n" );
fprintf( f, " {\n out << tmp << \"(\";\n" );
fprintf( f, " _%s.STEPwrite (out);\n", dm );
fprintf( f, " out << \")\";\n }\n else " );
break;
@@ -1517,12 +1517,12 @@ TYPEselect_lib_part21( const Type type, FILE * f, Schema schema ) {
case set_:
case list_:
/* Aggregates need currSch passed since they may be aggrs of sels. */
fprintf( f, " {\n out << tmp.c_str() << \"(\";\n" );
fprintf( f, " {\n out << tmp << \"(\";\n" );
fprintf( f, " _%s.STEPwrite (out, currSch);\n", dm );
fprintf( f, " out << \")\";\n }\n else " );
break;
case select_:
fprintf( f, " {\n out << tmp.c_str() << \"(\";\n" );
fprintf( f, " {\n out << tmp << \"(\";\n" );
fprintf( f, " _%s.STEPwrite_verbose (out, currSch);\n", dm );
fprintf( f, " out << \")\";\n }\n else " );
break;
@@ -72,7 +72,7 @@ main() {
str.Append( StrToLower( schema->Name(), tmp ) );
str.Append( ".exp" );
efile = new ofstream( str.c_str() );
cout << "Generating: " << str.c_str() << endl;
cout << "Generating: " << str << endl;
schema->GenerateExpress( *efile );
efile->close();
delete efile;