/usr/include/qwtplot3d/qwt3d_io.h is in libqwtplot3d-qt5-dev 0.2.7+svn191-10.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | #ifndef __qwt3d_io_2003_07_04_23_27__
#define __qwt3d_io_2003_07_04_23_27__
#include <vector>
#include <algorithm>
#include <qstring.h>
#include <qstringlist.h>
#include "qwt3d_global.h"
namespace Qwt3D
{
class Plot3D;
/**
IO provides a generic interface for standard and user written I/O handlers.
It also provides functionality for the registering of such handlers in the
framework.\n
The interface mimics roughly Qt's QImageIO functions for defining
image input/output functions.
*/
class QWT3D_EXPORT IO
{
public:
/*!
The function type that can be processed by the define... members.
An extension is the IO::Functor.
*/
typedef bool (*Function)(Plot3D*, QString const& fname);
/*!
This class gives more flexibility in implementing
userdefined IO handlers than the simple IO::Function type.
*/
class Functor
{
public:
virtual ~Functor() {}
/*! Must clone the content of *this for an object of a derived class with
\c new and return the pointer. Like operator() the predefined Functors
hide this function from the user, still allowing IO access
(friend declaration)
*/
virtual Functor* clone() const = 0;
/*! The workhorse of the user-defined implementation. Eventually, the
framework will call this operator.
*/
virtual bool operator()(Plot3D* plot, QString const& fname) = 0;
};
static bool defineInputHandler( QString const& format, Function func);
static bool defineOutputHandler( QString const& format, Function func);
static bool defineInputHandler( QString const& format, Functor const& func);
static bool defineOutputHandler( QString const& format, Functor const& func);
static bool save(Plot3D*, QString const& fname, QString const& format);
static bool load(Plot3D*, QString const& fname, QString const& format);
static QStringList inputFormatList();
static QStringList outputFormatList();
static Functor* outputHandler(QString const& format);
static Functor* inputHandler(QString const& format);
private:
IO(){}
//! Lightweight Functor encapsulating an IO::Function
class Wrapper : public Functor
{
public:
//! Performs actual input
Functor* clone() const { return new Wrapper(*this); }
//! Creates a Wrapper object from a function pointer
explicit Wrapper(Function h) : hdl(h) {}
//! Returns a pointer to the wrapped function
bool operator()(Plot3D* plot, QString const& fname)
{
return (hdl) ? (*hdl)(plot, fname) : false;
}
private:
Function hdl;
};
struct Entry
{
Entry();
~Entry();
Entry(Entry const& e);
void operator=(Entry const& e);
Entry(QString const& s, Functor const& f);
Entry(QString const& s, Function f);
QString fmt;
Functor* iofunc;
};
struct FormatCompare
{
explicit FormatCompare(Entry const& e);
bool operator() (Entry const& e);
Entry e_;
};
struct FormatCompare2
{
explicit FormatCompare2(QString s);
bool operator() (Entry const& e);
QString s_;
};
typedef std::vector<Entry> Container;
typedef Container::iterator IT;
static bool add_unique(Container& l, Entry const& e);
static IT find(Container& l, QString const& fmt);
static Container& rlist();
static Container& wlist();
static void setupHandler();
};
//! Provides Qt's Pixmap output facilities
class QWT3D_EXPORT PixmapWriter : public IO::Functor
{
friend class IO;
public:
PixmapWriter() : quality_(-1) {}
void setQuality(int val);
private:
IO::Functor* clone() const {return new PixmapWriter(*this);}
bool operator()(Plot3D* plot, QString const& fname);
QString fmt_;
int quality_;
};
} //ns
#endif
|