LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/codemaker - global.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 10 70.0 %
Date: 2012-12-27 Functions: 4 6 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 INCLUDED_CODEMAKER_GLOBAL_HXX
      21             : #define INCLUDED_CODEMAKER_GLOBAL_HXX
      22             : 
      23             : #include <list>
      24             : #include <vector>
      25             : #include <set>
      26             : 
      27             : #include <stdio.h>
      28             : 
      29             : #include "osl/file.hxx"
      30             : #include "rtl/ustring.hxx"
      31             : #include "rtl/strbuf.hxx"
      32             : 
      33             : struct EqualString
      34             : {
      35      339467 :     sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
      36             :     {
      37      339467 :         return (str1 == str2);
      38             :     }
      39             : };
      40             : 
      41             : struct HashString
      42             : {
      43      495083 :     size_t operator()(const ::rtl::OString& str) const
      44             :     {
      45      495083 :         return str.hashCode();
      46             :     }
      47             : };
      48             : 
      49             : struct LessString
      50             : {
      51       80386 :     sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
      52             :     {
      53       80386 :         return (str1 < str2);
      54             :     }
      55             : };
      56             : 
      57             : typedef ::std::list< ::rtl::OString >               StringList;
      58             : typedef ::std::vector< ::rtl::OString >             StringVector;
      59             : typedef ::std::set< ::rtl::OString, LessString >    StringSet;
      60             : 
      61             : //*************************************************************************
      62             : // FileStream
      63             : //*************************************************************************
      64             : enum FileAccessMode
      65             : {
      66             :     FAM_READ,                   // "r"
      67             :     FAM_WRITE,                  // "w"
      68             :     FAM_READWRITE_EXIST,        // "r+"
      69             :     FAM_READWRITE               // "w+"
      70             : };
      71             : 
      72             : class FileStream
      73             : {
      74             : public:
      75             :     FileStream();
      76             :     virtual ~FileStream();
      77             : 
      78             :     sal_Bool isValid();
      79             : 
      80             :     void createTempFile(const ::rtl::OString& sPath);
      81             :     void close();
      82             : 
      83       18126 :     ::rtl::OString  getName() { return m_name; }
      84             : 
      85             :     bool write(void const * buffer, sal_uInt64 size);
      86             : 
      87             :     // friend functions
      88             :     friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
      89             :     friend FileStream &operator<<(FileStream& o, char const * s);
      90             :     friend FileStream &operator<<(FileStream& o, ::rtl::OString* s);
      91             :     friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
      92             :     friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s);
      93             :     friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
      94             : 
      95             : private:
      96             :     oslFileHandle m_file;
      97             :     ::rtl::OString  m_name;
      98             : };
      99             : 
     100             : 
     101             : //*************************************************************************
     102             : // Helper functions
     103             : //*************************************************************************
     104             : ::rtl::OString getTempDir(const ::rtl::OString& sFileName);
     105             : 
     106             : ::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
     107             :                                       const ::rtl::OString type,
     108             :                                       const ::rtl::OString postfix,
     109             :                                       sal_Bool bLowerCase=sal_False,
     110             :                                       const ::rtl::OString prefix="");
     111             : 
     112             : sal_Bool fileExists(const ::rtl::OString& fileName);
     113             : sal_Bool makeValidTypeFile(const ::rtl::OString& targetFileName,
     114             :                            const ::rtl::OString& tmpFileName,
     115             :                            sal_Bool bFileCheck);
     116             : sal_Bool removeTypeFile(const ::rtl::OString& fileName);
     117             : 
     118             : ::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
     119             : 
     120             : //*************************************************************************
     121             : // Global exception to signal problems when a type cannot be dumped
     122             : //*************************************************************************
     123           0 : class CannotDumpException
     124             : {
     125             : public:
     126           0 :     CannotDumpException(const ::rtl::OString& msg)
     127           0 :         : m_message(msg) {}
     128             : 
     129             :     ::rtl::OString  m_message;
     130             : };
     131             : 
     132             : 
     133             : #endif // INCLUDED_CODEMAKER_GLOBAL_HXX
     134             : 
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10