LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/cosv - dirchain.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 18 66.7 %
Date: 2012-12-27 Functions: 6 9 66.7 %
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 CSV_DIRCHAIN_HXX
      21             : #define CSV_DIRCHAIN_HXX
      22             : 
      23             : 
      24             : // USED SERVICES
      25             :     // BASE CLASSES
      26             :     // COMPONENTS
      27             : #include <cosv/string.hxx>
      28             :     // PARAMETERS
      29             : #include <cosv/csv_ostream.hxx>
      30             : 
      31             : #include <cosv/persist.hxx>
      32             : #include <cosv/tpl/tpltools.hxx>
      33             : 
      34             : 
      35             : 
      36             : namespace csv
      37             : {
      38             :     class bostream;
      39             : 
      40             : namespace ploc
      41             : {
      42             : 
      43             : 
      44             : class DirectoryChain
      45             : {
      46             :   public:
      47             :                         DirectoryChain();
      48             :                         DirectoryChain(
      49             :                             const DirectoryChain &
      50             :                                                 i_rDC );
      51             :                         ~DirectoryChain();
      52             : 
      53             :     // OPERATORS
      54             :     DirectoryChain &    operator=(
      55             :                             const DirectoryChain &
      56             :                                                 i_rDC );
      57             :     DirectoryChain &    operator+=(
      58             :                             const String &      i_sName );
      59             :     DirectoryChain &    operator+=(
      60             :                             const DirectoryChain &
      61             :                                                 i_rDC );
      62             :     DirectoryChain &    operator-=(
      63             :                             uintt               i_nLevelsUp );
      64             : 
      65             :     // OPERATIONS
      66             :     void                Set(
      67             :                             const char *        i_sPath,
      68             :                             bool                i_bPathIsAlwaysDir = false,
      69             :                             const char *        i_sDelimiter = Delimiter() );
      70             :     void                PushBack(
      71             :                             const String &      i_sName );
      72             :     void                PushBack(
      73             :                             const DirectoryChain &
      74             :                                                 i_sPath );
      75             :     void                PopBack(
      76             :                             uintt               i_nCount = 1 );
      77             : 
      78             :     // INQUIRY
      79             :     uintt               Size() const;
      80             : 
      81             :     StringVector::const_iterator
      82             :                         Begin() const;
      83             :     StringVector::const_iterator
      84             :                         End() const;
      85             : 
      86             :     const String &      Front() const;
      87             :     const String &      Back() const;
      88             : 
      89             :     void                Get(
      90             :                             bostream &          o_rPath,
      91             :                             const char *        i_sDelimiter ) const;
      92             :   private:
      93             :     StringVector        aPath;
      94             : };
      95             : 
      96             : 
      97             : // IMPLEMENTATION
      98             : inline
      99         122 : DirectoryChain::DirectoryChain( const DirectoryChain & i_rDC )
     100         122 :     { PushBack(i_rDC); }
     101             : 
     102             :     // OPERATORS
     103             : inline DirectoryChain &
     104           3 : DirectoryChain::operator=( const DirectoryChain & i_rDC )
     105           3 :     { csv::erase_container(aPath); PushBack(i_rDC); return *this; }
     106             : inline DirectoryChain &
     107         119 : DirectoryChain::operator+=( const String & i_sName )
     108         119 :     { PushBack(i_sName); return *this;  }
     109             : inline DirectoryChain &
     110           0 : DirectoryChain::operator+=( const DirectoryChain & i_rDC )
     111           0 :     { PushBack(i_rDC); return *this;  }
     112             : inline DirectoryChain &
     113         118 : DirectoryChain::operator-=( uintt i_nLevelsUp )
     114         118 :     { PopBack(i_nLevelsUp); return *this;  }
     115             : inline uintt
     116           0 : DirectoryChain::Size() const
     117           0 :     { return aPath.size(); }
     118             : 
     119             : inline StringVector::const_iterator
     120         125 : DirectoryChain::Begin() const
     121         125 :     { return aPath.begin(); }
     122             : inline StringVector::const_iterator
     123         125 : DirectoryChain::End() const
     124         125 :     { return aPath.end(); }
     125             : inline const String &
     126             : DirectoryChain::Front() const
     127             :     { return aPath.empty() ? String::Null_() : aPath.front(); }
     128             : inline const String &
     129           0 : DirectoryChain::Back() const
     130           0 :     { return aPath.empty() ? String::Null_() : aPath.back(); }
     131             : 
     132             : 
     133             : }   // namespace ploc
     134             : }   // namespace csv
     135             : 
     136             : inline csv::bostream &
     137             : operator<<( csv::bostream &                     o_rOut,
     138             :             const csv::ploc::DirectoryChain &   i_rSubPath )
     139             : {
     140             :      i_rSubPath.Get(o_rOut, csv::ploc::Delimiter());
     141             :     return o_rOut;
     142             : }
     143             : 
     144             : #endif
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10