        -:    0:Source:CSV_line.h
        -:    0:Graph:test_CSV.gcno
        -:    0:Data:test_CSV.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        -:    1:// CSV_line.h    (C) 2008 adolfo@di-mare.com
        -:    2:
        -:    3:#ifdef English_dox
        -:    4:    /// Doxygen English documentation.
        -:    5:    #define English_dox   "Doxygen English documentation"
        -:    6:   /// \def English_dox  ///< Macro used to have Doxygen generate English documentation.
        -:    7:#endif
        -:    8:
        -:    9:#ifdef English_dox
        -:   10:/** \file   CSV_line.h
        -:   11:    \brief  C++ wrapper class for \c CSV.h.
        -:   12:
        -:   13:    \author Adolfo Di Mare <adolfo@di-mare.com>
        -:   14:    \date   2008
        -:   15:*/
        -:   16:#endif
        -:   17:
        -:   18:#ifdef English_dox
        -:   19:/// \def CSV_line_h  ///< Avoids multiple inclusion.
        -:   20:#endif
        -:   21:
        -:   22:#ifndef CSV_line_h
        -:   23:#define CSV_line_h
        -:   24:
        -:   25:#include "CSV.h"
        -:   26:
        -:   27:// CSV: Comma Separated Values [IETF RFC-4180].
        -:   28:// namespace csv {
        -:   29:
        -:   30:#ifdef English_dox
        -:   31:/// Uses \c getNextCSV() to scan and store complete CSV lines.
        -:   32:/// - Oftentimes it helps a lot to \c chop() out trailing CR+LF's.
        -:   33:/// - This class is derived from std::vector<std::string> and has
        -:   34:///   all vector operations and interfaces.
        -:   35:#endif
        -:   36:class CSV_line : public std::vector<std::string> {
        -:   37:public:
        -:   38:    CSV_line();
        -:   39:    CSV_line( const std::string & str );
        -:   40:    CSV_line( const char *pz_str , size_t n=0 );
        -:   41:    CSV_line( const CSV_line & );
        -:   42:    void setData( const std::string & str );
        -:   43:    void setData( const char *pz_str , size_t n=0 );
        -:   44:    friend class test_CSV;
        -:   45:};
        -:   46:
        -:   47:#ifdef English_dox
        -:   48:/// \class   test_CSV;
        -:   49:/// \brief   Tests cases for \c CSV_line.
        -:   50:#endif
        -:   51:
        -:   52:#ifdef English_dox
        -:   53:/// Constructor.
        -:   54:#endif
function _ZN8CSV_lineC1Ev called 6 returned 100% blocks executed 70%
       12:   55:inline CSV_line::CSV_line() { }
        -:   56:
        -:   57:#ifdef English_dox
        -:   58:/// Constructor from string \c str.
        -:   59:#endif
        -:   60:inline CSV_line::CSV_line( const std::string & str ) {
        -:   61:    setData( str );
        -:   62:}
        -:   63:
        -:   64:#ifdef English_dox
        -:   65:/// Constructor from \c pz_str.
        -:   66:#endif
function _ZN8CSV_lineC1EPKcj called 13 returned 100% blocks executed 60%
       26:   67:inline CSV_line::CSV_line( const char *pz_str , size_t n ) {
       13:   68:    setData( pz_str , n );
        -:   69:}
        -:   70:
        -:   71:#ifdef English_dox
        -:   72:/** \fn    int CSV_line::setData( const std::string & str );
        -:   73:    \brief Scans line \c str to extract all its CSV fields.
        -:   74:    - Stops scanning when a CSV field ends with \c "\n" (Line Feed).
        -:   75:    - Processes up to \c str.length() characters in \c str [ including \c char(0) ].
        -:   76:    - Misplaced \c "\n" (Line Feed) characters are interpreted as comma
        -:   77:      \c ',' separators.
        -:   78:    - Removes the trailing \c "\n" (Line Feed) from the last CSV field.
        -:   79:    - Removes the trailing end of line marker \c "\r\n" from the last CSV field.
        -:   80:
        -:   81:    \dontinclude test_CSV.cpp
        -:   82:    \skipline    test::setData()
        -:   83:    \until       }}
        -:   84:    \see         test_CSV::test_setData()
        -:   85:*/
        -:   86:#endif
        -:   87:
        -:   88:#ifdef English_dox
        -:   89:/** \fn    int CSV_line::setData( const char *pz_str , size_t n );
        -:   90:    \brief Scans line \c pz_str to extract all its CSV fields.
        -:   91:    - When <code> n <= 0 </code> computes the length with \c strlen().
        -:   92:    - Processes all the \c n chars in \c pz_str [ including \c char(0) ].
        -:   93:    - Stops scanning when a CSV field ends with \c "\n" (Line Feed).
        -:   94:    - Misplaced \c "\n" (Line Feed) characters are interpreted as comma
        -:   95:      \c ',' separators.
        -:   96:    - Removes the trailing \c "\n" (Line Feed) from the last CSV field.
        -:   97:    - Removes the trailing end of line marker \c "\r\n" from the last CSV field.
        -:   98:
        -:   99:    \dontinclude test_CSV.cpp
        -:  100:    \skipline    test::setData()
        -:  101:    \until       }}
        -:  102:    \see         test_CSV::test_setData()
        -:  103:*/
        -:  104:#endif
        -:  105:
        -:  106:// }; // namespace csv
        -:  107:
        -:  108:#ifdef English_dox
        -:  109:/// Defined by the C++ standard library
        -:  110:namespace std { } // trick to include it into the Doxygen documentation
        -:  111:#endif
        -:  112:
        -:  113:#endif
        -:  114:
        -:  115:// EOF: CSV_line.h
