LCOV - code coverage report
Current view: top level - dbaccess/source/ext/macromigration - progressmixer.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 2 0.0 %
Date: 2014-11-03 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 INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : 
      25             : #include <memory>
      26             : 
      27             : namespace dbmm
      28             : {
      29             : 
      30             :     typedef sal_uInt32  PhaseID;
      31             :     typedef sal_uInt32  PhaseWeight;
      32             : 
      33             :     // IProgressConsumer
      34           0 :     class SAL_NO_VTABLE IProgressConsumer
      35             :     {
      36             :     public:
      37             :         virtual void    start( sal_uInt32 _nRange ) = 0;
      38             :         virtual void    advance( sal_uInt32 _nValue ) = 0;
      39             :         virtual void    end() = 0;
      40             : 
      41             :     protected:
      42           0 :         ~IProgressConsumer() {}
      43             :     };
      44             : 
      45             :     // ProgressMixer
      46             :     struct ProgressMixer_Data;
      47             :     /** a class which mixes (i.e. concatenates) progress values from different
      48             :         sources/phases, with different weight
      49             :     */
      50             :     class ProgressMixer
      51             :     {
      52             :     public:
      53             :         ProgressMixer( IProgressConsumer& _rConsumer );
      54             :         ~ProgressMixer();
      55             : 
      56             :         /** registers a phase of the process, which has the given weight
      57             :             in the overall process
      58             :             @precond
      59             :                 the progress is not runnig, yet
      60             :         */
      61             :         void    registerPhase( const PhaseID _nID, const PhaseWeight _nWeight );
      62             : 
      63             :         /** enters the phase with the given ID, with the phase having
      64             :             the given overall range
      65             :         */
      66             :         void    startPhase( const PhaseID _nID, const sal_uInt32 _nPhaseRange );
      67             : 
      68             :         /** announces a new progress in the current phase.
      69             : 
      70             :             The given phase progress must be between 0 and the overall phase range
      71             :             as specified in ->startPhase.
      72             :         */
      73             :         void    advancePhase( const sal_uInt32 _nPhaseProgress );
      74             : 
      75             :         /** leaves the current phase, which has been started with ->startPhase previously
      76             :         */
      77             :         void    endPhase();
      78             : 
      79             :     private:
      80             :         ::std::unique_ptr< ProgressMixer_Data >   m_pData;
      81             :     };
      82             : 
      83             : } // namespace dbmm
      84             : 
      85             : #endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_PROGRESSMIXER_HXX
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10