LCOV - code coverage report
Current view: top level - xml2cmp/source/support - heap.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 3 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 X2C_HEAP_HXX
      21                 :            : #define X2C_HEAP_HXX
      22                 :            : 
      23                 :            : #include "sistr.hxx"
      24                 :            : 
      25                 :            : class HeapItem;
      26                 :            : 
      27                 :            : class Heap
      28                 :            : {
      29                 :            :   public:
      30                 :            :                         Heap(
      31                 :            :                             unsigned            i_nWidth );
      32                 :            :                         ~Heap();
      33                 :            : 
      34                 :            :     void                InsertValue(
      35                 :            :                             const char *        i_sKey,
      36                 :            :                             const char *        i_sValue );
      37                 :            :     HeapItem *          ReleaseTop();           /// @return must be deleted by caller of method.
      38                 :            : 
      39                 :            :   private:
      40                 :            :     typedef HeapItem * Column;
      41                 :            : 
      42                 :            :     void                IncColumn();
      43                 :        486 :     Column &            ActiveColumn()          { return dpColumnsArray[nActiveColumn]; }
      44                 :            : 
      45                 :            :     Column *            dpColumnsArray;
      46                 :            :     unsigned            nColumnsArraySize;
      47                 :            :     unsigned            nActiveColumn;
      48                 :            : };
      49                 :            : 
      50                 :            : 
      51                 :            : class HeapItem
      52                 :            : {
      53                 :            :   public:
      54                 :            :                         HeapItem(
      55                 :            :                             const char *        i_sKey,
      56                 :            :                             const char *        i_sValue );
      57                 :            :                         ~HeapItem(  );
      58                 :            : 
      59                 :            :     bool                operator<(
      60                 :            :                             const HeapItem &    i_rOther ) const;
      61                 :        644 :     bool                operator<=(
      62                 :            :                             const HeapItem &    i_rOther ) const
      63                 :        644 :                                                 { return ! (i_rOther < *this); }
      64                 :            :     const Simstr &      Key() const;
      65                 :            :     HeapItem *          Next() const;
      66                 :            : 
      67                 :            :     void                SetNext(
      68                 :            :                             HeapItem *          i_pNext );
      69                 :            :   private:
      70                 :            :     Simstr              sValue;
      71                 :            :     Simstr              sKey;
      72                 :            :     HeapItem *          pNext;
      73                 :            : };
      74                 :            : 
      75                 :            : 
      76                 :            : 
      77                 :            : 
      78                 :            : 
      79                 :            : 
      80                 :            : #endif
      81                 :            : 
      82                 :            : 
      83                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10