LCOV - code coverage report
Current view: top level - libreoffice/cosv/source/storage - dirchain.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 34 36 94.4 %
Date: 2012-12-27 Functions: 9 9 100.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             : #define CSV_USE_CSV_ASSERTIONS
      21             : #include <cosv/csv_env.hxx>
      22             : 
      23             : #include <cosv/comfunc.hxx>
      24             : #include <cosv/string.hxx>
      25             : #include <cosv/streamstr.hxx>
      26             : #include <cosv/std_outp.hxx>
      27             : #include <cosv/tpl/dyn.hxx>
      28             : #include <cosv/dirchain.hxx>
      29             : 
      30             : // NOT FULLY DECLARED SERVICES
      31             : #include <cosv/bstream.hxx>
      32             : 
      33             : 
      34             : 
      35             : 
      36             : namespace csv
      37             : {
      38             : namespace ploc
      39             : {
      40             : 
      41             : 
      42       19925 : DirectoryChain::DirectoryChain()
      43             : {
      44       19925 : }
      45             : 
      46       20047 : DirectoryChain::~DirectoryChain()
      47             : {
      48       20047 : }
      49             : 
      50             : void
      51       19925 : DirectoryChain::Set( const char *        i_sSubPath,
      52             :                      bool                i_bPathIsAlwaysDir,
      53             :                      const char *        i_sDelimiter        )
      54             : {
      55       19925 :     csv_assert(i_sDelimiter != 0);
      56       19925 :     if (i_sSubPath == 0)
      57       19925 :         return;
      58             : 
      59       19925 :     const char * pRestPath = i_sSubPath;
      60       19925 :     if (*pRestPath == *i_sDelimiter)
      61           0 :         ++pRestPath;
      62             : 
      63      253741 :     for ( const char * pDirEnd = strchr(pRestPath,*i_sDelimiter);
      64             :           pDirEnd != 0;
      65      233816 :           pDirEnd = strchr(pRestPath,*i_sDelimiter) )
      66             :     {
      67      233816 :         aPath.push_back( String(pRestPath, pDirEnd) );
      68      233816 :         pRestPath = pDirEnd + 1;
      69             :     }
      70       19925 :     if (*pRestPath != 0 AND i_bPathIsAlwaysDir)
      71         120 :         aPath.push_back( String(pRestPath) );
      72             : }
      73             : 
      74             : void
      75         119 : DirectoryChain::PushBack( const String & i_sName )
      76             : {
      77         119 :     aPath.push_back(i_sName);
      78         119 : }
      79             : 
      80             : void
      81         125 : DirectoryChain::PushBack( const DirectoryChain & i_sPath )
      82             : {
      83         125 :     aPath.insert( aPath.end(), i_sPath.Begin(), i_sPath.End() );
      84         125 : }
      85             : 
      86             : void
      87         118 : DirectoryChain::PopBack( uintt i_nCount )
      88             : {
      89         118 :     if (i_nCount <= aPath.size())
      90         118 :         aPath.erase( aPath.end() - i_nCount, aPath.end() );
      91             :     else
      92           0 :         aPath.erase( aPath.begin(), aPath.end() );
      93         118 : }
      94             : 
      95             : void
      96       28113 : DirectoryChain::Get( bostream &      o_rPath,
      97             :                      const char *    i_sDelimiter ) const
      98             : {
      99       28113 :     uintt deliLen = strlen(i_sDelimiter);
     100             : 
     101     1083885 :     for ( std::vector<String>::const_iterator it = aPath.begin();
     102      722590 :           it != aPath.end();
     103             :           ++it )
     104             :     {
     105      333182 :         o_rPath.write( (*it).c_str() );
     106      333182 :         o_rPath.write( i_sDelimiter,  deliLen);
     107             :     }
     108       28113 : }
     109             : 
     110             : 
     111             : 
     112             : 
     113             : } // namespace ploc
     114           3 : } // namespace csv
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10