LCOV - code coverage report
Current view: top level - desktop/source/deployment/inc - db.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 8 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef BERKELEYDBPROXY_DB_HXX_
      29                 :            : #define BERKELEYDBPROXY_DB_HXX_
      30                 :            : 
      31                 :            : #include <boost/noncopyable.hpp>
      32                 :            : 
      33                 :            : #ifdef SYSTEM_DB_HEADER
      34                 :            : #include SYSTEM_DB_HEADER
      35                 :            : #else
      36                 :            : #include <berkeleydb/db.h>
      37                 :            : #endif
      38                 :            : 
      39                 :            : #include <rtl/string.hxx>
      40                 :            : #include "dp_misc_api.hxx"
      41                 :            : 
      42                 :            : extern "C" {
      43                 :            :   typedef void *(*db_malloc_fcn_type)(size_t);
      44                 :            :   typedef void *(*db_realloc_fcn_type)(void *, size_t);
      45                 :            :   typedef void (*db_free_fcn_type)(void *);
      46                 :            : }
      47                 :            : 
      48                 :            : namespace berkeleydbproxy {
      49                 :            : 
      50                 :            :     class Dbc;
      51                 :            :     class Dbt;
      52                 :            : 
      53                 :          0 :     class DESKTOP_DEPLOYMENTMISC_DLLPUBLIC DbException
      54                 :            :     {
      55                 :            :         rtl::OString what_;
      56                 :            :     public:
      57                 :          0 :         explicit DbException(rtl::OString const & theWhat)
      58                 :          0 :         : what_(theWhat)
      59                 :          0 :         {}
      60                 :            : 
      61                 :          0 :         const char *what() const
      62                 :          0 :         { return what_.getStr(); }
      63                 :          0 :         int get_errno() const
      64                 :          0 :         { return 0; }
      65                 :            :     };
      66                 :            : 
      67                 :            : 
      68                 :            :     class DESKTOP_DEPLOYMENTMISC_DLLPUBLIC DbEnv : boost::noncopyable
      69                 :            :     {
      70                 :            :     public:
      71                 :            :         static char *strerror(int);
      72                 :            :     };
      73                 :            : 
      74                 :            :     class DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Db : boost::noncopyable
      75                 :            :     {
      76                 :            :     private:
      77                 :            :         DB* m_pDBP;
      78                 :            : 
      79                 :            :     public:
      80                 :            :         Db(u_int32_t flags);
      81                 :            :         ~Db();
      82                 :            : 
      83                 :            :         int close(u_int32_t flags);
      84                 :            : 
      85                 :            :         int open(DB_TXN *txnid,
      86                 :            :                  const char *file,
      87                 :            :                  const char *database,
      88                 :            :                  DBTYPE type,
      89                 :            :                  u_int32_t flags,
      90                 :            :                  int mode);
      91                 :            : 
      92                 :            :         int sync(u_int32_t flags);
      93                 :            :         int del(Dbt *key, u_int32_t flags);
      94                 :            : 
      95                 :            :         int get(DB_TXN* txnid, Dbt *key, Dbt *data, u_int32_t flags);
      96                 :            :         int put(DB_TXN* txnid, Dbt *key, Dbt *data, u_int32_t flags);
      97                 :            : 
      98                 :            :         int cursor(DB_TXN *txnid, Dbc **cursorp, u_int32_t flags);
      99                 :            :     };
     100                 :            : 
     101                 :            :     class DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Dbc : boost::noncopyable
     102                 :            :     {
     103                 :            :         friend class Db;
     104                 :            :         friend class Dbt;
     105                 :            : 
     106                 :            :     private:
     107                 :            :         DBC* m_pDBC;
     108                 :            : 
     109                 :            :         SAL_DLLPRIVATE explicit Dbc(DBC* pDBC);
     110                 :            :         SAL_DLLPRIVATE ~Dbc();
     111                 :            : 
     112                 :            :     public:
     113                 :            :         int close();
     114                 :            : 
     115                 :            :         int get(Dbt *key, Dbt *data, u_int32_t flags);
     116                 :            :     };
     117                 :            : 
     118                 :            :     class DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Dbt: private DBT
     119                 :            :     {
     120                 :            :         friend class Db;
     121                 :            :         friend class Dbc;
     122                 :            : 
     123                 :            :     public:
     124                 :            :         Dbt(void *data_arg, u_int32_t size_arg);
     125                 :            : 
     126                 :            :         Dbt();
     127                 :            :         Dbt(const Dbt & other);
     128                 :            :         Dbt & operator=(const Dbt & other);
     129                 :            : 
     130                 :            :         ~Dbt();
     131                 :            : 
     132                 :            :           void *get_data() const;
     133                 :            :         void set_data(void *value);
     134                 :            : 
     135                 :            :           u_int32_t get_size() const;
     136                 :            :         void set_size(u_int32_t value);
     137                 :            :     };
     138                 :            : }
     139                 :            : 
     140                 :            : #endif
     141                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10