node.inl
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:7k
- /*
- * ===========================================================================
- * PRODUCTION $Log: node.inl,v $
- * PRODUCTION Revision 1000.2 2004/04/01 21:02:03 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CORE_002] Dev-tree R1.13
- * PRODUCTION
- * ===========================================================================
- */
- #if defined(HTML___NODE__HPP) && !defined(HTML___NODE__INL)
- #define HTML___NODE__INL
- /* $Id: node.inl,v 1000.2 2004/04/01 21:02:03 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author: Eugene Vasilchenko
- *
- */
- inline
- const string& CNCBINode::GetName(void) const
- {
- return m_Name;
- }
- inline
- bool CNCBINode::HaveChildren(void) const
- {
- #if NCBI_LIGHTWEIGHT_LIST
- return !m_Children.empty();
- #else
- return m_Children.get() != 0;
- #endif
- }
- inline
- CNCBINode::TChildren& CNCBINode::Children(void)
- {
- #if NCBI_LIGHTWEIGHT_LIST
- return m_Children;
- #else
- return *m_Children;
- #endif
- }
- inline
- const CNCBINode::TChildren& CNCBINode::Children(void) const
- {
- #if NCBI_LIGHTWEIGHT_LIST
- return m_Children;
- #else
- return *m_Children;
- #endif
- }
- inline
- CNCBINode::TChildren& CNCBINode::GetChildren(void)
- {
- #if NCBI_LIGHTWEIGHT_LIST
- return m_Children;
- #else
- TChildren* children = m_Children.get();
- if ( !children )
- m_Children.reset(children = new TChildren);
- return *children;
- #endif
- }
- inline
- CNCBINode::TChildren::iterator CNCBINode::ChildBegin(void)
- {
- return Children().begin();
- }
- inline
- CNCBINode::TChildren::iterator CNCBINode::ChildEnd(void)
- {
- return Children().end();
- }
- inline
- CNCBINode* CNCBINode::Node(TChildren::iterator i)
- {
- return &**i;
- }
- inline
- CNCBINode::TChildren::const_iterator CNCBINode::ChildBegin(void) const
- {
- return Children().begin();
- }
- inline
- CNCBINode::TChildren::const_iterator CNCBINode::ChildEnd(void) const
- {
- return Children().end();
- }
- inline
- const CNCBINode* CNCBINode::Node(TChildren::const_iterator i)
- {
- return &**i;
- }
- inline
- CNCBINode* CNCBINode::AppendChild(CNCBINode* child)
- {
- if ( child ) {
- DoAppendChild(child);
- }
- return this;
- }
- inline
- CNCBINode* CNCBINode::AppendChild(CNodeRef& ref)
- {
- DoAppendChild(ref.GetPointer());
- return this;
- }
- inline
- bool CNCBINode::HaveAttributes(void) const
- {
- return m_Attributes.get() != 0;
- }
- inline
- CNCBINode::TAttributes& CNCBINode::Attributes(void)
- {
- return *m_Attributes;
- }
- inline
- const CNCBINode::TAttributes& CNCBINode::Attributes(void) const
- {
- return *m_Attributes;
- }
- inline
- CNCBINode::TAttributes& CNCBINode::GetAttributes(void)
- {
- #if NCBI_LIGHTWEIGHT_LIST
- return m_Attributes;
- #else
- TAttributes* attributes = m_Attributes.get();
- if ( !attributes ) {
- m_Attributes.reset(attributes = new TAttributes);
- }
- return *attributes;
- #endif
- }
- inline
- void CNCBINode::SetAttribute(const string& name, const string& value)
- {
- DoSetAttribute(name, value, false);
- }
- inline
- void CNCBINode::SetOptionalAttribute(const string& name, const string& value)
- {
- if ( !value.empty() ) {
- SetAttribute(name, value);
- }
- }
- inline
- void CNCBINode::SetOptionalAttribute(const string& name, bool value)
- {
- if ( value ) {
- SetAttribute(name);
- }
- }
- inline
- void CNCBINode::SetOptionalAttribute(const char* name, const string& value)
- {
- if ( !value.empty() ) {
- SetAttribute(name, value);
- }
- }
- inline
- void CNCBINode::SetOptionalAttribute(const char* name, bool value)
- {
- if ( value ) {
- SetAttribute(name);
- }
- }
- inline
- size_t CNCBINode::GetRepeatCount(void)
- {
- return m_RepeatCount;
- }
- inline
- void CNCBINode::SetRepeatCount(size_t count)
- {
- m_RepeatCount = count;
- }
- inline
- void CNCBINode::RepeatTag(bool repeat)
- {
- m_RepeatTag = repeat;
- }
- inline
- bool CNCBINode::NeedRepeatTag(void)
- {
- return m_RepeatTag;
- }
- /*
- * ===========================================================================
- * $Log: node.inl,v $
- * Revision 1000.2 2004/04/01 21:02:03 gouriano
- * PRODUCTION: UPGRADED [CORE_002] Dev-tree R1.13
- *
- * Revision 1.13 2004/02/02 14:26:05 ivanov
- * CNCBINode: added ability to repeat stored context
- *
- * Revision 1.12 2003/11/03 17:02:53 ivanov
- * Some formal code rearrangement. Move log to end.
- *
- * Revision 1.11 2001/05/17 14:55:43 lavr
- * Typos corrected
- *
- * Revision 1.10 2000/07/18 17:21:35 vasilche
- * Added possibility to force output of empty attribute value.
- * Added caching to CHTML_table, now large tables work much faster.
- * Changed algorithm of emitting EOL symbols in html output.
- *
- * Revision 1.9 2000/03/29 15:50:39 vasilche
- * Added const version of CRef - CConstRef.
- * CRef and CConstRef now accept classes inherited from CObject.
- *
- * Revision 1.8 2000/03/07 15:40:37 vasilche
- * Added AppendChild(CNodeRef&)
- *
- * Revision 1.7 2000/03/07 15:26:06 vasilche
- * Removed second definition of CRef.
- *
- * Revision 1.6 1999/12/28 18:55:29 vasilche
- * Reduced size of compiled object files:
- * 1. avoid inline or implicit virtual methods (especially destructors).
- * 2. avoid std::string's methods usage in inline methods.
- * 3. avoid string literals ("xxx") in inline methods.
- *
- * Revision 1.5 1999/11/19 15:45:32 vasilche
- * CNodeRef implemented as CRef<CNCBINode>
- *
- * Revision 1.4 1999/10/28 13:40:30 vasilche
- * Added reference counters to CNCBINode.
- *
- * Revision 1.3 1999/01/21 16:18:04 sandomir
- * minor changes due to NStr namespace to contain string utility functions
- *
- * Revision 1.2 1998/12/23 21:20:58 vasilche
- * Added more HTML tags (almost all).
- * Importent ones: all lists (OL, UL, DIR, MENU), fonts (FONT, BASEFONT).
- *
- * Revision 1.1 1998/12/21 22:24:57 vasilche
- * A lot of cleaning.
- *
- * ===========================================================================
- */
- #endif /* def HTML___NODE__HPP && ndef HTML___NODE__INL */