logsui/logsengine/logssymbianos/inc/logsreaderstates.h
changeset 14 f27aebe284bb
parent 0 4a5361db8937
child 15 76d2cf7a585e
equal deleted inserted replaced
11:64a47b97e1e1 14:f27aebe284bb
    17 
    17 
    18 #ifndef LOGSREADERSTATES_H
    18 #ifndef LOGSREADERSTATES_H
    19 #define LOGSREADERSTATES_H
    19 #define LOGSREADERSTATES_H
    20 
    20 
    21 //  INCLUDES
    21 //  INCLUDES
       
    22 #include "logsstatebase.h"
    22 #include <e32std.h>
    23 #include <e32std.h>
    23 #include <logclientchangeobserver.h>
    24 #include <logclientchangeobserver.h>
    24 #include <logviewchangeobserver.h>
    25 #include <logviewchangeobserver.h>
    25 
    26 
    26 // FORWARD DECLARATION
    27 // FORWARD DECLARATION
    34 // CLASS DECLARATION
    35 // CLASS DECLARATION
    35 
    36 
    36 /**
    37 /**
    37  * Reader state base
    38  * Reader state base
    38  */
    39  */
    39 class LogsReaderStateBase {
    40 class LogsReaderStateBase : public LogsStateBase {
    40 
    41 
    41     friend class UT_LogsReaderStates;
    42     friend class UT_LogsReaderStates;
    42     friend class UT_LogsReader;
    43     friend class UT_LogsReader;
    43     
    44     
    44     public:
    45     public:
    45         
    46         
    46         /**
    47         /**
    47          * Destructor
    48          * Destructor
    48          */
    49          */
    49         virtual ~LogsReaderStateBase();
    50         virtual ~LogsReaderStateBase();
    50         
       
    51         /**
       
    52          * Set next state to be used once this state has completed.
       
    53          * @param nextState
       
    54          */
       
    55         void setNextState(LogsReaderStateBase& nextState);
       
    56 
       
    57         /**
       
    58          * Enter to the state, may proceed immediately to next state.
       
    59          * @return true if entering started async operation,  false if not
       
    60          */
       
    61         virtual bool enterL();
       
    62         
       
    63         /**
       
    64          * Continue running in the state, may proceed to next state
       
    65          * @return true if continue started async operation,  false if not
       
    66          */
       
    67         virtual bool continueL();
       
    68     
    51     
    69     protected:
    52     protected:
    70         
    53         
    71         /**
    54         /**
    72          * Constructor
    55          * Constructor
    73          */
    56          */
    74         LogsReaderStateBase(LogsReaderStateContext& context);
    57         LogsReaderStateBase(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
    75         
       
    76         /**
       
    77          * Proceed to next state if such exists.
       
    78          * @return true if entering started async operation,  false if not 
       
    79          */
       
    80         virtual bool enterNextStateL();
       
    81         
       
    82         /**
       
    83          * Get number of events in view
       
    84          * @return view count
       
    85          */
       
    86         int viewCountL() const;
       
    87         
       
    88         /**
       
    89          * Get current event
       
    90          * @return event
       
    91          */
       
    92         CLogEvent& event() const;
       
    93         
    58         
    94         /**
    59         /**
    95          * Fill dest event with source event data and insert to specified
    60          * Fill dest event with source event data and insert to specified
    96          * place in events list.
    61          * place in events list.
    97          * @param source event 
    62          * @param source event 
   131          * Finds specified event from the event list. Event not removed from the list.
    96          * Finds specified event from the event list. Event not removed from the list.
   132          * @param eventId, id of the event to be found
    97          * @param eventId, id of the event to be found
   133          * @return pointer to event or 0 if not found
    98          * @return pointer to event or 0 if not found
   134          */
    99          */
   135         LogsEvent* eventById(int eventId);
   100         LogsEvent* eventById(int eventId);
   136         
       
   137         /**
       
   138          * Try to search duplicates for current event in the view
       
   139          * @param aFilter, filter to be used for searching duplicates
       
   140          * @return true, if duplicates are searched
       
   141          */
       
   142         bool duplicatesL(const CLogFilter* aFilter = 0);
       
   143 
   101 
   144     protected:   
   102     protected:   
   145         LogsReaderStateContext& mContext;
   103         LogsReaderStateContext& mContext;
   146         LogsReaderStateBase* mNextState;
       
   147         int mStateIndex;
       
   148 };
   104 };
   149 
   105 
   150 /**
   106 /**
   151  * Initialize reading state
   107  * Initialize reading state
   152  */
   108  */
   153 class LogsReaderStateInitReading : public LogsReaderStateBase {
   109 class LogsReaderStateInitReading : public LogsReaderStateBase {
   154 
   110 
   155      friend class UT_LogsReaderStates;
   111      friend class UT_LogsReaderStates;
   156      
   112      
   157     public:
   113     public:
   158      LogsReaderStateInitReading(LogsReaderStateContext& context);
   114      LogsReaderStateInitReading(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   159         virtual ~LogsReaderStateInitReading(){}
   115         virtual ~LogsReaderStateInitReading(){}
   160 
   116 
   161     public: // From LogsReaderStateBase
   117     public: // From LogsReaderStateBase
   162         virtual bool enterL();
   118         virtual bool enterL();
   163  };
   119  };
   168 class LogsReaderStateFiltering : public LogsReaderStateBase {
   124 class LogsReaderStateFiltering : public LogsReaderStateBase {
   169 
   125 
   170      friend class UT_LogsReaderStates;
   126      friend class UT_LogsReaderStates;
   171      
   127      
   172     public:
   128     public:
   173         LogsReaderStateFiltering(LogsReaderStateContext& context);
   129         LogsReaderStateFiltering(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   174         virtual ~LogsReaderStateFiltering();
   130         virtual ~LogsReaderStateFiltering();
   175 
   131 
   176     public: // From LogsReaderStateBase
   132     public: // From LogsReaderStateBase
   177         virtual bool enterL();
   133         virtual bool enterL();
   178         virtual bool continueL();
   134         virtual bool continueL();
   194 class LogsReaderStateFilteringAll : public LogsReaderStateFiltering {
   150 class LogsReaderStateFilteringAll : public LogsReaderStateFiltering {
   195 
   151 
   196      friend class UT_LogsReaderStates;
   152      friend class UT_LogsReaderStates;
   197      
   153      
   198     public:
   154     public:
   199         LogsReaderStateFilteringAll(LogsReaderStateContext& context);
   155         LogsReaderStateFilteringAll(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   200         virtual ~LogsReaderStateFilteringAll();
   156         virtual ~LogsReaderStateFilteringAll();
   201 
   157 
   202     protected: // From LogsReaderStateFiltering
   158     protected: // From LogsReaderStateFiltering
   203         virtual bool setFilterL(CLogFilterList& filterList);
   159         virtual bool setFilterL(CLogFilterList& filterList);
   204  };
   160  };
   209 class LogsReaderStateReading : public LogsReaderStateBase {
   165 class LogsReaderStateReading : public LogsReaderStateBase {
   210 
   166 
   211     friend class UT_LogsReaderStates;
   167     friend class UT_LogsReaderStates;
   212     
   168     
   213     public:
   169     public:
   214         LogsReaderStateReading(LogsReaderStateContext& context);
   170         LogsReaderStateReading(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   215         virtual ~LogsReaderStateReading();
   171         virtual ~LogsReaderStateReading();
   216 
   172 
   217     public: // From LogsReaderStateBase
   173     public: // From LogsReaderStateBase
   218         virtual bool enterL();
   174         virtual bool enterL();
   219         virtual bool continueL();
   175         virtual bool continueL();
   233 /**
   189 /**
   234  * Fill missing information state
   190  * Fill missing information state
   235  */
   191  */
   236 class LogsReaderStateFillDetails : public LogsReaderStateBase {
   192 class LogsReaderStateFillDetails : public LogsReaderStateBase {
   237     public:
   193     public:
   238         LogsReaderStateFillDetails(LogsReaderStateContext& context);
   194         LogsReaderStateFillDetails(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   239         virtual ~LogsReaderStateFillDetails();
   195         virtual ~LogsReaderStateFillDetails();
   240         
   196         
   241         /**
   197         /**
   242          * Synchronously fills details from phonebook
   198          * Synchronously fills details from phonebook
   243          */
   199          */
   250 /**
   206 /**
   251  * Completed state
   207  * Completed state
   252  */
   208  */
   253 class LogsReaderStateDone : public LogsReaderStateBase {
   209 class LogsReaderStateDone : public LogsReaderStateBase {
   254     public:
   210     public:
   255         LogsReaderStateDone(LogsReaderStateContext& context);
   211         LogsReaderStateDone(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   256         virtual ~LogsReaderStateDone();
   212         virtual ~LogsReaderStateDone();
   257         
   213         
   258     public: // From LogsReaderStateBase
   214     public: // From LogsReaderStateBase
   259         virtual bool enterL();
   215         virtual bool enterL();
   260 };
   216 };
   261 
   217 
   262 
       
   263 /**
       
   264  * Searching event state
       
   265  */
       
   266 class LogsReaderStateSearchingEvent : public LogsReaderStateBase 
       
   267 {
       
   268     friend class UT_LogsReaderStates;
       
   269     
       
   270     public:
       
   271         LogsReaderStateSearchingEvent(LogsReaderStateContext& context);
       
   272         virtual ~LogsReaderStateSearchingEvent(){}
       
   273 
       
   274     public: // From LogsReaderStateBase
       
   275         virtual bool enterL();
       
   276         virtual bool continueL();
       
   277 };
       
   278 
       
   279 /**
   218 /**
   280  * Finding duplicate events state
   219  * Finding duplicate events state
   281  */
   220  */
   282 class LogsReaderStateFindingDuplicates : public LogsReaderStateBase 
   221 class LogsReaderStateFindingDuplicates : public LogsReaderStateBase 
   283 {
   222 {
   284     friend class UT_LogsReaderStates;
   223     friend class UT_LogsReaderStates;
   285     
   224     
   286     public:
   225     public:
   287         LogsReaderStateFindingDuplicates(LogsReaderStateContext& context);
   226         LogsReaderStateFindingDuplicates(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   288         virtual ~LogsReaderStateFindingDuplicates();
   227         virtual ~LogsReaderStateFindingDuplicates();
   289 
   228 
   290     public: // From LogsReaderStateBase
   229     public: // From LogsReaderStateBase
   291         virtual bool enterL();  
   230         virtual bool enterL();  
   292         virtual bool continueL();
   231         virtual bool continueL();
   301 class LogsReaderStateMarkingDuplicates : public LogsReaderStateBase 
   240 class LogsReaderStateMarkingDuplicates : public LogsReaderStateBase 
   302 {
   241 {
   303     friend class UT_LogsReaderStates;
   242     friend class UT_LogsReaderStates;
   304     
   243     
   305     public:
   244     public:
   306         LogsReaderStateMarkingDuplicates(LogsReaderStateContext& context);
   245         LogsReaderStateMarkingDuplicates(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   307         virtual ~LogsReaderStateMarkingDuplicates(){}
   246         virtual ~LogsReaderStateMarkingDuplicates(){}
   308 
   247 
   309     public: // From LogsReaderStateBase
   248     public: // From LogsReaderStateBase
   310         virtual bool enterL();
   249         virtual bool enterL();
   311         virtual bool continueL(); 
   250         virtual bool continueL(); 
   320 class LogsReaderStateReadingDuplicates : public LogsReaderStateBase 
   259 class LogsReaderStateReadingDuplicates : public LogsReaderStateBase 
   321 {
   260 {
   322     friend class UT_LogsReaderStates;
   261     friend class UT_LogsReaderStates;
   323     
   262     
   324     public:
   263     public:
   325         LogsReaderStateReadingDuplicates(LogsReaderStateContext& context);
   264         LogsReaderStateReadingDuplicates(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   326         virtual ~LogsReaderStateReadingDuplicates(){}
   265         virtual ~LogsReaderStateReadingDuplicates(){}
   327 
   266 
   328     public: // From LogsReaderStateBase
   267     public: // From LogsReaderStateBase
   329         virtual bool enterL();   
   268         virtual bool enterL();   
   330         virtual bool continueL();
   269         virtual bool continueL();
   336 class LogsReaderStateModifyingDone : public LogsReaderStateBase 
   275 class LogsReaderStateModifyingDone : public LogsReaderStateBase 
   337 {
   276 {
   338     friend class UT_LogsReaderStates;
   277     friend class UT_LogsReaderStates;
   339     
   278     
   340     public:
   279     public:
   341         LogsReaderStateModifyingDone(LogsReaderStateContext& context);
   280         LogsReaderStateModifyingDone(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   342         virtual ~LogsReaderStateModifyingDone(){}
   281         virtual ~LogsReaderStateModifyingDone(){}
   343 
   282 
   344     public: // From LogsReaderStateBase
   283     public: // From LogsReaderStateBase
   345         virtual bool enterL();
   284         virtual bool enterL();
   346 };
   285 };
   351 class LogsReaderStateReadingDuplicatesDone : public LogsReaderStateBase 
   290 class LogsReaderStateReadingDuplicatesDone : public LogsReaderStateBase 
   352 {
   291 {
   353     friend class UT_LogsReaderStates;
   292     friend class UT_LogsReaderStates;
   354     
   293     
   355     public:
   294     public:
   356         LogsReaderStateReadingDuplicatesDone(LogsReaderStateContext& context);
   295         LogsReaderStateReadingDuplicatesDone(LogsStateBaseContext& context, LogsReaderStateContext& readerContext);
   357         virtual ~LogsReaderStateReadingDuplicatesDone(){}
   296         virtual ~LogsReaderStateReadingDuplicatesDone(){}
   358 
   297 
   359     public: // From LogsReaderStateBase
   298     public: // From LogsReaderStateBase
   360         virtual bool enterL();
   299         virtual bool enterL();
   361 };
   300 };