commonutilities/common/inc/glxcommandparser.h
branchRCL_3
changeset 59 8e5f6eea9c9f
equal deleted inserted replaced
57:ea65f74e6de4 59:8e5f6eea9c9f
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Command request
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef GLXCOMMANDPARSER_H_
       
    21 #define GLXCOMMANDPARSER_H_
       
    22 
       
    23 #include <glxmediaid.h>
       
    24 #include <glxmediageneraldefs.h>
       
    25 #include <lbsposition.h>
       
    26 #include <mpxcommand.h>
       
    27 
       
    28 /**
       
    29  * MGlxCommandParserCallback command handling interface.
       
    30  */
       
    31 NONSHARABLE_CLASS (MGlxCommandParserCallback)
       
    32     {
       
    33 public:	      
       
    34     
       
    35     /**
       
    36      * Add container.
       
    37      * @param aContainerName New container name.
       
    38      */
       
    39     virtual void AddContainerL(const TDesC& aContainerName) = 0;
       
    40     
       
    41     /**
       
    42      * Add items to container by id.
       
    43      * @param aSourceIds Items to be added.
       
    44      * @param aTargetContainers Containers to add items to.
       
    45      */
       
    46     virtual void AddToContainerL(const RArray<TGlxMediaId>& aSourceIds, const RArray<TGlxMediaId>& aTargetContainers) = 0;
       
    47 
       
    48     /**
       
    49      * Add item to containers by URI.
       
    50      * @param aSourceUri URI of item to add to the container.
       
    51      * @param aTargetContainers Containers to add items to.
       
    52      */      
       
    53     virtual void AddToContainerL(const TDesC& aSourceUri, const RArray<TGlxMediaId>& aTargetContainers) = 0;    
       
    54         
       
    55     /**
       
    56      * Copy files to another drive.
       
    57      * @param aSourceIds Items to be copied.
       
    58      * @param aDrive Drive to copy items to.
       
    59      */
       
    60     virtual void CopyL(const RArray<TGlxMediaId>& aSourceIds, const TDesC& aDrive) = 0;
       
    61     
       
    62     /**
       
    63      * Move files to another drive.
       
    64      * @param aSourceIds Items to be moved.
       
    65      * @param aDrive Drive to move items to.
       
    66      */
       
    67     virtual void MoveL(const RArray<TGlxMediaId>& aSourceIds, const TDesC& aDrive) = 0;
       
    68     
       
    69     /**
       
    70      * Remove items from a container.
       
    71      * @param aItemIds Items to be removed.
       
    72      * @aContainerId Container id.
       
    73      */
       
    74     virtual void RemoveFromContainerL(const RArray<TGlxMediaId>& aItemIds, const TGlxMediaId& aContainerId) = 0;
       
    75     
       
    76     /**
       
    77      * Delete files, Remove container.
       
    78      * @param aItemIds Items to be removed.
       
    79      */
       
    80     virtual void DeleteL(const RArray<TGlxMediaId>& aItemIds) = 0;
       
    81     
       
    82     /**
       
    83      * Rename files, Rename container.
       
    84      * @param aSourceItemId Item or container to be renamed.
       
    85      * @param aTitle New name (Without file extension for files).
       
    86      */
       
    87     virtual void RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle) = 0;
       
    88     
       
    89     /**
       
    90      * Set description.
       
    91      * @param aItemIds Items to apply the new description to.
       
    92      * @param aDescription The new description.
       
    93      */
       
    94     virtual void SetDescriptionL(const RArray<TGlxMediaId>& aItemIds, const TDesC& aDescription) = 0;
       
    95     
       
    96    
       
    97     /**
       
    98      * Set capature location
       
    99      * @param aItemIds Items to apply the capture location to.
       
   100      * @param aCoordinate The capture location.
       
   101      */
       
   102     virtual void SetCaptureLocationL(const RArray<TGlxMediaId>& aItemIds, const TCoordinate& aCoordinate) = 0;
       
   103     
       
   104     /**
       
   105      * Clean up thumbnails.
       
   106      */
       
   107     virtual void ThumbnailCleanupL() = 0;
       
   108     };
       
   109     
       
   110 /**
       
   111  * TGlxCommandParser Parses CMPXCommand objects.
       
   112  * 
       
   113  */
       
   114 NONSHARABLE_CLASS (TGlxCommandParser)
       
   115     {
       
   116 public:
       
   117     /**
       
   118      * Parse a command.
       
   119      * This method will leave with KErrAttribute if aCommand is not valid.
       
   120      * @param aCommandHandler A MGlxCommandParserCallback derived object that will be synchronously called back to handle the command.
       
   121      * @param aCommand Command to be parsed.
       
   122      */
       
   123     IMPORT_C static void ParseL(MGlxCommandParserCallback& aCommandHandler, const CMPXCommand& aCommand);
       
   124     
       
   125     /**
       
   126      * Get the Ids of a command request.
       
   127      * @param aCollectionUid Contains the collection UID on completion of the call.
       
   128      * @param aSessionId Contains the session id on completion of the call.
       
   129      * @param aCommand Command to be parsed.
       
   130      * @return ETrue if the command has a session ID else EFalse.
       
   131      */
       
   132     IMPORT_C static TBool IdsL(TUid& aCollectionUid, TUint32& aSessionId, const CMPXCommand& aCommand);
       
   133     
       
   134 private:
       
   135 /// @todo minor: add method and parameter descriptions  
       
   136 	/**
       
   137 	 * Get an array of TGlxMediaIds from a CMPXCommand object.
       
   138 	 * @param aAttribute required attribute (attribute must be of type CMPXCollectionPath)
       
   139 	 * @param aIdArray on return contains a list of Ids
       
   140 	 * @param aCommand command object that aAttribute will be requested from.
       
   141 	 */
       
   142     static void ArrayValueL(const TMPXAttribute &aAttribute, RArray<TGlxMediaId>& aIdArray, const CMPXCommand& aCommand);
       
   143 /// @todo minor: add method and parameter descriptions    
       
   144     /**
       
   145      * Get an attribute of arbitary type from CMPXCommand object. 
       
   146      * @param aAttribute required attribute.
       
   147 	 * @param aCommand command object that aAttribute will be requested from.
       
   148 	 * This method will leave with KErrArgument if the requested attribute is not found.
       
   149      */
       
   150     template<typename T> static T ValueL(const TMPXAttribute & aAttribute, const CMPXCommand& aCommand);
       
   151 /// @todo minor: add method and parameter descriptions    
       
   152 	/**
       
   153 	 * Get a descriptor from CMPXCommand object. 
       
   154 	 * @param aAttribute required attribute.
       
   155 	 * @param aCommand command object that aAttribute will be requested from.
       
   156 	 * @return Requested attribute.
       
   157 	 * This method will leave with KErrArgument if the requested attribute is not found.
       
   158 	 */
       
   159 	static const TDesC& DescriptorValueL(const TMPXAttribute & aAttribute, const CMPXCommand& aCommand);
       
   160     };
       
   161 
       
   162 #endif // GLXCOMMANDPARSER_H_