Browse Source

Besseres arbeiten mit texten wegen mehr operatoren

Kolja Strohm 5 years ago
parent
commit
22b0979558
2 changed files with 49 additions and 0 deletions
  1. 37 0
      Text.cpp
  2. 12 0
      Text.h

+ 37 - 0
Text.cpp

@@ -1269,6 +1269,43 @@ bool Text::operator<( Text &t ) const
     return 0;
 }
 
+// Erstellt einen neuen Text bestehend aus diesem und t2
+Text Text::operator+( const Text &t2 )
+{
+    return Text( *this ) += t2;
+}
+
+// Erstellt einen neuen Text bestehend aus diesem und t2
+Text Text::operator+( const char *t2 )
+{
+    return Text( *this ) += t2;
+}
+
+// Erstellt einen neuen Text bestehend aus diesem und num
+Text Text::operator+( const int num )
+{
+    return Text( *this ) += num;
+}
+
+// Erstellt einen neuen Text bestehend aus diesem und num
+Text Text::operator+( const __int64 num )
+{
+    return Text( *this ) += num;
+}
+
+// Erstellt einen neuen Text bestehend aus diesem und num
+Text Text::operator+( const double num )
+{
+    return Text( *this ) += num;
+}
+
+// Erstellt einen neuen Text bestehend aus diesem und num
+Text Text::operator+( const float num )
+{
+    return Text( *this ) += num;
+}
+
+
 // Inhalt der TextReader Klasse
 // Konstructor
 //  txt: Der Text der gelesen werden soll. Er wird nicht kopiert sondern direkt gelesen.

+ 12 - 0
Text.h

@@ -333,6 +333,18 @@ namespace Framework
         __declspec( dllexport ) bool operator>( Text &t ) const;
         // Prüft, ob der Inhalt des Textes nach alphabetischer Ordnung früher kommt als der Inhalt eines anderen Textes
         __declspec( dllexport ) bool operator<( Text &t ) const;
+        // Erstellt einen neuen Text bestehend aus diesem und t2
+        __declspec( dllexport ) Text operator+( const Text &t2 );
+        // Erstellt einen neuen Text bestehend aus diesem und t2
+        __declspec( dllexport ) Text operator+( const char *t2 );
+        // Erstellt einen neuen Text bestehend aus diesem und num
+        __declspec( dllexport ) Text operator+( const int num );
+        // Erstellt einen neuen Text bestehend aus diesem und num
+        __declspec( dllexport ) Text operator+( const __int64 num );
+        // Erstellt einen neuen Text bestehend aus diesem und num
+        __declspec( dllexport ) Text operator+( const double num );
+        // Erstellt einen neuen Text bestehend aus diesem und num
+        __declspec( dllexport ) Text operator+( const float num );
     };
 
     class TextReader : public Reader