[Kst] extragear/graphics/kst/kst/datasources/ascii

George Staikos staikos at kde.org
Wed Oct 26 16:25:06 CEST 2005


SVN commit 474481 by staikos:

in the spirit of the name, ascii files are --- ascii, not unicode.  This gives
at least 10% speedup in reading ascii files by my count.


 M  +10 -10    ascii.cpp  


--- trunk/extragear/graphics/kst/kst/datasources/ascii/ascii.cpp #474480:474481
@@ -61,36 +61,36 @@
     void read(KConfig *cfg, const QString& fileName = QString::null) {
       cfg->setGroup("ASCII General");
       _fileNamePattern = cfg->readEntry("Filename Pattern", QString::null);
-      _delimiters = cfg->readEntry("Comment Delimiters", "#/c!;");
+      _delimiters = cfg->readEntry("Comment Delimiters", "#/c!;").latin1();
       _indexInterpretation = (Interpretation)cfg->readNumEntry("Default INDEX Interpretation", Unknown);
       _columnType = (ColumnType)cfg->readNumEntry("Column Type", Whitespace);
-      _columnDelimiter = cfg->readEntry("Column Delimiter", QString::null);
+      _columnDelimiter = cfg->readEntry("Column Delimiter", QString::null).latin1();
       _columnWidth = cfg->readNumEntry("Column Width", DEFAULT_COLUMN_WIDTH);
       _dataLine = cfg->readNumEntry("Data Start", 0);
       _readFields = cfg->readBoolEntry("Read Fields", false);
       _fieldsLine = cfg->readNumEntry("Fields Line", 0);
       if (!fileName.isEmpty()) {
         cfg->setGroup(fileName);
-        _delimiters = cfg->readEntry("Comment Delimiters", _delimiters);
+        _delimiters = cfg->readEntry("Comment Delimiters", _delimiters).latin1();
         _indexInterpretation = (Interpretation)cfg->readNumEntry("Default INDEX Interpretation", _indexInterpretation);
         _columnType = (ColumnType)cfg->readNumEntry("Column Type", _columnType);
-        _columnDelimiter = cfg->readEntry("Column Delimiter", _columnDelimiter);
+        _columnDelimiter = cfg->readEntry("Column Delimiter", _columnDelimiter).latin1();
         _columnWidth = cfg->readNumEntry("Column Width", _columnWidth);
         _dataLine = cfg->readNumEntry("Data Start", _dataLine);
         _readFields = cfg->readBoolEntry("Read Fields", _readFields);
         _fieldsLine = cfg->readNumEntry("Fields Line", _fieldsLine);
       }
-      _delimiters = QRegExp::escape(_delimiters);
+      _delimiters = QRegExp::escape(_delimiters).latin1();
     }
 
-    QString _delimiters;
+    QCString _delimiters;
     QString _indexVector;
     QString _fileNamePattern;
     enum Interpretation { Unknown = 0, INDEX, CTime, Seconds, IntEnd = 0xffff };
     Interpretation _indexInterpretation;
     enum ColumnType { Whitespace = 0, Fixed, Custom, ColEnd = 0xffff };
     ColumnType _columnType;
-    QString _columnDelimiter;
+    QCString _columnDelimiter;
     int _columnWidth;
     int _dataLine;
     bool _readFields;
@@ -129,7 +129,7 @@
              }
            } else if (e.tagName() == "comment") {
              if (e.hasAttribute("delimiters")) {
-               _delimiters = e.attribute("delimiters");
+               _delimiters = e.attribute("delimiters").latin1();
              }
            } else if (e.tagName() == "columns") {
              if (e.hasAttribute("type")) {
@@ -139,7 +139,7 @@
                _columnWidth = e.attribute("width").toInt();
              }
              if (e.hasAttribute("delimiters")) {
-               _columnDelimiter = e.attribute("delimiters");
+               _columnDelimiter = e.attribute("delimiters").latin1();
              }
            } else if (e.tagName() == "header") {
              if (e.hasAttribute("start")) {
@@ -316,7 +316,7 @@
   int bufstart, bufread;
   bool new_data = false;
   char tmpbuf[MAXBUFREADLEN+1];
-  const char *del = _config->_delimiters.latin1(); // beware
+  const char *del = _config->_delimiters; // beware
   
   do {
     /* Read the tmpbuffer, starting at row_index[_numFrames] */


More information about the Kst mailing list