?? xmlformatter.hpp
字號:
/* * Copyright 1999-2000,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Log: XMLFormatter.hpp,v $ * Revision 1.21 2004/09/08 13:55:59 peiyongz * Apache License Version 2.0 * * Revision 1.20 2004/01/29 11:46:29 cargilld * Code cleanup changes to get rid of various compiler diagnostic messages. * * Revision 1.19 2003/12/01 23:23:25 neilg * fix for bug 25118; thanks to Jeroen Witmond * * Revision 1.18 2003/10/10 02:06:09 neilg * fix for bug 21780; thanks to David Cargill * * Revision 1.17 2003/09/22 08:50:04 gareth * doc fix * * Revision 1.16 2003/09/08 21:48:36 peiyongz * Restore pre2.3 constructors * * Revision 1.15 2003/05/30 16:11:43 gareth * Fixes so we compile under VC7.1. Patch by Alberto Massari. * * Revision 1.14 2003/05/16 21:36:55 knoaman * Memory manager implementation: Modify constructors to pass in the memory manager. * * Revision 1.13 2003/05/15 18:26:07 knoaman * Partial implementation of the configurable memory manager. * * Revision 1.12 2003/03/17 03:19:52 peiyongz * Bug#18051 memory leakage in XMLFormatter * * Revision 1.11 2003/03/16 06:00:43 peiyongz * Bug#17983 Formatter does not escape control characters * * Revision 1.10 2003/03/11 12:58:36 tng * Fix compilation error on AIX. * * Revision 1.9 2003/03/07 21:42:37 tng * [Bug 17589] Refactoring ... . Patch from Jacques Legare. * * Revision 1.8 2003/03/07 18:08:10 tng * Return a reference instead of void for operator= * * Revision 1.7 2003/01/31 00:30:48 jberry * Syntax error in declaration * * Revision 1.6 2003/01/28 18:32:33 peiyongz * Bug#13694: Allow Xerces to write the BOM to XML files * * Revision 1.5 2003/01/24 20:20:22 tng * Add method flush to XMLFormatTarget * * Revision 1.4 2002/11/04 15:00:21 tng * C++ Namespace Support. * * Revision 1.3 2002/07/30 16:29:16 tng * [Bug 8550] No explanation of XMLFormatter escape options. * * Revision 1.2 2002/06/21 19:31:23 peiyongz * getTranscoder() added; * * Revision 1.1.1.1 2002/02/01 22:21:52 peiyongz * sane_include * * Revision 1.7 2000/10/17 19:25:38 andyh * XMLFormatTarget, removed version of writeChars with no length. Can not be * safely used, and obscured other errors. * * Revision 1.6 2000/10/10 23:54:58 andyh * XMLFormatter patch, contributed by Bill Schindler. Fix problems with * output to multi-byte encodings. * * Revision 1.5 2000/04/07 01:01:56 roddey * Fixed an error message so that it indicated the correct radix for the rep * token. Get all of the basic output formatting functionality in place for * at least ICU and Win32 transcoders. * * Revision 1.4 2000/04/06 23:50:38 roddey * Now the low level formatter handles doing char refs for * unrepresentable chars (in addition to the replacement char style * already done.) * * Revision 1.3 2000/04/06 19:09:21 roddey * Some more improvements to output formatting. Now it will correctly * handle doing the 'replacement char' style of dealing with chars * that are unrepresentable. * * Revision 1.2 2000/04/05 00:20:16 roddey * More updates for the low level formatted output support * * Revision 1.1 2000/03/28 19:43:17 roddey * Fixes for signed/unsigned warnings. New work for two way transcoding * stuff. * */#if !defined(XMLFORMATTER_HPP)#define XMLFORMATTER_HPP#include <xercesc/util/PlatformUtils.hpp>XERCES_CPP_NAMESPACE_BEGINclass XMLFormatTarget;class XMLTranscoder;/** * This class provides the basic formatting capabilities that are required * to turn the Unicode based XML data from the parsers into a form that can * be used on non-Unicode based systems, that is, into local or generic text * encodings. * * A number of flags are provided to control whether various optional * formatting operations are performed. */class XMLPARSER_EXPORT XMLFormatter : public XMemory{public: // ----------------------------------------------------------------------- // Class types // ----------------------------------------------------------------------- /** @name Public Contants */ //@{ /** * EscapeFlags - Different styles of escape flags to control various formatting. * * <p><code>NoEscapes:</code> * No character needs to be escaped. Just write them out as is.</p> * <p><code>StdEscapes:</code> * The following characters need to be escaped:</p> * <table border='1'> * <tr> * <td>character</td> * <td>should be escaped and written as</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>&</td> * <td valign='top' rowspan='1' colspan='1'>&amp;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>></td> * <td valign='top' rowspan='1' colspan='1'>&gt;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>"</td> * <td valign='top' rowspan='1' colspan='1'>&quot;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><</td> * <td valign='top' rowspan='1' colspan='1'>&lt;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>'</td> * <td valign='top' rowspan='1' colspan='1'>&apos;</td> * </tr> * </table> * <p><code>AttrEscapes:</code> * The following characters need to be escaped:</p> * <table border='1'> * <tr> * <td>character</td> * <td>should be escaped and written as</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>&</td> * <td valign='top' rowspan='1' colspan='1'>&amp;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>></td> * <td valign='top' rowspan='1' colspan='1'>&gt;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>"</td> * <td valign='top' rowspan='1' colspan='1'>&quot;</td> * </tr> * </table> * <p><code>CharEscapes:</code> * The following characters need to be escaped:</p> * <table border='1'> * <tr> * <td>character</td> * <td>should be escaped and written as</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>&</td> * <td valign='top' rowspan='1' colspan='1'>&amp;</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'>></td> * <td valign='top' rowspan='1' colspan='1'>&gt;</td> * </tr> * </table> * <p><code>EscapeFlags_Count:</code> * Special value, do not use directly.</p> * <p><code>DefaultEscape:</code> * Special value, do not use directly.</p> * */ enum EscapeFlags { NoEscapes , StdEscapes , AttrEscapes , CharEscapes // Special values, don't use directly , EscapeFlags_Count , DefaultEscape = 999 }; /** * UnRepFlags * * The unrepresentable flags that indicate how to react when a * character cannot be represented in the target encoding. * * <p><code>UnRep_Fail:</code> * Fail the operation.</p> * <p><code>UnRep_CharRef:</code> * Display the unrepresented character as reference.</p> * <p><code>UnRep_Replace:</code> * Replace the unrepresented character with the replacement character.</p> * <p><code>DefaultUnRep:</code> * Special value, do not use directly.</p> * */ enum UnRepFlags { UnRep_Fail , UnRep_CharRef , UnRep_Replace , DefaultUnRep = 999 }; //@} // ----------------------------------------------------------------------- // Constructors and Destructor // ----------------------------------------------------------------------- /** @name Constructor and Destructor */ //@{ /** * @param outEncoding the encoding for the formatted content * @param docVersion * @param target the formatTarget where the formatted content is written to * @param escapeFlags the escape style for certain character * @param unrepFlags the reaction to unrepresentable character * @param manager Pointer to the memory manager to be used to * allocate objects. */ XMLFormatter ( const XMLCh* const outEncoding , const XMLCh* const docVersion , XMLFormatTarget* const target , const EscapeFlags escapeFlags = NoEscapes , const UnRepFlags unrepFlags = UnRep_Fail , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); XMLFormatter ( const char* const outEncoding , const char* const docVersion , XMLFormatTarget* const target , const EscapeFlags escapeFlags = NoEscapes , const UnRepFlags unrepFlags = UnRep_Fail , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager ); XMLFormatter ( const XMLCh* const outEncoding , XMLFormatTarget* const target , const EscapeFlags escapeFlags = NoEscapes , const UnRepFlags unrepFlags = UnRep_Fail , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager );
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -