summaryrefslogtreecommitdiffstats
path: root/libtdepim/tests/testutf7encoder.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:57:02 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:57:02 -0600
commit2c2fbd828ca474671bb9e03681b30b115d8d6035 (patch)
tree526a9da418f8d3d7ccf515c37048d3dfc80f2843 /libtdepim/tests/testutf7encoder.cpp
parentf0610eece3676b6fe99f42cf4ef2b19a39a5c4e8 (diff)
downloadtdepim-2c2fbd828ca474671bb9e03681b30b115d8d6035.tar.gz
tdepim-2c2fbd828ca474671bb9e03681b30b115d8d6035.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'libtdepim/tests/testutf7encoder.cpp')
-rw-r--r--libtdepim/tests/testutf7encoder.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/libtdepim/tests/testutf7encoder.cpp b/libtdepim/tests/testutf7encoder.cpp
new file mode 100644
index 000000000..2938cd660
--- /dev/null
+++ b/libtdepim/tests/testutf7encoder.cpp
@@ -0,0 +1,93 @@
+#include "qutf7codec.h"
+#include "qutf7codec.cpp"
+#include <iostream.h>
+#include <string.h>
+
+void main( int argc, char * argv[] ) {
+ if ( argc == 2 ) {
+ TQUtf7Codec * codec = new TQUtf7Codec;
+
+ TQTextEncoder * enc;
+
+ TQString arg = TQString::tqfromLatin1( argv[1] );
+ int len;
+
+ cout << "Original string:\n"
+ << "\"" << argv[1] << "\"\n" << endl;
+
+ cout << "Encode optional direct set and whitespace:\n" << endl;
+ codec->setEncodeWhitespace(TRUE);
+ codec->setEncodeOptionalDirect(TRUE);
+ enc = codec->makeEncoder();
+
+ len = arg.length();
+ cout << (enc->fromUnicode( arg, len )).data()
+ << "\n" << endl;
+
+ cout << "Same as above, but call fromUnicode() char-wise:\n" << endl;
+
+ delete enc;
+ enc = codec->makeEncoder();
+
+ for ( int i = 0 ; i < arg.length() ; i++ ) {
+ len = 1;
+ cout << (enc->fromUnicode( TQString(arg[i]), len )).data();
+ }
+ cout << "\n" << endl;
+
+
+
+ delete enc;
+
+ cout << "Encode optional direct set and not whitespace:\n" << endl;
+ codec->setEncodeWhitespace(FALSE);
+ codec->setEncodeOptionalDirect(TRUE);
+ enc = codec->makeEncoder();
+
+ len = arg.length();
+ cout << (enc->fromUnicode( arg, len )).data()
+ << "\n" << endl;
+
+ delete enc;
+
+
+ cout << "Don't encode optional direct set, but whitespace:\n" << endl;
+ codec->setEncodeWhitespace(TRUE);
+ codec->setEncodeOptionalDirect(FALSE);
+ enc = codec->makeEncoder();
+
+ len = arg.length();
+ cout << (enc->fromUnicode( arg, len )).data()
+ << "\n" << endl;
+
+ delete enc;
+
+
+ cout << "Encode neither optional direct set, nor whitespace:\n" << endl;
+ codec->setEncodeWhitespace(FALSE);
+ codec->setEncodeOptionalDirect(FALSE);
+ enc = codec->makeEncoder();
+
+ len = arg.length();
+ cout << (enc->fromUnicode( arg, len )).data()
+ << "\n" << endl;
+
+ cout << "Same as above, but call fromUnicode() char-wise:\n" << endl;
+
+ delete enc;
+ enc = codec->makeEncoder();
+
+ for ( int i = 0 ; i < arg.length() ; i++ ) {
+ len = 1;
+ cout << (enc->fromUnicode( TQString(arg[i]), len )).data();
+ }
+ cout << "\n" << endl;
+
+
+ delete enc;
+
+ delete codec;
+ } else {
+ qWarning("usage: testutf7encoder string_to_encode\n");
+ }
+}