LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/ext/macromigration - progressmixer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef DBACCESS_PROGRESSMIXER_HXX
      21             : #define DBACCESS_PROGRESSMIXER_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : 
      25             : #include <memory>
      26             : 
      27             : //........................................................................
      28             : namespace dbmm
      29             : {
      30             : //........................................................................
      31             : 
      32             :     typedef sal_uInt32  PhaseID;
      33             :     typedef sal_uInt32  PhaseWeight;
      34             : 
      35             :     //====================================================================
      36             :     //= IProgressConsumer
      37             :     //====================================================================
      38           0 :     class SAL_NO_VTABLE IProgressConsumer
      39             :     {
      40             :     public:
      41             :         virtual void    start( sal_uInt32 _nRange ) = 0;
      42             :         virtual void    advance( sal_uInt32 _nValue ) = 0;
      43             :         virtual void    end() = 0;
      44             : 
      45             :     protected:
      46           0 :         ~IProgressConsumer() {}
      47             :     };
      48             : 
      49             :     //====================================================================
      50             :     //= ProgressMixer
      51             :     //====================================================================
      52             :     struct ProgressMixer_Data;
      53             :     /** a class which mixes (i.e. concatenates) progress values from different
      54             :         sources/phases, with different weight
      55             :     */
      56             :     class ProgressMixer
      57             :     {
      58             :     public:
      59             :         ProgressMixer( IProgressConsumer& _rConsumer );
      60             :         ~ProgressMixer();
      61             : 
      62             :         /** registers a phase of the process, which has the given weight
      63             :             in the overall process
      64             :             @precond
      65             :                 the progress is not runnig, yet
      66             :         */
      67             :         void    registerPhase( const PhaseID _nID, const PhaseWeight _nWeight );
      68             : 
      69             :         /** enters the phase with the given ID, with the phase having
      70             :             the given overall range
      71             :         */
      72             :         void    startPhase( const PhaseID _nID, const sal_uInt32 _nPhaseRange );
      73             : 
      74             :         /** announces a new progress in the current phase.
      75             : 
      76             :             The given phase progress must be between 0 and the overall phase range
      77             :             as specified in ->startPhase.
      78             :         */
      79             :         void    advancePhase( const sal_uInt32 _nPhaseProgress );
      80             : 
      81             :         /** leaves the current phase, which has been started with ->startPhase previously
      82             :         */
      83             :         void    endPhase();
      84             : 
      85             :     private:
      86             :         ::std::auto_ptr< ProgressMixer_Data >   m_pData;
      87             :     };
      88             : 
      89             : //........................................................................
      90             : } // namespace dbmm
      91             : //........................................................................
      92             : 
      93             : #endif // DBACCESS_PROGRESSMIXER_HXX
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10