csxhelp/HelpEngine/inc/CSXHHelpContentBase.h
branchRCL_3
changeset 45 cbffe13eac63
equal deleted inserted replaced
44:12f60d9a73b3 45:cbffe13eac63
       
     1 /*
       
     2 * Copyright (c) 2006 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:  CCSXHHelpContentBase class declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef INC_CSXHHELPCONTENTBASE_H_HEADER_INCLUDED_BC0553D0
       
    20 #define INC_CSXHHELPCONTENTBASE_H_HEADER_INCLUDED_BC0553D0
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 const TInt KMaxHelpTopicName = 30;
       
    26 /** 
       
    27 * @class CCSXHGenericTOC1
       
    28 * This class is the base class for GenericTOC1 & GenericTOC2
       
    29 */
       
    30 class CCSXHHelpContentBase : public CBase
       
    31     {
       
    32   public:
       
    33   /** 
       
    34  * @function ~CCSXHHelpContentBase
       
    35  * @since S60 3.2
       
    36  * Destroy the object and release all memory objects
       
    37  */ 
       
    38     virtual ~CCSXHHelpContentBase();
       
    39 
       
    40 /** 
       
    41 *  @function GetViewID
       
    42 *  @since S60 3.2
       
    43 *  Get ViewId to activate the View
       
    44 *  @return View Id
       
    45 */    
       
    46     IMPORT_C virtual TUid GetViewID() const = 0;
       
    47 
       
    48 /** 
       
    49 *  @function GetName
       
    50 *  @since S60 3.2
       
    51 *  Get the name
       
    52 *  @return Pointer which contains Name
       
    53 */
       
    54     IMPORT_C TPtr GetName() const;
       
    55     
       
    56     TInt32 Priority() const;
       
    57 
       
    58   protected:
       
    59 /** 
       
    60 *  @function CCSXHHelpContentBase
       
    61 *  @since S60 3.2
       
    62 *  Construct a CCSXHHelpContentBase 
       
    63 *  @param aName 	- Name
       
    64 */  
       
    65     CCSXHHelpContentBase(const TDesC& name, const TInt32 aPriority = 0);
       
    66 
       
    67   private:
       
    68     // 1. For Generic TOC1: The TOC1 entry name
       
    69     // 2. For Generic TOC2: The TOC2 entry name
       
    70     // 3. For help database: Unused
       
    71     //TBuf<KMaxHelpTopicName> iName;
       
    72     //typedef TBuf<30> TCoeContextName;
       
    73     
       
    74     HBufC *iName;
       
    75     TInt32 iPriority;
       
    76     
       
    77     template <class T>
       
    78     friend TInt Orderer(const T& left, const T& right);
       
    79 
       
    80     template <class T>
       
    81 	friend TInt OrdererWithPriority(const T& left, const T& right);
       
    82     };
       
    83 /** 
       
    84 *  @function Orderer
       
    85 *  @since S60 3.2
       
    86 *  template function used to compare between two objects
       
    87 *  @param left 	- template object
       
    88 *		  right	- template object
       
    89 *  @return 0 if both are same, +ve or -ve Values as per Comparision
       
    90 */ 	
       
    91 template <class T>
       
    92 TInt Orderer(const T& left, const T& right) 
       
    93     {
       
    94     //return left.GetName().CompareC(right.GetName());
       
    95     return (left.iName)->CompareF(*right.iName);
       
    96 	}
       
    97 
       
    98 template <class T>
       
    99 TInt OrdererWithPriority(const T& left, const T& right) 
       
   100     {
       
   101     if (left.iPriority < right.iPriority)
       
   102     	{
       
   103     	return -1;
       
   104     	}
       
   105     else if (left.iPriority == right.iPriority)
       
   106     	{
       
   107         return (left.iName)->CompareF(*right.iName);
       
   108     	}
       
   109     else
       
   110     	{
       
   111     	return 1;
       
   112     	}
       
   113 	}
       
   114 
       
   115     
       
   116 #endif /* INC_CSXHHELPCONTENTBASE_H_HEADER_INCLUDED_BC0553D0 */