libkdenetwork Library API Documentation

gpgmepp/data.h

00001 /* data.h - wraps a gpgme data object
00002    Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
00003 
00004    This file is part of GPGME++.
00005  
00006    GPGME++ is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010  
00011    GPGME++ is distributed in the hope that it will be useful, but
00012    WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with GPGME++; if not, write to the Free Software Foundation,
00018    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.
00019 */
00020 
00021 #ifndef __GPGMEPP_DATA_H__
00022 #define __GPGMEPP_DATA_H__
00023 
00024 #include <gpgmepp/gpgmefw.h>
00025 
00026 #include <sys/types.h> // for size_t, off_t
00027 #include <cstdio> // FILE
00028 
00029 namespace GpgME {
00030 
00031   class DataProvider;
00032   class Error;
00033 
00034   class Data {
00035   public:
00036     Data();
00037     Data( gpgme_data_t data );
00038     Data( const Data & other );
00039 
00040     // Memory-Based Data Buffers:
00041     Data( const char * buffer, size_t size, bool copy=true );
00042     Data( const char * filename );
00043     Data( const char * filename, off_t offset, size_t length );
00044     Data( FILE * fp, off_t offset, size_t length );
00045     // File-Based Data Buffers:
00046     Data( FILE * fp );
00047     Data( int fd );
00048     // Callback-Based Data Buffers:
00049     Data( DataProvider * provider );
00050 
00051     virtual ~Data();
00052 
00053     static Data null;
00054 
00055     const Data & operator=( const Data & other );
00056 
00057     bool isNull() const;
00058 
00059     ssize_t read( void * buffer, size_t length );
00060     ssize_t write( const void * buffer, size_t length );
00061     off_t seek( off_t offset, int whence );
00062 
00063     class Private;
00064     Private * impl() const { return d; }
00065   private:
00066     Private * d;
00067   };
00068 
00069 }
00070 
00071 #endif // __GPGMEPP_DATA_H__
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 25 11:16:57 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003