From e1490f893ec6523eb88ec04689bec9a36d19bd2e Mon Sep 17 00:00:00 2001 From: skv Date: Fri, 12 Sep 2014 10:32:29 +0400 Subject: [PATCH] Move string list conversion method to the base class --- src/GEOM_I/GEOM_IHealingOperations_i.cc | 22 ++-------------------- src/GEOM_I/GEOM_IHealingOperations_i.hh | 4 ---- src/GEOM_I/GEOM_IOperations_i.cc | 25 +++++++++++++++++++++++++ src/GEOM_I/GEOM_IOperations_i.hh | 11 ++++++++--- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.cc b/src/GEOM_I/GEOM_IHealingOperations_i.cc index af7cb5cd4..51fe6c46e 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.cc +++ b/src/GEOM_I/GEOM_IHealingOperations_i.cc @@ -78,25 +78,6 @@ Handle(TColStd_HArray1OfInteger) GEOM_IHealingOperations_i::Convert return anOutArray; } -//============================================================================= -/*! - * Convert - */ -//============================================================================= -Handle(TColStd_HArray1OfExtendedString) GEOM_IHealingOperations_i::Convert - (const GEOM::string_array& theInArray) -{ - Handle(TColStd_HArray1OfExtendedString) anOutArray; - int n = theInArray.length(); - if ( n <= 0 ) - return anOutArray; - anOutArray = new TColStd_HArray1OfExtendedString( 1, n ); - for ( int i = 0; i < n; i++ ) - anOutArray->SetValue( i+1, TCollection_ExtendedString( theInArray[i].in() ) ); - - return anOutArray; -} - //============================================================================= /*! * ProcessShape @@ -125,7 +106,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ProcessShape (GEOM::GEOM_Object // Perform Handle(GEOM_Object) aNewObject = GetOperations()->ShapeProcess( anObject, - Convert( theOperations ), Convert( theParams ), Convert( theValues ) ); + ConvertStringArray( theOperations ), ConvertStringArray( theParams ), + ConvertStringArray( theValues ) ); if ( !GetOperations()->IsDone() || aNewObject.IsNull() ) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.hh b/src/GEOM_I/GEOM_IHealingOperations_i.hh index 8b30c9530..091358771 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.hh +++ b/src/GEOM_I/GEOM_IHealingOperations_i.hh @@ -33,9 +33,6 @@ #include "GEOMImpl_IHealingOperations.hxx" -#include -#include - class GEOM_I_EXPORT GEOM_IHealingOperations_i : public virtual POA_GEOM::GEOM_IHealingOperations, public virtual GEOM_IOperations_i @@ -101,7 +98,6 @@ class GEOM_I_EXPORT GEOM_IHealingOperations_i : ::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); } private: - Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& ); Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& ); }; diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc index 12184fd17..9cb5b8469 100644 --- a/src/GEOM_I/GEOM_IOperations_i.cc +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -237,3 +237,28 @@ void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj) } } } + +//============================================================================= +/*! + * ConvertStringArray + */ +//============================================================================= +Handle(TColStd_HArray1OfExtendedString) GEOM_IOperations_i::ConvertStringArray + (const GEOM::string_array &theInArray) +{ + Handle(TColStd_HArray1OfExtendedString) anOutArray; + const int n = theInArray.length(); + int i; + + if (n <= 0) { + return anOutArray; + } + + anOutArray = new TColStd_HArray1OfExtendedString( 1, n ); + + for (i = 0; i < n; i++) { + anOutArray->SetValue(i + 1, TCollection_ExtendedString(theInArray[i].in())); + } + + return anOutArray; +} diff --git a/src/GEOM_I/GEOM_IOperations_i.hh b/src/GEOM_I/GEOM_IOperations_i.hh index 1d5b7fd56..b82b36c68 100644 --- a/src/GEOM_I/GEOM_IOperations_i.hh +++ b/src/GEOM_I/GEOM_IOperations_i.hh @@ -52,9 +52,6 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject); virtual Handle(GEOM_Object) GetObjectImpl(GEOM::GEOM_Object_ptr theObject); - virtual Handle(TColStd_HSequenceOfTransient) - GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects); - virtual void StartOperation(); virtual void FinishOperation(); @@ -66,6 +63,14 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio virtual void UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj); +protected: + + Handle(TColStd_HSequenceOfTransient) + GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects); + + Handle(TColStd_HArray1OfExtendedString) + ConvertStringArray(const GEOM::string_array &theInArray); + private: ::GEOM_IOperations* _impl; -- 2.39.2