LCOV - code coverage report
Current view: top level - libreoffice/cosv/source/storage - persist.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 11 100.0 %
Date: 2012-12-27 Functions: 4 4 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/persist.hxx>
      29             : 
      30             : // NOT FULLY DECLARED SERVICES
      31             : #include <cosv/ploc.hxx>
      32             : 
      33             : 
      34             : #ifdef WNT
      35             : #include <io.h>
      36             : 
      37             : namespace csv
      38             : {
      39             : namespace ploc
      40             : {
      41             : 
      42             : bool
      43             : Persistent::Exists() const
      44             : {
      45             :     return access( StrPath(), 00) == 0;
      46             : }
      47             : 
      48             : } // namespace ploc
      49             : } // namespace csv
      50             : 
      51             : 
      52             : #elif defined(UNX)
      53             : #include <unistd.h>
      54             : 
      55             : namespace csv
      56             : {
      57             : namespace ploc
      58             : {
      59             : 
      60             : bool
      61         240 : Persistent::Exists() const
      62             : {
      63         240 :     return access( StrPath(), F_OK ) == 0;
      64             : }
      65             : 
      66             : 
      67             : } // namespace ploc
      68             : } // namespace csv
      69             : 
      70             : #else
      71             : #error  For using csv::ploc there has to be defined: WNT or UNX.
      72             : #endif
      73             : 
      74             : namespace csv
      75             : {
      76             : namespace ploc
      77             : {
      78             : 
      79             : const char *
      80       12568 : Persistent::StrPath() const
      81             : {
      82       12568 :     if (sPath.empty() )
      83             :     {
      84             : #ifndef CSV_NO_MUTABLE
      85       12211 :         StreamStr & rsPath = sPath;
      86             : #else
      87             :         StreamStr & rsPath = const_cast< StreamStr& >(sPath);
      88             : #endif
      89       12211 :         rsPath.seekp(0);
      90       12211 :         rsPath << MyPath();
      91       12211 :         if (MyPath().IsDirectory())
      92         240 :             rsPath.pop_back(1);    // Remove closing delimiter.
      93             :     }
      94       12568 :     return sPath.c_str();
      95             : }
      96             : 
      97             : } // namespace ploc
      98           3 : } // namespace csv
      99             : 
     100             : 
     101             : 
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10