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