diff options
author | Jörg Barfurth <jb@openoffice.org> | 2001-06-20 19:17:35 +0000 |
---|---|---|
committer | Jörg Barfurth <jb@openoffice.org> | 2001-06-20 19:17:35 +0000 |
commit | 1fb37f698619762ce3b49cd60680f661f9709194 (patch) | |
tree | f6b6fa24b1a828d1f44dd7a55915db2e7ebdd01c /configmgr/source | |
parent | c6fb9587aa54f84659771101709d9a6dbe4b8284 (diff) |
Optimized data storage for ValueNode
Diffstat (limited to 'configmgr/source')
-rw-r--r-- | configmgr/source/inc/anypair.hxx | 82 | ||||
-rw-r--r-- | configmgr/source/inc/valuenode.hxx | 99 | ||||
-rw-r--r-- | configmgr/source/misc/anypair.cxx | 457 | ||||
-rw-r--r-- | configmgr/source/misc/makefile.mk | 5 | ||||
-rw-r--r-- | configmgr/source/tree/cmtree.cxx | 69 |
5 files changed, 640 insertions, 72 deletions
diff --git a/configmgr/source/inc/anypair.hxx b/configmgr/source/inc/anypair.hxx new file mode 100644 index 000000000000..38b53861f8f4 --- /dev/null +++ b/configmgr/source/inc/anypair.hxx @@ -0,0 +1,82 @@ +#ifndef CFGMGR_ANYPAIR_HXX +#define CFGMGR_ANYPAIR_HXX + +#ifndef _UNO_ANY2_H_ +#include <uno/any2.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_ANY_HXX_ +#include <com/sun/star/uno/Any.hxx> +#endif + +#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_ +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#endif + +namespace configmgr +{ + namespace css = com::sun::star; + namespace uno = css::uno; + namespace lang = css::lang; + + //========================================================================== + //= AnyPair + //========================================================================== + // this AnyPair holds 2 Any's with has always the same type. + // to safe some mem we have decide to create this construct. + + + struct cfgmgr_AnyPair + { + typelib_TypeDescriptionReference * m_pType; + void* m_pFirst; + void* m_pSecond; + }; + +// ----------------------------------------------------------------------------- + class AnyPair + { + cfgmgr_AnyPair m_aAnyPair; + + public: + // ctors + AnyPair(); + explicit AnyPair(uno::Type const& _aType); // one Type, any's are null + explicit AnyPair(uno::Any const& _aAny); // one any + + explicit AnyPair(uno::Any const& _aAny, uno::Any const& _aAny2) SAL_THROW((lang::IllegalArgumentException)); + + // copy-ctor + AnyPair(AnyPair const& _aAny); + + // assign operator + AnyPair& operator=(AnyPair const& _aAny); + + // d-tor + ~AnyPair(); + + // set-types + void setType(uno::Type const& _aType); + + void setFirst(uno::Any const& _aAny); + void setSecond(uno::Any const& _aAny); + + + uno::Any getFirst() const; + uno::Any getSecond() const; + uno::Type getValueType() const; + + bool hasFirst() const {return m_aAnyPair.m_pFirst ? true : false;} + bool hasSecond() const {return m_aAnyPair.m_pSecond ? true : false;} + bool isNull() const {return m_aAnyPair.m_pFirst == NULL && m_aAnyPair.m_pSecond == 0;} + + void check_init(); + void init(); + }; + + + + +} // namespace + +#endif diff --git a/configmgr/source/inc/valuenode.hxx b/configmgr/source/inc/valuenode.hxx index 469ee0b60c27..f596ff5b1f07 100644 --- a/configmgr/source/inc/valuenode.hxx +++ b/configmgr/source/inc/valuenode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: valuenode.hxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: jb $ $Date: 2001-04-05 14:43:13 $ + * last change: $Author: jb $ $Date: 2001-06-20 20:17:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,12 @@ #include "configpath.hxx" #endif +#ifndef _UNO_ANY2_H_ +#include <uno/any2.h> +#endif + +#include <anypair.hxx> + namespace configmgr { @@ -143,6 +149,54 @@ namespace configmgr RTTI_BASE(INode); }; + + + //========================================================================== + //= ISubtree + //========================================================================== + // Abstract class + + class ASubtree : public INode + { + sal_Int16 m_nLevel; /// determines if everything is read + ::rtl::OUString m_sId; + + public: + virtual bool isSetNode() const = 0; + + }; + + //========================================================================== + //= GroupTree + //========================================================================== + class GroupTree : public ASubtree + { + public: + virtual bool isSetNode() const; // always false! + + }; + + //========================================================================== + //= SetTree + //========================================================================== + class SetTree : public ASubtree + { + ::rtl::OUString m_sTemplateName; /// path of the template for child instantiation + ::rtl::OUString m_sTemplateModule; /// module of the template for child instantiation + public: + virtual bool isSetNode() const; // always true! + }; + + + + + + + +// ----------------------------------------------------------------------------- +// ----------------------------------- O L D ----------------------------------- +// ----------------------------------------------------------------------------- + //========================================================================== //= ISubtree //========================================================================== @@ -223,9 +277,10 @@ namespace configmgr //========================================================================== class ValueNode : public INode { - uno::Type m_aType; - uno::Any m_aValue; - uno::Any m_aDefaultValue; + AnyPair m_aValuePair; + // uno::Type m_aType; + // uno::Any m_aValue; + // uno::Any m_aDefaultValue; public: ValueNode(){} @@ -236,26 +291,32 @@ namespace configmgr :INode(aName, _aAttrs) {} ValueNode(rtl::OUString const& aName,uno::Type const& aType, configuration::Attributes _aAttrs) - :INode(aName, _aAttrs), m_aType(aType) - { check_init(); } + :INode(aName, _aAttrs), m_aValuePair(aType) + { + check_init(); + } ValueNode(rtl::OUString const& aName,uno::Any const& anAny, configuration::Attributes _aAttrs) - :INode(aName, _aAttrs), m_aValue(anAny) - { init(); } + :INode(aName, _aAttrs), m_aValuePair(anAny) + { + init(); + } ValueNode(rtl::OUString const& aName,uno::Any const& anAny,uno::Any const& aDefault, configuration::Attributes _aAttrs) - :INode(aName, _aAttrs), m_aValue(anAny), m_aDefaultValue(aDefault) - { init(); } + :INode(aName, _aAttrs), m_aValuePair(anAny, aDefault) + { + init(); + } - bool isNull() const {return !m_aValue.hasValue() && !m_aDefaultValue.hasValue();} - bool hasDefault() const {return getAttributes().bNullable || m_aDefaultValue.hasValue();} - bool isDefault() const {return !m_aValue.hasValue() && hasDefault();} + bool isNull() const {return m_aValuePair.isNull();} + bool hasDefault() const {return getAttributes().bNullable || m_aValuePair.hasSecond();} + bool isDefault() const {return !m_aValuePair.hasFirst() && hasDefault();} - uno::Type getValueType() const {return m_aType;} - uno::Any getValue() const {return isDefault() ? m_aDefaultValue : m_aValue;} - const uno::Any& getDefault() const {return m_aDefaultValue;} + uno::Type getValueType() const {return m_aValuePair.getValueType();} + uno::Any getValue() const {return isDefault() ? m_aValuePair.getSecond() : m_aValuePair.getFirst();} + uno::Any getDefault() const {return m_aValuePair.getSecond();} - void setValue(uno::Any aValue); - void changeDefault(uno::Any aValue); + void setValue(uno::Any const& _aValue); + void changeDefault(uno::Any const& _aValue); void setDefault(); virtual INode* clone() const; diff --git a/configmgr/source/misc/anypair.cxx b/configmgr/source/misc/anypair.cxx new file mode 100644 index 000000000000..a200d5d69550 --- /dev/null +++ b/configmgr/source/misc/anypair.cxx @@ -0,0 +1,457 @@ +/************************************************************************* + * + * $RCSfile: anypair.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: jb $ $Date: 2001-06-20 20:16:02 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _UNO_ANY2_H_ +#include <uno/any2.h> +#endif + +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#include <com/sun/star/uno/Any.h> +#endif + +#include <anypair.hxx> + +#include <rtl/alloc.h> + +namespace configmgr +{ + namespace css = com::sun::star; + namespace uno = css::uno; + + + +// Dirty Hack + inline uno_Any * firstAny(cfgmgr_AnyPair* _pPair) + { + return reinterpret_cast<uno_Any*>(_pPair); + } + +// ----------------------------------------------------------------------------- + void anypair_construct_default(cfgmgr_AnyPair *_pAnyPair) + { + _pAnyPair->m_pFirst = _pAnyPair->m_pSecond = NULL; + uno_any_construct(firstAny(_pAnyPair),0,0, uno::cpp_acquire); + OSL_ASSERT(_pAnyPair->m_pFirst == NULL); + _pAnyPair->m_pSecond = NULL; + } + +// ----------------------------------------------------------------------------- + void anypair_construct_type(cfgmgr_AnyPair *_pAnyPair, typelib_TypeDescriptionReference* _pType) + { + _pAnyPair->m_pFirst = _pAnyPair->m_pSecond = NULL; + _pAnyPair->m_pType = _pType; + ::typelib_typedescriptionreference_acquire( _pAnyPair->m_pType ); + } +// ----------------------------------------------------------------------------- + void anypair_assign_type(cfgmgr_AnyPair *_pAnyPair, typelib_TypeDescriptionReference* _pType) + { + typelib_typedescriptionreference_assign( &_pAnyPair->m_pType, _pType ); + } + +// ----------------------------------------------------------------------------- + void anypair_construct_first(cfgmgr_AnyPair *_pAnyPair, const uno_Any *_pUnoAny) + { + _pAnyPair->m_pFirst = _pAnyPair->m_pSecond = NULL; + + uno_type_any_construct(firstAny(_pAnyPair), _pUnoAny->pData, _pUnoAny->pType, uno::cpp_acquire); + _pAnyPair->m_pSecond = NULL; + } + +// ----------------------------------------------------------------------------- + void anypair_construct_second(cfgmgr_AnyPair *_pAnyPair, const uno_Any *_pUnoAny) + { + _pAnyPair->m_pFirst = _pAnyPair->m_pSecond = NULL; + + uno_Any aTmp; + uno_type_any_construct(&aTmp,_pUnoAny->pData, _pUnoAny->pType, uno::cpp_acquire); + _pAnyPair->m_pType = aTmp.pType; + _pAnyPair->m_pSecond = aTmp.pData; + _pAnyPair->m_pFirst = NULL; + } + +// ----------------------------------------------------------------------------- + // if type not equal, you got false and the struct contains {0,0,0} + sal_Bool anypair_construct(cfgmgr_AnyPair *_pAnyPair, const uno_Any* _pFirstAny, const uno_Any *_pSecondAny) + { + _pAnyPair->m_pFirst = _pAnyPair->m_pSecond = NULL; + bool bHasFirst = (_pFirstAny ->pType->eTypeClass != typelib_TypeClass_VOID); + bool bHasSecond = (_pSecondAny->pType->eTypeClass != typelib_TypeClass_VOID); + + if (bHasFirst) + { + if (bHasSecond && ! typelib_typedescriptionreference_equals(_pFirstAny->pType,_pSecondAny->pType)) + { + OSL_ENSURE(false, "anypair_construct(): Cannot construct - Different types"); + return false; + } + + // construct first value + uno_type_any_construct(firstAny(_pAnyPair), _pFirstAny->pData, _pFirstAny->pType, uno::cpp_acquire); + + if (bHasSecond && _pSecondAny->pData != NULL) + { + // construct second value + uno_Any aTmp; + uno_type_any_construct(&aTmp,_pSecondAny->pData, _pSecondAny->pType, uno::cpp_acquire); + _pAnyPair->m_pSecond = aTmp.pData; + + OSL_ASSERT(typelib_typedescriptionreference_equals(aTmp.pType,_pAnyPair->m_pType)); + typelib_typedescriptionreference_release(aTmp.pType); + } + // else + // _pAnyPair->m_pSecond = NULL; + } + else + { + if (bHasSecond) + { + anypair_construct_second(_pAnyPair,_pSecondAny); + } + else + { + _pAnyPair->m_pType = _pFirstAny->pType; + typelib_typedescriptionreference_acquire(_pAnyPair->m_pType); + // _pAnyPair->m_pFirst = NULL; + } + } + + return true; + } + +// ----------------------------------------------------------------------------- + void anypair_clear_first(cfgmgr_AnyPair* _pAnyPair) + { + if (_pAnyPair->m_pFirst) + { + uno_Any aTmp; + aTmp.pData = _pAnyPair->m_pFirst; + aTmp.pType = _pAnyPair->m_pType; + typelib_typedescriptionreference_acquire(aTmp.pType); + + uno_any_destruct(&aTmp, uno::cpp_release); + + _pAnyPair->m_pFirst = NULL; + } + } + +// ----------------------------------------------------------------------------- + void anypair_clear_second(cfgmgr_AnyPair* _pAnyPair) + { + if (_pAnyPair->m_pSecond) + { + uno_Any aTmp; + aTmp.pData = _pAnyPair->m_pSecond; + aTmp.pType = _pAnyPair->m_pType; + typelib_typedescriptionreference_acquire(aTmp.pType); + + uno_any_destruct(&aTmp, uno::cpp_release); + + _pAnyPair->m_pSecond = NULL; + } + } + +// ----------------------------------------------------------------------------- + void anypair_destruct(cfgmgr_AnyPair* _pAnyPair) + { + anypair_clear_first(_pAnyPair); + anypair_clear_second(_pAnyPair); + + ::typelib_typedescriptionreference_release( _pAnyPair->m_pType ); + OSL_DEBUG_ONLY(_pAnyPair->m_pType = (typelib_TypeDescriptionReference*)0xdeadbeef); + + } + +// ----------------------------------------------------------------------------- + void anypair_copy_construct(cfgmgr_AnyPair* _pAnyPair, const cfgmgr_AnyPair* _pAnyPairFrom) + { + _pAnyPair->m_pType = _pAnyPairFrom->m_pType; + _pAnyPair->m_pFirst = _pAnyPair->m_pSecond = NULL; + + typelib_typedescriptionreference_acquire(_pAnyPair->m_pType); + + if (_pAnyPairFrom->m_pFirst) + { + uno_Any aTmp; + uno_type_any_construct(&aTmp,_pAnyPairFrom->m_pFirst, _pAnyPairFrom->m_pType, uno::cpp_acquire); + _pAnyPair->m_pFirst = aTmp.pData; + OSL_ASSERT(typelib_typedescriptionreference_equals(_pAnyPair->m_pType,aTmp.pType)); + typelib_typedescriptionreference_release(aTmp.pType); + } + if (_pAnyPairFrom->m_pSecond) + { + uno_Any aTmp; + uno_type_any_construct(&aTmp,_pAnyPairFrom->m_pSecond, _pAnyPairFrom->m_pType, uno::cpp_acquire); + _pAnyPair->m_pSecond = aTmp.pData; + OSL_ASSERT(typelib_typedescriptionreference_equals(_pAnyPair->m_pType,aTmp.pType)); + typelib_typedescriptionreference_release(aTmp.pType); + } + } + + static + sal_Bool anypair_canassign(typelib_TypeDescriptionReference* _ppType, const uno_Any *_pUnoAny) + { + typelib_TypeClass eTC = _ppType->eTypeClass; + if (eTC == typelib_TypeClass_VOID || eTC == typelib_TypeClass_ANY ) + return true; + + else if ( typelib_typedescriptionreference_equals(_ppType,_pUnoAny->pType) ) + return true; + + else if (_pUnoAny->pData == NULL && _pUnoAny->pType->eTypeClass == typelib_TypeClass_VOID) + return true; + + else + return false; + } + + static + sal_Bool anypair_assign_helper(typelib_TypeDescriptionReference** _ppType, void** _ppData , const uno_Any *_pUnoAny) + { + if (!anypair_canassign(*_ppType,_pUnoAny)) + return false; + + bool bOldNull = (*_ppData == NULL); + bool bNewNull = (_pUnoAny->pData == NULL); + + if (bOldNull) + { + if (!bNewNull) + { + uno_Any aTmp; + uno_type_any_construct(&aTmp,_pUnoAny->pData, _pUnoAny->pType, uno::cpp_acquire); + + typelib_typedescriptionreference_release(*_ppType); + + *_ppData = aTmp.pData; + *_ppType = aTmp.pType; + } + } + else + { + uno_Any aTmp; + aTmp.pData = *_ppData; + aTmp.pType = *_ppType; + + if (bNewNull) + typelib_typedescriptionreference_acquire(*_ppType); + + uno_type_any_assign(&aTmp,_pUnoAny->pData, _pUnoAny->pType, uno::cpp_acquire, uno::cpp_release); + + *_ppData = aTmp.pData; + if (bNewNull) + { + OSL_ASSERT(aTmp.pData == NULL); + typelib_typedescriptionreference_release(aTmp.pType); + } + else + { + *_ppType = aTmp.pType; + } + } + + return true; + } +// ----------------------------------------------------------------------------- + sal_Bool anypair_assign_first(cfgmgr_AnyPair* _pAnyPair, const uno_Any* _pAny) + { + return anypair_assign_helper(&_pAnyPair->m_pType, &_pAnyPair->m_pFirst, _pAny); + } + +// ----------------------------------------------------------------------------- + sal_Bool anypair_assign_second(cfgmgr_AnyPair* _pAnyPair, const uno_Any* _pAny) + { + return anypair_assign_helper(&_pAnyPair->m_pType, &_pAnyPair->m_pSecond, _pAny); + } + + +// ----------------------------------------------------------------------------- + // ctors + AnyPair::AnyPair() + { + anypair_construct_default(&m_aAnyPair); + } + +// ----------------------------------------------------------------------------- + AnyPair::AnyPair(uno::Type const& _aType) // one Type, any's are null + { + anypair_construct_type(&m_aAnyPair, _aType.getTypeLibType()); + } + +// ----------------------------------------------------------------------------- + AnyPair::AnyPair(uno::Any const& _aAny) // one any + { + anypair_construct_first(&m_aAnyPair,&_aAny); + } + +// ----------------------------------------------------------------------------- + AnyPair::AnyPair(uno::Any const& _aAny, uno::Any const& _aAny2) SAL_THROW((lang::IllegalArgumentException)) + { + if (!anypair_construct(&m_aAnyPair,&_aAny, &_aAny2)) + { + // throw lang::IllegalArgumentException(rtl::OUString::createFromAscii("Types are not equal.")); + } + } + +// ----------------------------------------------------------------------------- + // copy-ctor + AnyPair::AnyPair(AnyPair const& _aAny) + { + anypair_copy_construct(&m_aAnyPair, &_aAny.m_aAnyPair); + } + +// ----------------------------------------------------------------------------- + // assign operator + AnyPair& AnyPair::operator=(AnyPair const& _aAny) + { + if (this != &_aAny) + { + anypair_destruct(&m_aAnyPair); + anypair_copy_construct(&m_aAnyPair, &_aAny.m_aAnyPair); + } + return *this; + } + +// ----------------------------------------------------------------------------- + // d-tor + AnyPair::~AnyPair() + { + anypair_destruct(&m_aAnyPair); + } + + +// ----------------------------------------------------------------------------- + void AnyPair::setFirst(uno::Any const& _aAny) + { + OSL_VERIFY(anypair_assign_first(&m_aAnyPair,&_aAny)); + } + +// ----------------------------------------------------------------------------- + void AnyPair::setSecond(uno::Any const& _aAny) + { + OSL_VERIFY(anypair_assign_second(&m_aAnyPair,&_aAny)); + } + +// ----------------------------------------------------------------------------- + uno::Any AnyPair::getFirst() const + { + // BACK: null any, if any not set. + if (m_aAnyPair.m_pFirst) + { + return uno::Any( m_aAnyPair.m_pFirst, m_aAnyPair.m_pType ); + } + else + return uno::Any(); + } +// ----------------------------------------------------------------------------- + uno::Any AnyPair::getSecond() const + { + // BACK: null any, if any not set. + if (m_aAnyPair.m_pSecond) + { + return uno::Any( m_aAnyPair.m_pSecond, m_aAnyPair.m_pType ); + } + else + return uno::Any(); + } + +// ----------------------------------------------------------------------------- + uno::Type AnyPair::getValueType() const + { + return uno::Type(m_aAnyPair.m_pType); + } + +// ----------------------------------------------------------------------------- + + // in Header + // bool hasFirst() const {return m_pFirst ? true : false;} + // bool hasSecond() const {return m_pSecond ? true : false;} + // bool isNull() const {return m_pFirst == NULL && m_pSecond == 0;} + void AnyPair::check_init() + { + if (this->hasFirst() || this->hasSecond()) + { + OSL_ASSERT(this->getValueType() != ::getVoidCppuType()); + } + } +// ----------------------------------------------------------------------------- + void AnyPair::init() + { + if (hasSecond()) + { + OSL_ASSERT(this->getValueType() != ::getVoidCppuType()); + } + else if (hasFirst()) + { + OSL_ASSERT(this->getValueType() != ::getVoidCppuType()); + } + else + { + // no type set, we must be void. + OSL_ASSERT(this->getValueType() == ::getVoidCppuType()); // at init time ValueType must be void + } + } + + + + + +} // namespace + diff --git a/configmgr/source/misc/makefile.mk b/configmgr/source/misc/makefile.mk index 4c8c29e8040d..a38c9b00a9c6 100644 --- a/configmgr/source/misc/makefile.mk +++ b/configmgr/source/misc/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.14 $ +# $Revision: 1.15 $ # -# last change: $Author: lla $ $Date: 2001-05-31 14:48:56 $ +# last change: $Author: jb $ $Date: 2001-06-20 20:16:02 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,6 +75,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ + $(SLO)$/anypair.obj \ $(SLO)$/bootstrap.obj \ $(SLO)$/providerfactory.obj \ $(SLO)$/tracer.obj \ diff --git a/configmgr/source/tree/cmtree.cxx b/configmgr/source/tree/cmtree.cxx index af9717090641..9a78253be962 100644 --- a/configmgr/source/tree/cmtree.cxx +++ b/configmgr/source/tree/cmtree.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cmtree.cxx,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: jb $ $Date: 2001-06-11 09:33:08 $ + * last change: $Author: jb $ $Date: 2001-06-20 20:16:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -305,70 +305,37 @@ namespace configmgr it != m_aChildren.GetSet().end(); ++it) (**it).dispatch(anAction); - } - -// -------------------------- ValueNode implementation -------------------------- - void ValueNode::check_init() // may throw in the future - { - if (m_aValue.hasValue()) - { - OSL_ASSERT(m_aType != ::getVoidCppuType()); - OSL_ASSERT(m_aType == m_aValue.getValueType()); - } - else OSL_ASSERT(getVoidCppuType() == m_aValue.getValueType()); - - if (m_aDefaultValue.hasValue()) - { - OSL_ASSERT(m_aType != ::getVoidCppuType()); - OSL_ASSERT(m_aType == m_aDefaultValue.getValueType()); - } - else OSL_ASSERT(getVoidCppuType() == m_aDefaultValue.getValueType()); - } + } - void ValueNode::init() - { - OSL_ASSERT(m_aType == ::getVoidCppuType()); +// // -------------------------- ValueNode implementation -------------------------- + void ValueNode::check_init() // may throw in the future + { + m_aValuePair.check_init(); + } - if (m_aDefaultValue.hasValue()) - { - m_aType = m_aDefaultValue.getValueType(); - OSL_ASSERT(m_aType != ::getVoidCppuType()); - } - else if (m_aValue.hasValue()) - { - m_aType = m_aValue.getValueType(); - OSL_ASSERT(m_aType != ::getVoidCppuType()); - } + void ValueNode::init() + { + m_aValuePair.init(); } - void ValueNode::setValue(Any aValue) + void ValueNode::setValue(Any const& _aValue) { - m_aValue = aValue; - // flip the type if necessary - if ( (m_aType.getTypeClass() == TypeClass_ANY) - && (aValue.getValueType().getTypeClass() != TypeClass_ANY) - && (aValue.getValueType().getTypeClass() != TypeClass_VOID) - ) - m_aType = aValue.getValueType(); + m_aValuePair.setFirst(_aValue); } - void ValueNode::changeDefault(Any aValue) + void ValueNode::changeDefault(Any const& _aValue) { - m_aDefaultValue = aValue; - // flip the type if necessary - if ( (m_aType.getTypeClass() == TypeClass_ANY) - && (aValue.getValueType().getTypeClass() != TypeClass_ANY) - && (aValue.getValueType().getTypeClass() != TypeClass_VOID) - ) - m_aType = aValue.getValueType(); + m_aValuePair.setSecond(_aValue); } void ValueNode::setDefault() { // PRE: ???? // POST: isDefault() == true - m_aValue = Any(); + // OSL_ENSURE(false, "ValueNode::setDefault(): this isn't really defined yet."); + // m_aValue = Any(); + // m_pFirst = NULL; } INode* ValueNode::clone() const |