Loading src/TNL/Containers/List.h +4 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,10 @@ template< class T > class List const List& operator = ( const List& lst ); bool operator == ( const List& lst ) const; bool operator != ( const List& lst ) const; //! Append new data element bool Append( const T& data ); Loading src/TNL/Containers/List_impl.h +17 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,23 @@ const List< T >& List< T >::operator = ( const List& lst ) return( *this ); } template< typename T > bool List< T >::operator == ( const List& lst ) const { if( this->getSize() != lst.getSize() ) return false; for( int i = 0; i < this->getSize(); i++ ) if( (*this)[ i ] != lst[ i ] ) return false; return true; } template< typename T > bool List< T >::operator != ( const List& lst ) const { return ! operator==( lst ); } template< typename T > bool List< T >::Append( const T& data ) { Loading src/TNL/Object.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ bool parseObjectType( const String& objectType, /**** * Now, we will extract the parameters. * Each parameter can be template, so we must compute and pair * Each parameter can be template, so we must count and pair * '<' with '>'. */ int templateBrackets( 0 ); Loading @@ -201,13 +201,12 @@ bool parseObjectType( const String& objectType, templateBrackets ++; if( ! templateBrackets ) { if( objectType[ i ] == ' ' || objectType[ i ] == ',' || if( objectType[ i ] == ',' || objectType[ i ] == '>' ) { if( buffer != "" ) { if( ! parsedObjectType. Append( buffer ) ) if( ! parsedObjectType. Append( buffer.strip( ' ' ) ) ) return false; buffer. setString( "" ); } Loading src/TNL/String.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -269,6 +269,23 @@ replace( const String& pattern, this->string = newString; } String String::strip( char strip ) const { int prefix_cut_off = 0; int sufix_cut_off = 0; while( prefix_cut_off < getLength() && (*this)[ prefix_cut_off ] == strip ) prefix_cut_off++; while( sufix_cut_off < getLength() && (*this)[ getLength() - 1 - sufix_cut_off ] == strip ) sufix_cut_off++; if( prefix_cut_off + sufix_cut_off < getLength() ) return String( getString(), prefix_cut_off, sufix_cut_off ); return ""; } const char* String :: getString() const { Loading src/TNL/String.h +2 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,8 @@ class String void replace( const String& pattern, const String& replaceWith ); String strip( char strip = ' ' ) const; // TODO: remove //! Write to a binary file bool save( std::ostream& file ) const; Loading Loading
src/TNL/Containers/List.h +4 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,10 @@ template< class T > class List const List& operator = ( const List& lst ); bool operator == ( const List& lst ) const; bool operator != ( const List& lst ) const; //! Append new data element bool Append( const T& data ); Loading
src/TNL/Containers/List_impl.h +17 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,23 @@ const List< T >& List< T >::operator = ( const List& lst ) return( *this ); } template< typename T > bool List< T >::operator == ( const List& lst ) const { if( this->getSize() != lst.getSize() ) return false; for( int i = 0; i < this->getSize(); i++ ) if( (*this)[ i ] != lst[ i ] ) return false; return true; } template< typename T > bool List< T >::operator != ( const List& lst ) const { return ! operator==( lst ); } template< typename T > bool List< T >::Append( const T& data ) { Loading
src/TNL/Object.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ bool parseObjectType( const String& objectType, /**** * Now, we will extract the parameters. * Each parameter can be template, so we must compute and pair * Each parameter can be template, so we must count and pair * '<' with '>'. */ int templateBrackets( 0 ); Loading @@ -201,13 +201,12 @@ bool parseObjectType( const String& objectType, templateBrackets ++; if( ! templateBrackets ) { if( objectType[ i ] == ' ' || objectType[ i ] == ',' || if( objectType[ i ] == ',' || objectType[ i ] == '>' ) { if( buffer != "" ) { if( ! parsedObjectType. Append( buffer ) ) if( ! parsedObjectType. Append( buffer.strip( ' ' ) ) ) return false; buffer. setString( "" ); } Loading
src/TNL/String.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -269,6 +269,23 @@ replace( const String& pattern, this->string = newString; } String String::strip( char strip ) const { int prefix_cut_off = 0; int sufix_cut_off = 0; while( prefix_cut_off < getLength() && (*this)[ prefix_cut_off ] == strip ) prefix_cut_off++; while( sufix_cut_off < getLength() && (*this)[ getLength() - 1 - sufix_cut_off ] == strip ) sufix_cut_off++; if( prefix_cut_off + sufix_cut_off < getLength() ) return String( getString(), prefix_cut_off, sufix_cut_off ); return ""; } const char* String :: getString() const { Loading
src/TNL/String.h +2 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,8 @@ class String void replace( const String& pattern, const String& replaceWith ); String strip( char strip = ' ' ) const; // TODO: remove //! Write to a binary file bool save( std::ostream& file ) const; Loading