// This crude code is for using wxWidget streams with TinyXML.
// This is useful, for example, for loading and saving XML directly
// into a ZIP file (with the new ZIP streams in 2.5.4).
// Copyright (c) 2005 Andrew Ziem. All rights reserved.
// This code is licensed under the three licenses: wxWindows Library Licence, Version 3;
// Zlib license (like TinyXML); and the GNU General Public License version 2 or later.
#include "wxtinyxml.h"
bool wxTiXmlDocument::LoadFile( wxInputStream &istream )
{
Clear();
location.Clear();
wxTextInputStream txt(istream);
wxString data;
do
{
const wxString s = txt.ReadLine();
if ( istream.Eof() && s.empty() )
break;
data += s;
} while (1);
Parse( wxConvCurrent->cWX2MB(data), 0, TIXML_ENCODING_UTF8 );
if ( Error() )
return false;
else
return true;
}
bool wxTiXmlDocument::SaveFile (wxOutputStream &ostream)
{
wxTextOutputStream txt(ostream);
#ifdef TIXML_USE_STL
#error not implemented
#else
TiXmlOutStream outs;
StreamOut (&outs);
const char *c = outs.c_str();
txt << wxString(c, wxConvUTF8);
#endif
}
#ifndef __WXTINYXML_H__
#define __WXTINYXML_H__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "tinyxml.h"
#include "wx/txtstrm.h"
class wxTiXmlDocument : public TiXmlDocument
{
public:
bool LoadFile( wxInputStream &istream );
bool SaveFile( wxOutputStream &ostream );
};
#endif
Thanks, I've noticed that thr C v1 bug with Unicode got introduced with autoversionator, right?
Hang on, I'll get you a patch right now that fixes the "Code::Blocks v1.0" shows as "C v1" fix. I didn't and won't post it on SF because I was already told it won't get committed.Sam, the patch was turned down because it does not fix the bug. It is a patch that reverts Yiannis' changes in r1513. You are welcome to fix the bug, but like I told you, the way to go is to modify the about box so it works with the modifications, not to revert appglobals.h.
Hang on, I'll get you a patch right now that fixes the "Code::Blocks v1.0" shows as "C v1" fix. I didn't and won't post it on SF because I was already told it won't get committed.Sam, the patch was turned down because it does not fix the bug. It is a patch that reverts Yiannis' changes in r1513. You are welcome to fix the bug, but like I told you, the way to go is to modify the about box so it works with the modifications, not to revert appglobals.h.
How To Use TinyXML With WxWidgets (http://wiki.wxwidgets.org/wiki.pl?How_To_Use_TinyXML_With_WxWidgets)That's exactly what we are doing. :)
why not try the libxml2 library (http://xmlsoft.org/)? It is mentioned on the wxWikiIf we were to use another xml library, we should be using the one built into wx. But that would mean we would have to rewrite an awful lot of code. Plus, the charm of tinyXML is that it is easy to use, small, and fast.
How To Use TinyXML With WxWidgets (http://wiki.wxwidgets.org/wiki.pl?How_To_Use_TinyXML_With_WxWidgets)That's exactly what we are doing. :)
why not try the libxml2 library (http://xmlsoft.org/)? It is mentioned on the wxWiki
If we were to use another xml library, we should be using the one built into wx. But that would mean we would have to rewrite an awful lot of code. Plus, the charm of tinyXML is that it is easy to use, small, and fast.
A config file has typically 1200-1500 nodes, so we're talking about 30-50 kilobytes.
Back on topic: Unicode support.
@280Z28: I've applied your patch and it's working a lot better.
Here are the things that works (tried with Japanese): :D
-Typing in the cbEditor Unicode chars.
-Copying and pasting Unicode chars between cbEditors.
-Copying Unicode chars between cbEditor and external editors.
-Dragging Unicode chars between cbEditors.
-Dragging Unicode chars between cbEditor and external editors.
-Saving a file that contain the recently typed Unicode chars (It's saved in UTF-8 without BOM).
Here are the things that doesn't works: :cry:
-Loading a file that contain Unicode chars. It loads ok, but it's displayed as it were ASCII, not Unicode, so the Unicode chars becomes garbage.
-Pasting Unicode chars from an external editor (Notepad) to cbEditor. Somehow, it pastes the word "Hello". :shock:
-Doesn't haves any notion of what a BOM is.
-Other Unicode encodings such as UTF-16 doesn't works. Only UTF-8 works.
The link http://www.280z28.org/CodeBlocks/patches/complete-rev1565u.patch does not works.
Anyways, there is a problem with your patches, you provide some here but not all on the sf.net tracker?
I'll want to see instead is more small patches, posted and updated in sf.net
No, I wasn't saying your patches didn't work.
The link http://www.280z28.org/CodeBlocks/patches/complete-rev1565u.patch still doesn't works.