+#if wxUSE_STREAMS
+
+WXDLLIMPEXP_BASE wxTextOutputStream& operator<< (wxTextOutputStream& o, const wxULongLong& ll)
+{
+ return o << ll.ToString();
+}
+
+WXDLLIMPEXP_BASE wxTextOutputStream& operator<< (wxTextOutputStream& o, const wxLongLong& ll)
+{
+ return o << ll.ToString();
+}
+
+#define READ_STRING_CHAR(s, idx, len) ((idx!=len) ? (wxChar)s[idx++] : _T('\0'))
+
+WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxULongLong &ll)
+{
+ wxString s = o.ReadWord();
+
+ ll = wxULongLong(0l, 0l);
+ size_t length = s.length();
+ size_t idx = 0;
+
+ wxChar ch = READ_STRING_CHAR(s, idx, length);
+
+ // Skip WS
+ while (ch==wxT(' ') || ch==wxT('\t'))
+ ch = READ_STRING_CHAR(s, idx, length);
+
+ // Read number
+ wxULongLong multiplier(0l, 10l);
+ while (ch>=wxT('0') && ch<=wxT('9')) {
+ long lValue = (unsigned) (ch - wxT('0'));
+ ll = ll * multiplier + wxULongLong(0l, lValue);
+ ch = READ_STRING_CHAR(s, idx, length);
+ }
+
+ return o;
+}
+
+WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxLongLong &ll)
+{
+ wxString s = o.ReadWord();
+
+ ll = wxLongLong(0l, 0l);
+ size_t length = s.length();
+ size_t idx = 0;
+
+ wxChar ch = READ_STRING_CHAR(s, idx, length);
+
+ // Skip WS
+ while (ch==wxT(' ') || ch==wxT('\t'))
+ ch = READ_STRING_CHAR(s, idx, length);
+
+ // Ask for sign
+ int iSign = 1;
+ if (ch==wxT('-') || ch==wxT('+')) {
+ iSign = ((ch==wxT('-')) ? -1 : 1);
+ ch = READ_STRING_CHAR(s, idx, length);
+ }
+
+ // Read number
+ wxLongLong multiplier(0l, 10l);
+ while (ch>=wxT('0') && ch<=wxT('9')) {
+ long lValue = (unsigned) (ch - wxT('0'));
+ ll = ll * multiplier + wxLongLong(0l, lValue);
+ ch = READ_STRING_CHAR(s, idx, length);
+ }
+
+#if wxUSE_LONGLONG_NATIVE
+ ll = ll * wxLongLong((wxLongLong_t) iSign);
+#else
+ ll = ll * wxLongLong((long) iSign);
+#endif
+
+ return o;
+}
+
+#if wxUSE_LONGLONG_NATIVE
+
+WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &o, wxULongLong_t value)
+{
+ return o << wxULongLong(value).ToString();
+}
+
+WXDLLIMPEXP_BASE class wxTextOutputStream &operator<<(class wxTextOutputStream &o, wxLongLong_t value)
+{
+ return o << wxLongLong(value).ToString();
+}
+
+WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxULongLong_t &value)
+{
+ wxULongLong ll;
+ o >> ll;
+ value = ll.GetValue();
+ return o;
+}
+
+WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxLongLong_t &value)
+{
+ wxLongLong ll;
+ o >> ll;
+ value = ll.GetValue();
+ return o;
+}
+
+#endif // wxUSE_LONGLONG_NATIVE
+
+#endif // wxUSE_STREAMS
+