From e6077c30d14e9d662e8843c554db86c0d366d0b6 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 6 Jun 2024 13:44:12 +0900 Subject: Rename str nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/html/tutorial2-03.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'doc/html/tutorial2-03.html') diff --git a/doc/html/tutorial2-03.html b/doc/html/tutorial2-03.html index 4a737dcb2..4cdcb4960 100644 --- a/doc/html/tutorial2-03.html +++ b/doc/html/tutorial2-03.html @@ -42,7 +42,7 @@ access for data elements.
        double m_value;
         TQColor m_valueColor;
         int m_valuePattern;
-        TQString m_label;
+        TQString m_label;
         TQColor m_labelColor;
         double m_propoints[2 * MAX_PROPOINTS];
 
@@ -54,7 +54,7 @@ of chart has a (relative) position stored in the m_propoints array.
    #include <ntqcolor.h>
     #include <ntqnamespace.h>
-    #include <ntqstring.h>
+    #include <tqstring.h>
     #include <tqvaluevector.h>
 

Although the Element class is a purely internal data class, it @@ -65,7 +65,7 @@ paint color and text color in the Element class. The use of TQt superclass which contains various enumerations. The Element class does not derive from TQt, so we need to include ntqnamespace.h to have access to the TQt enum names. An alternative approach would have been to have -made Element a TQt subclass. We include ntqstring.h to make use of TQt's Unicode strings. As a convenience we +made Element a TQt subclass. We include tqstring.h to make use of TQt's Unicode strings. As a convenience we will typedef a vector container for Elements, which is why we pull in the tqvaluevector.h header.

    typedef TQValueVector<Element> ElementVector;
@@ -114,7 +114,7 @@ and dynamically resized it depending on how many chart types are
 available. 
 

        Element( double value = INVALID, TQColor valueColor = TQt::gray,
                  int valuePattern = TQt::SolidPattern,
-                 const TQString& label = TQString::null,
+                 const TQString& label = TQString::null,
                  TQColor labelColor = TQt::black ) {
             init( value, valueColor, valuePattern, label, labelColor );
             for ( int i = 0; i < MAX_PROPOINTS * 2; ++i )
@@ -167,10 +167,10 @@ filter the data using a scripting language.
 
 
    #include "element.h"
 
-    #include <ntqstringlist.h>
+    #include <tqstringlist.h>
     #include <ntqtextstream.h>
 
-

Our implementation of the operators requires the inclusion of ntqtextstream.h and ntqstringlist.h. +

Our implementation of the operators requires the inclusion of ntqtextstream.h and tqstringlist.h.

    const char FIELD_SEP = ':';
     const char PROPOINT_SEP = ';';
     const char XY_SEP = ',';
@@ -212,13 +212,13 @@ by a field separator. The points are written as comma separated (XY_SEP
 separator. The final field is the label followed by a newline.
 

    TQTextStream &operator>>( TQTextStream &s, Element &element )
     {
-        TQString data = s.readLine();
+        TQString data = s.readLine();
         element.setValue( Element::INVALID );
 
         int errors = 0;
         bool ok;
 
-        TQStringList fields = TQStringList::split( FIELD_SEP, data );
+        TQStringList fields = TQStringList::split( FIELD_SEP, data );
         if ( fields.count() >= 4 ) {
             double value = fields[0].toDouble( &ok );
             if ( !ok )
@@ -232,8 +232,8 @@ separator. The final field is the label followed by a newline.
             TQColor labelColor = TQColor( fields[3] );
             if ( !labelColor.isValid() )
                 errors++;
-            TQStringList propoints = TQStringList::split( PROPOINT_SEP, fields[4] );
-            TQString label = data.section( FIELD_SEP, 5 );
+            TQStringList propoints = TQStringList::split( PROPOINT_SEP, fields[4] );
+            TQString label = data.section( FIELD_SEP, 5 );
 
             if ( !errors ) {
                 element.set( value, valueColor, valuePattern, label, labelColor );
@@ -242,7 +242,7 @@ separator. The final field is the label followed by a newline.
                     i < Element::MAX_PROPOINTS && point != propoints.end();
                     ++i, ++point ) {
                     errors = 0;
-                    TQStringList xy = TQStringList::split( XY_SEP, *point );
+                    TQStringList xy = TQStringList::split( XY_SEP, *point );
                     double x = xy[0].toDouble( &ok );
                     if ( !ok || x <= 0.0 || x >= 1.0 )
                         errors++;
@@ -261,9 +261,9 @@ separator. The final field is the label followed by a newline.
     }
 

To read an element we read one record (i.e. one line). We break the -data into fields using TQStringList::split(). Because it is possible +data into fields using TQStringList::split(). Because it is possible that a label will contain FIELD_SEP characters we use -TQString::section() to extract all the text from the last field to the +TQString::section() to extract all the text from the last field to the end of the line. If there are enough fields and the value, colors and pattern data is valid we use Element::set() to write this data into the element; otherwise we leave the element INVALID. We then -- cgit v1.2.1