00001 /*00002 * The Software License00003 * =================================================================================00004 * Copyright (c) 2003-.The Terimber Corporation. All rights reserved.00005 * =================================================================================00006 * Redistributions of source code must retain the above copyright notice, 00007 * this list of conditions and the following disclaimer.00008 * Redistributions in binary form must reproduce the above copyright notice, 00009 * this list of conditions and the following disclaimer in the documentation 00010 * and/or other materials provided with the distribution.00011 * The end-user documentation included with the redistribution, if any, 00012 * must include the following acknowledgment:00013 * "This product includes software developed by the Terimber Corporation."00014 * =================================================================================00015 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, 00016 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 00017 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00018 * IN NO EVENT SHALL THE TERIMBER CORPORATION OR ITS CONTRIBUTORS BE LIABLE FOR 00019 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00020 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00021 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00022 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT00023 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE00024 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.00025 * ================================================================================00026 */00027
00028 #ifndef _terimber_declxml_hpp_00029 #define _terimber_declxml_hpp_00030
00031 #include "xml/declxml.h"00032
00033 BEGIN_TERIMBER_NAMESPACE00034 #pragma pack(4)00035
00036staticconstub1_ts_white_space_mask = 0x01;
00037staticconstub1_ts_digit_mask = 0x02;
00038staticconstub1_ts_english_letter_mask = 0x04;
00039staticconstub1_ts_first_char_name_mask = 0x08;
00040staticconstub1_ts_char_name_mask = 0x10;
00041staticconstub1_ts_public_char_mask = 0x20;
00042staticconstub1_ts_versionnum_char_mask = 0x40;
00043staticconstub1_ts_encname_char_mask = 0x80;
00044
00046 // char detection related functions00048 // [3] S ::= (#x20 | #x9 | #xD | #xA)+ 00049 xml_forceinline00050 bool00051is_white_space(ub1_t symbol)
00052 {
00053 return (s_char_map[symbol] & s_white_space_mask) != 0;
00054 }
00055
00056 // [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] 00057 xml_forceinline00058 bool00059is_public_char(ub1_t symbol)
00060 {
00061 return (s_char_map[symbol] & s_public_char_mask) != 0;
00062 }
00063
00064 // [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+ 00065 xml_forceinline00066 bool00067is_versionnum_char(ub1_t symbol)
00068 {
00069 return (s_char_map[symbol] & s_versionnum_char_mask) != 0;
00070 }
00071
00072 // [81] EncName ::= ,// [A-Za-z] ([A-Za-z0-9._] | '-')* 00073 xml_forceinline00074 bool00075is_encname_char(ub1_t symbol)
00076 {
00077 return (s_char_map[symbol] & s_encname_char_mask) != 0;
00078 }
00079
00080 xml_forceinline00081 bool00082is_digit(ub1_t symbol)
00083 {
00084 return (s_char_map[symbol] & s_digit_mask) != 0;
00085 }
00086
00087 xml_forceinline00088 bool00089is_letter(ub1_t symbol)
00090 {
00091 return symbol > 0x7F || (s_char_map[symbol] & s_english_letter_mask) != 0;
00092 }
00093
00094 // [5] Name ::= (Letter | '_' | ':') (NameChar)* 00095 xml_forceinline00096 bool00097is_name_first_char(ub1_t symbol)
00098 {
00099 return symbol > 0x7F || (s_char_map[symbol] & s_first_char_name_mask);
00100 }
00101
00102 // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender 00103 xml_forceinline00104 bool00105is_name_char(ub1_t symbol)
00106 {
00107 return symbol > 0x7F || (s_char_map[symbol] & s_char_name_mask) != 0;
00108 }
00109
00110 xml_forceinline00111 bool00112is_attribute_char(ub1_t symbol)
00113 {
00114 return symbol != ch_ampersand && symbol != ch_open_angle;
00115 }
00116
00117 #pragma pack()00118 END_TERIMBER_NAMESPACE00119
00120 #endif // _terimber_declxml_hpp_