[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Sun Oct 7 15:20:18 UTC 2012


SVN commit 1319571 by kuemmel:

reactivate buffer check

 M  +9 -9      asciisource.cpp  
 M  +8 -8      asciisource.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1319570:1319571
@@ -426,8 +426,8 @@
   return (!new_data && !force_update ? NoChange : Updated);
 }
 
-template<typename IsLineBreak, typename CommentDelimiter>
-bool AsciiSource::findDataRows(const char* buffer, int bufstart, int bufread, const IsLineBreak& isLineBreak, const CommentDelimiter& comment_del)
+template<class Buffer, typename IsLineBreak, typename CommentDelimiter>
+bool AsciiSource::findDataRows(Buffer& buffer, int bufstart, int bufread, const IsLineBreak& isLineBreak, const CommentDelimiter& comment_del)
 {
   const IsWhiteSpace isWhiteSpace;
   
@@ -560,8 +560,8 @@
 
 
 //-------------------------------------------------------------------------------------------
-template<typename ColumnDelimiter>
-int AsciiSource::readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n,
+template<class Buffer, typename ColumnDelimiter>
+int AsciiSource::readColumns(double* v, Buffer& buffer, int bufstart, int bufread, int col, int s, int n,
                               const LineEndingType& lineending, const ColumnDelimiter& column_del)
 {
 
@@ -579,8 +579,8 @@
   return 0;
 }
 
-template<typename ColumnDelimiter, typename CommentDelimiter>
-int AsciiSource::readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n,
+template<class Buffer, typename ColumnDelimiter, typename CommentDelimiter>
+int AsciiSource::readColumns(double* v, Buffer& buffer, int bufstart, int bufread, int col, int s, int n,
                               const LineEndingType& lineending, const ColumnDelimiter& column_del, const CommentDelimiter& comment_del)
 {
   if (_config._columnWidthIsConst) {
@@ -601,8 +601,8 @@
 }
 
 
-template<typename IsLineBreak, typename ColumnDelimiter, typename CommentDelimiter, typename ColumnWidthsAreConst>
-int AsciiSource::readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n,
+template<class Buffer, typename IsLineBreak, typename ColumnDelimiter, typename CommentDelimiter, typename ColumnWidthsAreConst>
+int AsciiSource::readColumns(double* v, Buffer& buffer, int bufstart, int bufread, int col, int s, int n,
                               const IsLineBreak& isLineBreak,
                               const ColumnDelimiter& column_del, const CommentDelimiter& comment_del,
                               const ColumnWidthsAreConst& are_column_widths_const)
@@ -644,7 +644,7 @@
           incol = true;
           ++i_col;
           if (i_col == col) {
-            toDouble(lexc, buffer, bufread, ch, &v[i], i);
+            toDouble(lexc, &buffer[0], bufread, ch, &v[i], i);
             if (are_column_widths_const()) {
               if (col_start == -1) {
                 col_start = ch - _rowIndex[s];
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1319570:1319571
@@ -221,20 +221,20 @@
     };
 
 
-    template<typename ColumnDelimiter>
-    int readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n,
+    template<class Buffer, typename ColumnDelimiter>
+    int readColumns(double* v, Buffer& buffer, int bufstart, int bufread, int col, int s, int n,
                     const LineEndingType&, const ColumnDelimiter&);
 
-    template<typename ColumnDelimiter, typename CommentDelimiter>
-    int readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n,
+    template<class Buffer, typename ColumnDelimiter, typename CommentDelimiter>
+    int readColumns(double* v, Buffer& buffer, int bufstart, int bufread, int col, int s, int n,
                     const LineEndingType&, const ColumnDelimiter&, const CommentDelimiter&);
 
-    template<typename IsLineBreak, typename ColumnDelimiter, typename CommentDelimiter, typename ColumnWidthsAreConst>
-    int readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n,
+    template<class Buffer, typename IsLineBreak, typename ColumnDelimiter, typename CommentDelimiter, typename ColumnWidthsAreConst>
+    int readColumns(double* v, Buffer& buffer, int bufstart, int bufread, int col, int s, int n,
                     const IsLineBreak&, const ColumnDelimiter&, const CommentDelimiter&, const ColumnWidthsAreConst&);
 
-    template<typename IsLineBreak, typename CommentDelimiter>
-    bool findDataRows(const char* buffer, int bufstart, int bufread, const IsLineBreak&, const CommentDelimiter&);
+    template<class Buffer, typename IsLineBreak, typename CommentDelimiter>
+    bool findDataRows(Buffer& buffer, int bufstart, int bufread, const IsLineBreak&, const CommentDelimiter&);
 
     void toDouble(const LexicalCast& lexc, const char* buffer, int bufread, int ch, double* v, int row);
 


More information about the Kst mailing list