sl@0: /*
sl@0: * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: Restricted Audio Output Api Implementation  
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #ifndef RESTRICTEDAUDIOOUTPUTIMPL_H
sl@0: #define RESTRICTEDAUDIOOUTPUTIMPL_H
sl@0: 
sl@0: 
sl@0: #include "RestrictedAudioOutputImpl.h"
sl@0: #include <RestrictedAudioOutput.h>
sl@0: 
sl@0: 
sl@0: /**
sl@0:  * CRestrictedAudioOutputImpl class documentation.
sl@0:  *
sl@0:  * @lib RestrictedAudioOutput.lib
sl@0:  *
sl@0:  * @since S60 5.0 
sl@0:  */
sl@0: class CRestrictedAudioOutputImpl : public CBase
sl@0: 	{
sl@0: 
sl@0: public:
sl@0:         
sl@0: 	// Constructors and destructor
sl@0: 
sl@0:     /**
sl@0:      * Constructs, and returns a pointer to, a new CBody object.
sl@0:      * Leaves on failure..
sl@0:      * @return CBody* A pointer to newly created object.
sl@0:      */
sl@0:      static CRestrictedAudioOutputImpl* NewL();
sl@0: 
sl@0: 
sl@0:     /**
sl@0:      * Destructor
sl@0:      *
sl@0:      */
sl@0:     ~CRestrictedAudioOutputImpl();
sl@0: 
sl@0:     /**
sl@0:      * Appends an allowed output to the existing list.
sl@0:      *
sl@0:      * @param aOutput to be appended.
sl@0:      * @return KErrNone if successful. KErrAlreadyExists if aOutput is already
sl@0:      *  appended before. KErrIncompleteInitialization if ConstructL is not called
sl@0:      *  by the deriving class. Otherwise any systemwide error code.
sl@0:      */
sl@0:     TInt AppendAllowedOutput( CRestrictedAudioOutput::TAllowedOutputPreference aOutput );
sl@0: 
sl@0:     /**
sl@0:      * Removes an allowed output from the existing list.
sl@0:      *
sl@0:      * @param The position within the array from where the object is to be
sl@0:      * removed. The position is relative to zero, i.e. zero implies that an
sl@0:      * object at the beginning of the array is to be removed.
sl@0:      *
sl@0:      * @return KErrNone if successful. KErrNotFound if aOutput is not in the
sl@0:      *  the list. KErrIncompleteInitialization if ConstructL is not called
sl@0:      *  by the deriving class. Otherwise any systemwide error code.
sl@0:      */
sl@0:     TInt RemoveAllowedOutput( CRestrictedAudioOutput::TAllowedOutputPreference aOutput );
sl@0: 
sl@0:     /**
sl@0:      * Gets a reference to an allowed output located at a specified position
sl@0:      * within the list.
sl@0:      *
sl@0:      * @param The position within the array from where the object is to be
sl@0:      * removed. The position is relative to zero, i.e. zero implies that an
sl@0:      * object at the beginning of the array is to be removed.
sl@0:      *
sl@0:      * @param The position within the array from where the object is to be
sl@0:      * removed. The position is relative to zero, i.e. zero implies that an
sl@0:      * object at the beginning of the array is to be removed.
sl@0:      *
sl@0:      * @param A const reference to the object at position anIndex within the
sl@0:      * list.
sl@0:      *
sl@0:      * @return KErrNone if successful. KErrNotFound if index is not in the
sl@0:      *  the list. KErrIncompleteInitialization if ConstructL is not called
sl@0:      *  by the deriving class. Otherwise any systemwide error code.
sl@0:      */
sl@0:     TInt GetAllowedOutput( TInt aIndex, CRestrictedAudioOutput::TAllowedOutputPreference& aOutput  );
sl@0: 
sl@0:     /**
sl@0:      * Gets the number of objects in the array.
sl@0:      *
sl@0:      * @param On successful return will contain the number of objects in
sl@0:      * the list.
sl@0:      *
sl@0:      * @return KErrIncompleteInitialization if ConstructL is not called
sl@0:      *  by the deriving class. Otherwise a system wide error code.
sl@0:      */
sl@0:     TInt GetAllowedOutputCount( TInt& aSize );
sl@0: 
sl@0:     /**
sl@0:      * Empties the list, so that it is ready to be reused.
sl@0:      *
sl@0:      *
sl@0:      * @return KErrNone if successful. KErrIncompleteInitialization if ConstructL
sl@0:      *  is not called by the deriving class.
sl@0:      */
sl@0:     TInt Reset();
sl@0: 
sl@0:     /**
sl@0:      * Applies settings cached locally and commits.
sl@0:      *
sl@0:      * @return KErrNone if successful.
sl@0:      */
sl@0:     TInt Commit();
sl@0:     
sl@0:     private:
sl@0: 
sl@0:         /**
sl@0:         * C++ default constructor.
sl@0:         */
sl@0:         CRestrictedAudioOutputImpl();
sl@0: 
sl@0:         /**
sl@0:         * By default Symbian 2nd phase constructor is private.
sl@0:         */
sl@0:         static void ConstructL();
sl@0:   
sl@0: 		TBool ExistsInArray(CRestrictedAudioOutput::TAllowedOutputPreference& aOutput);        
sl@0:         
sl@0: 	// Data:
sl@0: 	
sl@0: 
sl@0:     private:    // Friend classes
sl@0:            friend class CRestrictedAudioOutput;
sl@0:       
sl@0: 		RArray<CRestrictedAudioOutput::TAllowedOutputPreference> iAllowedOutputPrefArray; 		
sl@0: 
sl@0: 	};
sl@0: 
sl@0: #endif // RESITRCTEDAUDIOOUTPUTIMPL_H
sl@0: 
sl@0: // End of file