Commit adbe8e81 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Fixing String documentation.

parent c510629f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2107,7 +2107,8 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED             =
PREDEFINED             = HAVE_MPI=1
                         HAVE_CUDA=1

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ int main()
   cout << "list_dates = " << list[0] << ", " << list[1] << ", " << list[2] << endl;

   String cars("Subaru,Mazda,,Skoda," );
   vector< String > list3 = cars.split(',', String::SkipEmpty );
   vector< String > list3 = cars.split(',', String::SplitSkip::SkipEmpty );
   cout << "split with String::SkipEmpty = " << list3[0] << ", " << list3[1] << ", " << list3[2] << endl;
   std::vector<String> list5 = cars.split(',');
   cout << "split without  String::SkipEmpty = " << list5[0] << ", " << list5[1] << ", " << list5[2] << ", " << list5[3] << endl;
+23 −13
Original line number Diff line number Diff line
@@ -26,10 +26,24 @@ class String;
/**
 * \brief Class for managing strings.
 *
 * The following example shows common use of String.
 * 
 * \par Example
 * \include StringExample.cpp
 * \par Output
 * \include StringExample.out
 * 
 * In addition to methods of this class, check the following related functions:
 * 
 * \ref convertToString
 * 
 * \ref operator+
 * 
 * \ref operator<<
 * 
 * \ref mpiSend
 * 
 * \ref mpiReceive
 */
class String
: public std::string
@@ -39,9 +53,9 @@ class String
      /**
       * \brief This enum defines how the operation split of string is to be performed.
       */
      enum SplitSkipEmpty
      enum class SplitSkip
      {
         DoNotSkipEmpty, ///< Do not skip empty characters
         NoSkip,    ///< Do not skip empty characters
         SkipEmpty  ///< Skip empty characters.
      };
      
@@ -336,7 +350,7 @@ class String
       * \par Output
       * \include StringExampleSplit.out   
       */
      std::vector< String > split( const char separator = ' ', SplitSkipEmpty skipEmpty = DoNotSkipEmpty ) const;
      std::vector< String > split( const char separator = ' ', SplitSkip skipEmpty = SplitSkip::NoSkip ) const;
};

/**
@@ -373,7 +387,7 @@ String convertToString( const T& value )
}

/**
 * \brief Specialization of function \ref conertToString for boolean.
 * \brief Specialization of function \ref convertToString for boolean.
 * 
 * The boolean type is converted to 'true' ot 'false'.
 */
@@ -395,10 +409,6 @@ template<> inline String convertToString( const bool& b )
 */
void mpiSend( const String& str, int target, int tag = 0, MPI_Comm mpi_comm = MPI_COMM_WORLD );

/**
 * \brief Receives a string from the source MPI process.
 */

/**
 * \brief Receives a string from the target MPI process.
 * 
+3 −3
Original line number Diff line number Diff line
@@ -211,19 +211,19 @@ String::strip( char strip ) const
}

inline std::vector< String >
String::split( const char separator, SplitSkipEmpty skipEmpty ) const
String::split( const char separator, SplitSkip skip ) const
{
   std::vector< String > parts;
   String s;
   for( int i = 0; i < this->getLength(); i++ ) {
      if( ( *this )[ i ] == separator ) {
         if( ! skipEmpty || s != "" )
         if( skip != SplitSkip::SkipEmpty || s != "" )
            parts.push_back( s );
         s = "";
      }
      else s += ( *this )[ i ];
   }
   if( ! skipEmpty || s != "" )
   if( skip != SplitSkip::SkipEmpty || s != "" )
      parts.push_back( s );
   return parts;
}
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ TEST( StringTest, split )
   EXPECT_EQ( parts[ 4 ], "br" );
   EXPECT_EQ( parts[ 5 ], "" );

   parts = String( "abracadabra" ).split( 'a', String::SkipEmpty );
   parts = String( "abracadabra" ).split( 'a', String::SplitSkip::SkipEmpty );
   ASSERT_EQ( (int) parts.size(), 4 );
   EXPECT_EQ( parts[ 0 ], "br" );
   EXPECT_EQ( parts[ 1 ], "c" );