Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:18:14

0001 // Created on: 2002-02-08
0002 // Created by: Alexander GRIGORIEV
0003 // Copyright (c) 2002-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef LDOM_CharReference_HeaderFile
0017 #define LDOM_CharReference_HeaderFile
0018 
0019 #include <Standard_TypeDef.hxx>
0020 
0021 //  Class LDOM_CharReference: treatment of character reference and internal
0022 //     entities in input and output streams
0023 //  On output all 256 characters are classified as this:
0024 //     For string values of attributes:
0025 //         0x09,0x0a,0x0d,0x20,0x21,0x23-0x25,0x27-0x3b,0x3d,0x3f-0x7f,0xc0-0xff
0026 //              are treated as normal characters (no relacement)
0027 //         0x22(&quote;), 0x26(&amp;), 0x3c(&lt;), 0x3e(&gt;)
0028 //              are replaced by predefined entity reference.
0029 //         0x01-0x08,0x0b,0x0c,0x0e-0x1f,0x80-0xbf
0030 //              are replaced by character references
0031 //     For other strings (text):
0032 //         0x09,0x0a,0x0d,0x20-0x25,0x27-0x3b,0x3d,0x3f-0x7f,0xc0-0xff
0033 //              are treated as normal characters (no relacement)
0034 //         0x26(&amp;), 0x3c(&lt;), 0x3e(&gt;)
0035 //              are replaced by predefined entity reference.
0036 //         0x01-0x08,0x0b,0x0c,0x0e-0x1f,0x80-0xbf
0037 //              are replaced by character references
0038 //  For CDATA, element tag names and attribute names no replacements are made
0039 //  Note that apostrophe (\') is not treated as markup on output (all relevant
0040 //  markup is produced by quote characters (\")).
0041 
0042 class LDOM_CharReference
0043 {
0044 public:
0045   // ---------- PUBLIC METHODS ----------
0046 
0047   static char* Decode(char* theSrc, int& theLen);
0048 
0049   static char* Encode(const char* theSrc, int& theLen, const bool isAttribute);
0050   // Encodes the string theSrc containing any byte characters 0x00-0xFF
0051   // Returns the encoded string. If (return value) != theSrc the returned
0052   // string should be deleted in caller routine (via delete[]).
0053   // The output parameter theLen gives the length of the encoded string
0054   // With isAttribute==True additionally encodes to $quot; for attr values
0055 
0056 private:
0057   // ---------- PRIVATE FIELDS ----------
0058 
0059   static int myTab[256];
0060 };
0061 
0062 #endif