diff -r 000000000000 -r 88edb906c587 svgtopt/SVG/SVGImpl/src/SVGVectorCssValueImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/svgtopt/SVG/SVGImpl/src/SVGVectorCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: SVG Implementation source file + * +*/ + + +#ifdef _DEBUG +#if !defined(__E32DEBUG_H__) +#include +#endif +#endif + +#include "SVGVectorCssValueImpl.h" +#include "SVGPointLexer.h" + + + + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +CVectorCssValueImpl::~CVectorCssValueImpl() + { + if ( iValue ) + { + iValue->Reset(); + delete iValue; + iValue = NULL; + } + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +void CVectorCssValueImpl::Value( CArrayFix*& aArray ) + { + aArray = iValue; + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +CArrayFix* CVectorCssValueImpl::Value( ) + { + return iValue; + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +TInt CVectorCssValueImpl::SetValueL( const TDesC& aValue ) + { + + if ( iValue ) + { + iValue->Reset(); + delete iValue; + iValue = NULL; + } + iValue = new ( ELeave ) CArrayFixFlat( 1 ); + + + TSvgPointLexer svgplex( aValue ); + + while ( !svgplex.IsDone() ) + { + TChar com = ','; + TFloatFixPt dashf; + TInt32 rslt = svgplex.GetNext( com, dashf ); + if ( rslt != KErrNone ) + { + break; + } + iValue->AppendL( dashf ); + } + svgplex.Cleanup(); + + return KErrNone; + } + + +// ******************************************************* +// Private + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +CVectorCssValueImpl::CVectorCssValueImpl():iValue( NULL ) + { + } +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +CVectorCssValueImpl::CVectorCssValueImpl(CArrayFix* aValue ):iValue( aValue ) + { + } + +// --------------------------------------------------------------------------- +// function for encoding +// --------------------------------------------------------------------------- +void CVectorCssValueImpl::SetValueL( CArrayFix*& aValue ) + { + if ( iValue ) + { + iValue->Reset(); + delete iValue; + iValue = NULL; + } + + iValue= aValue; + } + +// --------------------------------------------------------------------------- +// function for encoding +// --------------------------------------------------------------------------- +void CVectorCssValueImpl::CloneValueL( CArrayFix*& aValue ) + { + if ( iValue ) + { + iValue->Reset(); + delete iValue; + iValue = NULL; + } + + iValue = new ( ELeave ) CArrayFixFlat( 1 ); + + TInt valCnt = aValue->Count(); + for (TInt i=0; i < valCnt; i++) + { + iValue->AppendL( aValue->At(i) ); + } + + } + +// --------------------------------------------------------------------------- +// +// --------------------------------------------------------------------------- +TBool CVectorCssValueImpl::IsEqual( CCssValue* aValue ) +{ + if (((CVectorCssValueImpl*)aValue)->iValue == iValue) + { + return ETrue; + } + + return EFalse; +} + +void CVectorCssValueImpl::Print() +{ + #ifdef _DEBUG + + TInt valCnt = iValue->Count(); + for (TInt i=0; i < valCnt; i++) + { + RDebug::Printf("%d, ", (int)(iValue->At(i))); + } + #endif +}