Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: spxmltest_weather VFD_fontx2_weather weather_LCD_display News_LCD_display ... more
spxmlcodec.hpp@0:3fa97f2c0505, 2010-11-24 (annotated)
- Committer:
- hlipka
- Date:
- Wed Nov 24 20:52:14 2010 +0000
- Revision:
- 0:3fa97f2c0505
initial revision
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hlipka | 0:3fa97f2c0505 | 1 | /* |
| hlipka | 0:3fa97f2c0505 | 2 | * Copyright 2007 Stephen Liu |
| hlipka | 0:3fa97f2c0505 | 3 | * LGPL, see http://code.google.com/p/spxml/ |
| hlipka | 0:3fa97f2c0505 | 4 | * For license terms, see the file COPYING along with this library. |
| hlipka | 0:3fa97f2c0505 | 5 | */ |
| hlipka | 0:3fa97f2c0505 | 6 | |
| hlipka | 0:3fa97f2c0505 | 7 | #ifndef __spxmlcodec_hpp__ |
| hlipka | 0:3fa97f2c0505 | 8 | #define __spxmlcodec_hpp__ |
| hlipka | 0:3fa97f2c0505 | 9 | |
| hlipka | 0:3fa97f2c0505 | 10 | class SP_XmlStringBuffer; |
| hlipka | 0:3fa97f2c0505 | 11 | |
| hlipka | 0:3fa97f2c0505 | 12 | class SP_XmlStringCodec { |
| hlipka | 0:3fa97f2c0505 | 13 | public: |
| hlipka | 0:3fa97f2c0505 | 14 | |
| hlipka | 0:3fa97f2c0505 | 15 | static const char * DEFAULT_ENCODING; |
| hlipka | 0:3fa97f2c0505 | 16 | |
| hlipka | 0:3fa97f2c0505 | 17 | static int decode( const char * encoding, |
| hlipka | 0:3fa97f2c0505 | 18 | const char * encodeValue, SP_XmlStringBuffer * outBuffer ); |
| hlipka | 0:3fa97f2c0505 | 19 | static int encode( const char * encoding, |
| hlipka | 0:3fa97f2c0505 | 20 | const char * decodeValue, SP_XmlStringBuffer * outBuffer ); |
| hlipka | 0:3fa97f2c0505 | 21 | static int isNameChar( const char * encoding, char c ); |
| hlipka | 0:3fa97f2c0505 | 22 | |
| hlipka | 0:3fa97f2c0505 | 23 | private: |
| hlipka | 0:3fa97f2c0505 | 24 | static const char XML_CHARS []; |
| hlipka | 0:3fa97f2c0505 | 25 | static const char * ESC_CHARS []; |
| hlipka | 0:3fa97f2c0505 | 26 | |
| hlipka | 0:3fa97f2c0505 | 27 | SP_XmlStringCodec(); |
| hlipka | 0:3fa97f2c0505 | 28 | }; |
| hlipka | 0:3fa97f2c0505 | 29 | |
| hlipka | 0:3fa97f2c0505 | 30 | class SP_XmlUtf8Codec { |
| hlipka | 0:3fa97f2c0505 | 31 | public: |
| hlipka | 0:3fa97f2c0505 | 32 | |
| hlipka | 0:3fa97f2c0505 | 33 | // @return convert how many bytes |
| hlipka | 0:3fa97f2c0505 | 34 | static int utf82uni( const unsigned char * utf8, int * ch ); |
| hlipka | 0:3fa97f2c0505 | 35 | |
| hlipka | 0:3fa97f2c0505 | 36 | static void uni2utf8( int ch, SP_XmlStringBuffer * outBuffer ); |
| hlipka | 0:3fa97f2c0505 | 37 | |
| hlipka | 0:3fa97f2c0505 | 38 | private: |
| hlipka | 0:3fa97f2c0505 | 39 | SP_XmlUtf8Codec(); |
| hlipka | 0:3fa97f2c0505 | 40 | }; |
| hlipka | 0:3fa97f2c0505 | 41 | |
| hlipka | 0:3fa97f2c0505 | 42 | #endif |
| hlipka | 0:3fa97f2c0505 | 43 |