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_xmlmodel_hpp_00029 #define _terimber_xmlmodel_hpp_00030
00031 #include "xml/xmlmodel.h"00032
00033 BEGIN_TERIMBER_NAMESPACE00034 #pragma pack(4)00035
00037 inline00038 void00039content_node::init(byte_allocator& allocator_, size_t sizeBit)
00040 {
00041 _firstPos.resize(allocator_, sizeBit);
00042 _lastPos.resize(allocator_, sizeBit);
00043 }
00044
00045 inline00046 dfaRule00047content_node::get_rule() const00048 {
00049 return_rule;
00050 }
00051
00052 inline00053 const_bitset&
00054content_node::get_firstPos() const00055 {
00056 if (_firstPos.empty())
00057 {
00058 _bitset& first = const_cast<_bitset& >(_firstPos);
00059 calc_pos(first, true);
00060 }
00061
00062 return_firstPos;
00063 }
00064
00065 inline00066 const_bitset&
00067content_node::get_lastPos() const00068 {
00069 if (_lastPos.empty())
00070 {
00071 _bitset& last = const_cast<_bitset& >(_lastPos);
00072 calc_pos(last, false);
00073 }
00074
00075 return_lastPos;
00076 }
00077
00079 inline00080 size_t00081content_any::get_pos() const00082 {
00083 return_pos;
00084 }
00085
00087 inline00088 constelementDecl*
00089content_leaf::get_decl() const00090 {
00091 return_decl;
00092 }
00093
00094 inline00095 size_t00096content_leaf::get_pos() const00097 {
00098 return_pos;
00099 }
00100
00101 inline00102 void00103content_leaf::set_pos(size_t pos)
00104 {
00105 _pos = pos;
00106 }
00107
00108
00110 inline00111 content_node*
00112content_unary::get_child() const00113 {
00114 return_child;
00115 }
00116
00117 inline00118 void00119content_unary::calc_pos(_bitset& state, bool first) const00120 {
00121 state = first ? _child->get_firstPos() : _child->get_lastPos();
00122 }
00123
00125 inline00126 content_node*
00127content_binary::get_left() const00128 {
00129 return_left;
00130 }
00131
00132 inline00133 content_node*
00134content_binary::get_right() const00135 {
00136 return_right;
00137 }
00138
00140 inline00141 void00142content_children::make_def_state_list(_vector< size_t >& x) const00143 {
00144 x.resize(_tmp_allocator, _elemMapSize);
00145 for (size_t index = 0; index < _elemMapSize; ++index)
00146 x[index] = 0xffffffff;
00147 }
00148
00149 #pragma pack()00150 END_TERIMBER_NAMESPACE00151
00152 #endif // _terimber_xmlmodel_hpp_