wxArt2D
xmlencode.cpp
Go to the documentation of this file.
1 /*! \file xmlparse/src/xmlencode.cpp
2  \brief functions for encoding characters in xml
3  \author Michael Sögtrop / Klaas Holwerda
4 
5  Copyright: 2001-2004 (C) Michael Sögtrop / Klaas Holwerda
6 
7  Licence: wxWidgets licence
8 
9  RCS-ID: $Id: xmlencode.cpp,v 1.17 2009/07/15 21:23:43 titato Exp $
10 */
11 
12 #include "wxartbaseprec.h"
13 #include "wx/general/smrtptr.h"
14 
15 // Note: I did put this into a new file, because i wanted to add handling for
16 // textual character entities like ä
17 // This will include lengthy tables.
18 
19 // Encode all Non-ASCII and reserved (<>&") chars in &#d; format
20 // If in Non-unicode mode, this first converts the string to Unicode using wxConvLocal
21 
22 
23 // Converts an Expat-produced UTF-8 encoded wxString in either an Unicode string
24 // or in non-Unicode environments into a wxConvLocal encoded string.
25 
26 #if wxUSE_UNICODE
27 A2DGENERALDLLEXP wxString XmlDecodeStringToString(
28  const char* s,
29  size_t len
30 )
31 {
32  return wxString( s, wxConvUTF8, len );
33 }
34 #else
35 A2DGENERALDLLEXP wxString XmlDecodeStringToString(
36  const char* s,
37  size_t len
38 )
39 {
40  const wxWCharBuffer wbuf(
41  wxConvUTF8.cMB2WC( s, len == wxString::npos ? wxNO_LEN : len, NULL ) );
42 
43  return wxString( wbuf, wxConvLocal );
44 }
45 #endif
46 
smart pointer class and list.
xmlencode.cpp Source File -- Sun Oct 12 2014 17:04:26 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation