Commit 216d8284 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Reimplemented TNL::String using std::string

parent 6cd36434
Loading
Loading
Loading
Loading
+11 −9
Original line number Original line Diff line number Diff line
@@ -12,6 +12,8 @@


#include <vector>
#include <vector>


#include <TNL/String.h>

namespace TNL {
namespace TNL {
namespace Config {
namespace Config {


@@ -34,7 +36,7 @@ struct ConfigEntryType


   bool list_entry;
   bool list_entry;


   ConfigEntryType() {}
   ConfigEntryType() = default;


   ConfigEntryType( const String& _basic_type,
   ConfigEntryType( const String& _basic_type,
                    const bool _list_entry )
                    const bool _list_entry )
@@ -44,7 +46,7 @@ struct ConfigEntryType


   void Reset()
   void Reset()
   {
   {
      basic_type. setString( 0 );
      basic_type.clear();
      list_entry = false;
      list_entry = false;
   }
   }
};
};
+1 −1
Original line number Original line Diff line number Diff line
@@ -193,7 +193,7 @@ SystemInfo::parseCPUInfo( void )
      {
      {
         i = strlen( "model name" );
         i = strlen( "model name" );
         while( line[ i ] != ':' && line[ i ] ) i ++;
         while( line[ i ] != ':' && line[ i ] ) i ++;
         info.CPUModelName.setString( &line[ i + 1 ] );
         info.CPUModelName = &line[ i + 1 ];
         continue;
         continue;
      }
      }
      if( strncmp( line, "cpu cores", strlen( "cpu cores" ) ) == 0 )
      if( strncmp( line, "cpu cores", strlen( "cpu cores" ) ) == 0 )
+6 −8
Original line number Original line Diff line number Diff line
@@ -94,20 +94,18 @@ inline String FileName::getFileName()


inline String getFileExtension( const String fileName )
inline String getFileExtension( const String fileName )
{
{
   int size = fileName. getLength();
   const int size = fileName.getLength();
   int i = 1;
   int i = 1;
   while( fileName. getString()[ size - i ] != '.' && size > i  ) i ++ ;
   while( fileName[ size - i ] != '.' && size > i ) i++;
   String result;
   return fileName.substr( size - i + 1 );
   result.setString( fileName. getString(), size - i + 1 );
   return result;
}
}


inline void removeFileExtension( String& fileName )
inline void removeFileExtension( String& fileName )
{
{
   int size = fileName. getLength();
   const int size = fileName.getLength();
   int i = 1;
   int i = 1;
   while( fileName. getString()[ size - i ] != '.' && size > i  ) i ++ ;
   while( fileName[ size - i ] != '.' && size > i ) i++;
   fileName. setString( fileName. getString(), 0, i );
   fileName = fileName.substr( 0, size - i + 1 );
}
}


} // namespace TNL
} // namespace TNL
+5 −5
Original line number Original line Diff line number Diff line
@@ -92,7 +92,7 @@ bool MatrixReader< Matrix >::verifyMtxFile( std::istream& file,
   IndexType processedElements( 0 );
   IndexType processedElements( 0 );
   Timer timer;
   Timer timer;
   timer.start();
   timer.start();
   while( line.getLine( file ) )
   while( std::getline( file, line ) )
   {
   {
      if( line[ 0 ] == '%' ) continue;
      if( line[ 0 ] == '%' ) continue;
      if( ! dimensionsLine )
      if( ! dimensionsLine )
@@ -141,7 +141,7 @@ bool MatrixReader< Matrix >::findLineByElement( std::istream& file,
   bool symmetricMatrix( false );
   bool symmetricMatrix( false );
   bool dimensionsLine( false );
   bool dimensionsLine( false );
   lineNumber = 0;
   lineNumber = 0;
   while( line.getLine( file ) )
   while( std::getline( file, line ) )
   {
   {
      lineNumber++;
      lineNumber++;
      if( line[ 0 ] == '%' ) continue;
      if( line[ 0 ] == '%' ) continue;
@@ -213,7 +213,7 @@ bool MatrixReader< Matrix >::readMtxHeader( std::istream& file,
   std::vector< String > parsedLine;
   std::vector< String > parsedLine;
   while( true )
   while( true )
   {
   {
      line.getLine( file );
      std::getline( file, line );
      if( ! headerParsed )
      if( ! headerParsed )
      {
      {
         headerParsed = checkMtxHeader( line, symmetric );
         headerParsed = checkMtxHeader( line, symmetric );
@@ -269,7 +269,7 @@ bool MatrixReader< Matrix >::computeCompressedRowLengthsFromMtxFile( std::istrea
   IndexType numberOfElements( 0 );
   IndexType numberOfElements( 0 );
   Timer timer;
   Timer timer;
   timer.start();
   timer.start();
   while( line.getLine( file ) )
   while( std::getline( file, line ) )
   {
   {
      if( line[ 0 ] == '%' ) continue;
      if( line[ 0 ] == '%' ) continue;
      if( ! dimensionsLine )
      if( ! dimensionsLine )
@@ -340,7 +340,7 @@ bool MatrixReader< Matrix >::readMatrixElementsFromMtxFile( std::istream& file,
   IndexType processedElements( 0 );
   IndexType processedElements( 0 );
   Timer timer;
   Timer timer;
   timer.start();
   timer.start();
   while( line.getLine( file ) )
   while( std::getline( file, line ) )
   {
   {
      if( line[ 0 ] == '%' ) continue;
      if( line[ 0 ] == '%' ) continue;
      if( ! dimensionsLine )
      if( ! dimensionsLine )
+2 −2
Original line number Original line Diff line number Diff line
@@ -146,7 +146,7 @@ parseObjectType( const String& objectType )
    */
    */
   while( i < objectTypeLength && objectType[ i ] != '<' )
   while( i < objectTypeLength && objectType[ i ] != '<' )
      i++;
      i++;
   String objectName( objectType.getString(), 0, objectTypeLength - i );
   String objectName = objectType.substr( 0, i );
   parsedObjectType.push_back( objectName );
   parsedObjectType.push_back( objectName );
   i++;
   i++;


@@ -170,7 +170,7 @@ parseObjectType( const String& objectType )
            if( buffer != "" )
            if( buffer != "" )
            {
            {
               parsedObjectType.push_back( buffer.strip( ' ' ) );
               parsedObjectType.push_back( buffer.strip( ' ' ) );
               buffer.setString( "" );
               buffer.clear();
            }
            }
         }
         }
         else buffer += objectType[ i ];
         else buffer += objectType[ i ];
Loading