diff options
Diffstat (limited to 'autodoc/source/ary/doc/d_namedlist.cxx')
-rw-r--r-- | autodoc/source/ary/doc/d_namedlist.cxx | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/autodoc/source/ary/doc/d_namedlist.cxx b/autodoc/source/ary/doc/d_namedlist.cxx deleted file mode 100644 index fd0ec04e286c..000000000000 --- a/autodoc/source/ary/doc/d_namedlist.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: d_namedlist.cxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <precomp.h> -#include <ary/doc/d_namedlist.hxx> - - -// NOT FULLY DEFINED SERVICES -#include <algorithm> - - - -namespace ary -{ -namespace doc -{ - - -typedef StringVector::const_iterator name_const_iterator; -typedef StringVector::iterator name_iterator; -typedef NodeList::iterator node_iterator; - - -NamedList::NamedList(nodetype::id i_id) - : Node(i_id), - aNames(), - aElements() -{ -} - -NamedList::~NamedList() -{ -} - -const Node * -NamedList::operator[](const String & i_name) const -{ - name_const_iterator - itFound = std::find(aNames.begin(), aNames.end(), i_name); - if (itFound != aNames.end()) - return & aElements[itFound - aNames.begin()]; - return 0; -} - -void -NamedList::Add_Node( const String & i_name, - DYN Node & pass_Element, - E_HandleDuplicateNames eHandleDuplicateNames ) -{ - switch (eHandleDuplicateNames) - { - case hdn_normal: - AddNode_normal(i_name,pass_Element); - break; - case hdn_put_together: - AddNode_put_together(i_name,pass_Element); - break; - case hdn_keep_only_first: - AddNode_keep_only_first(i_name,pass_Element); - break; - default: - csv_assert(false); - } -} - -void -NamedList::AddNode_normal( const String & i_name, - DYN Node & pass_Element ) -{ - aNames.push_back(i_name); - aElements.push_back(pass_Element); -} - -void -NamedList::AddNode_put_together( const String & i_name, - DYN Node & pass_Element ) -{ - name_iterator - itFound = std::find(aNames.begin(), aNames.end(), i_name); - if (itFound == aNames.end()) - { - AddNode_normal(i_name, pass_Element); - return; - } - - // Find position after last equal name: - for ( ++itFound; - itFound != aNames.end() - ? *itFound == i_name - : false; - ++itFound ) {} - - // Calculate same position in aElements: - node_iterator - itElem = aElements.begin() + (itFound - aNames.begin()); - - aNames.insert(itFound, i_name); - aElements.insert(itElem, pass_Element); -} - -void -NamedList::AddNode_keep_only_first( const String & i_name, - DYN Node & pass_Element ) -{ - if (std::find(aNames.begin(), aNames.end(), i_name) == aNames.end()) - AddNode_normal(i_name, pass_Element); - else - delete &pass_Element; -} - -void -NamedList::do_Accept(csv::ProcessorIfc & io_processor ) const -{ - csv::CheckedCall(io_processor,*this); -} - - - - -} // namespace doc -} // namespace ary |