LTP GCOV extension - code coverage report
Current view: | directory - ept/textsearch/maint - path.h
Test: | lcov.info
Date: | 2008-08-14 |  | Instrumented lines: | 5
Code covered: | 100.0 % |  | Executed lines: | 5

           1                 : // -*- mode: c++; indent-tabs-mode: t -*-
           2                 : /** \file
           3                 :  * popcon paths
           4                 :  */
           5                 :
           6                 : /*
           7                 :  * Copyright (C) 2005,2006,2007  Enrico Zini <enrico@debian.org>
           8                 :  *
           9                 :  * This program is free software; you can redistribute it and/or modify
          10                 :  * it under the terms of the GNU General Public License as published by
          11                 :  * the Free Software Foundation; either version 2 of the License, or
          12                 :  * (at your option) any later version.
          13                 :  *
          14                 :  * This program is distributed in the hope that it will be useful,
          15                 :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
          16                 :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          17                 :  * GNU General Public License for more details.
          18                 :  *
          19                 :  * You should have received a copy of the GNU General Public License
          20                 :  * along with this program; if not, write to the Free Software
          21                 :  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
          22                 :  */
          23                 :
          24                 : #ifndef EPT_TEXTSEARCH_PATH_H
          25                 : #define EPT_TEXTSEARCH_PATH_H
          26                 :
          27                 : #include <string>
          28                 :
          29                 : struct stat;
          30                 :
          31                 : namespace ept {
          32                 : namespace textsearch {
          33                 :
          34                 : /**
          35                 :  * Singleton class to configure and access the various Popcon paths
          36                 :  */
          37                 : class Path
          38               1 : {
          39                 : public:
          40                 :         static std::string indexDir();
          41                 :         static std::string index();
          42                 :
          43                 :         // Directory where Popcon source data is found
          44                 :         static void setIndexDir( const std::string &s );
          45                 :
          46                 :         static int access( const std::string &, int );
          47                 :         static time_t indexTimestamp();
          48                 :         static void setTimestamp(time_t ts);
          49                 :
          50                 :         // RAII-style classes to temporarily override directories
          51                 :         class OverrideIndexDir
          52                 :         {
          53                 :                 std::string old;
          54                 :         public:
          55              11 :                 OverrideIndexDir(const std::string& path) : old(Path::indexDir())
          56                 :                 {
          57              11 :                         Path::setIndexDir(path);
          58              11 :                 }
          59              11 :                 ~OverrideIndexDir() { Path::setIndexDir(old); }
          60                 :         };
          61                 :
          62                 : protected:
          63                 :         static Path *s_instance;
          64                 :         static Path &instance();
          65                 :
          66                 :         // Directory where Popcon source data is found
          67                 :         std::string m_indexDir;
          68                 : };
          69                 :
          70                 : }
          71                 : }
          72                 :
          73                 : // vim:set ts=4 sw=4:
          74                 : #endif

Generated by: LTP GCOV extension version 1.6