Source: channelioformat.h


Annotated List
Files
Globals
Hierarchy
Index
// -*- c++ -*-

/*
 *
 * Copyright (C) 2002 Richard Moore 
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef CHANNELIOFORMAT_H
#define CHANNELIOFORMAT_H

#include 
#include 
#include 

class QIODevice;
class KSaveFile;
class ChannelStore;

/**
 * Base-class of all channel format implementations.
 *
 * @author Richard Moore, 
 * @version $Id: channelioformat.h,v 1.3 2002/03/18 23:00:04 rich Exp $
 */
class ChannelIOFormat
{
public:
    /**
     * Flags indicating the level of support provided by the handler.
     */
    enum Flags {
	FormatRead = 0x1,
	FormatWrite = 0x2,
	FormatReadWrite = FormatRead | FormatWrite
    };

    ChannelIOFormat( const char *name, int flags = FormatReadWrite );
    virtual ~ChannelIOFormat() {}

    /**
     * The name of the format.
     */
    const char *name() const { return fmtName.data(); }

    /**
     * Returns true iff this object can read the specified format. If
     * no format is specified, then it is assumed that the user wants
     * to know about the one returned by @ref name() .
     */
    bool canRead( const char *fmt=0 ) const;

    /**
     * Returns true iff this object can write the specified format.
     * @see canRead() .
     */
    bool canWrite( const char *fmt=0 ) const;

    /**
     * Load the specified file into the specified store. Returns true
     * on success, false otherwise.
     */
    bool load( ChannelStore *store, const QString &filename, const char *fmt );

    /**
     * Save the specified store into the specified file. Returns true
     * on success, false otherwise.
     */
    bool save( ChannelStore *store, const QString &filename, const char *fmt );

    /**
     * Load the contents of the specified QIODevice into the specified store. 
     * Returns true on success, false otherwise.
     */
    virtual bool load( ChannelStore *store, QIODevice *file, const char *fmt );

    /**
     * Save the contents of the specified store into the specified QIODevice. 
     * Returns true on success, false otherwise.
     */
    virtual bool save( ChannelStore *store, QIODevice *file, const char *fmt );

private:
    QCString fmtName;
    int flags;
};

typedef QPtrList ChannelIOFormatList;

#endif // CHANNELIOFORMAT_H

Generated by: rich on pegasus on Wed Mar 20 03:16:53 2002, using kdoc 2.0a53.