diff --git a/src/TNL/String.h b/src/TNL/String.h index 6e8ab71925da132d66a89aef20fe1e619b97871e..57219562e7e5c8389f26616f6e97f02742b1f40a 100644 --- a/src/TNL/String.h +++ b/src/TNL/String.h @@ -138,7 +138,7 @@ class String /// This function overloads operator!=(). bool operator!=( char str ) const; - /// \brief Cast to bool operator. + /// \brief Cast to bool operator. Converts string to boolean expression (true or false). operator bool() const; /// \brief Cast to bool with negation operator. @@ -161,25 +161,27 @@ class String /// @param separator Character, which separates substrings in given string. Empty character can not be used. int split( Containers::List< String >& list, const char separator = ' ' ) const; - /// Write to a binary file + /// Writes to a binary file and returns boolean expression based on the success in writing into the file. bool save( File& file ) const; - /// Read from binary file + /// Reads from binary file and returns boolean expression based on the success in reading the file. bool load( File& file ); - //! Broadcast to other nodes in MPI cluster + /// !!! Mozem dat prec??? + // Broadcast to other nodes in MPI cluster // void MPIBcast( int root, MPI_Comm mpi_comm = MPI_COMM_WORLD ); - /// Read one line from given stream. + /// Reads one line from given stream. bool getLine( std::istream& stream ); + ///toto neviem co friend std::ostream& operator<<( std::ostream& stream, const String& str ); protected: - /// Pointer to char ended with zero + /// Pointer to char ended with zero ...Preco? char* string; - /// Length of the allocated piece of memory + /// Length of the allocated piece of memory. int length; @@ -191,6 +193,7 @@ String operator+( char string1, const String& string2 ); /// Returns concatenation of \e string1 and \e string2. String operator+( const char* string1, const String& string2 ); +/// Toto neviem co std::ostream& operator<<( std::ostream& stream, const String& str ); template< typename T > diff --git a/src/UnitTests/StringTest.cpp b/src/UnitTests/StringTest.cpp index f6664673ec6ba7da6ff5058205f0dd08b4e70236..9b85bd728c6db1a731b989cffa5b4bfa808209ac 100644 --- a/src/UnitTests/StringTest.cpp +++ b/src/UnitTests/StringTest.cpp @@ -309,7 +309,7 @@ TEST( StringTest, split ) ASSERT_EQ( list.getSize(), 1 ); EXPECT_EQ( list[ 0 ], "abracadabra" ); - /// !!!! + /// !!!! ma problem s prazdnym stringom !!!! String( "a,,b,c" ).split( list, ',' ); ASSERT_EQ( list.getSize(), 4 ); EXPECT_EQ( list[ 0 ], "a" ); @@ -349,6 +349,12 @@ TEST( StringTest, getLine ) EXPECT_EQ( s, "Line 2" ); }; +/*TEST( StringTest, OperatorCudny ) +{ + String str("String1"); + EXPECT_EQ(strcmp(String( "a", str ), "aString1"), 0 ); +};*/ + #endif