~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/ipemodel/ipeq.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2004-06-08 00:44:02 UTC
  • Revision ID: james.westby@ubuntu.com-20040608004402-72yu51xlh7vt6p9m
Tags: upstream-6.0pre16
ImportĀ upstreamĀ versionĀ 6.0pre16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
// --------------------------------------------------------------------
 
3
// Ipe <-> Qt interface
 
4
// --------------------------------------------------------------------
 
5
/*
 
6
 
 
7
    This file is part of the extensible drawing editor Ipe.
 
8
    Copyright (C) 1993-2004  Otfried Cheong
 
9
 
 
10
    Ipe is free software; you can redistribute it and/or modify it
 
11
    under the terms of the GNU General Public License as published by
 
12
    the Free Software Foundation; either version 2 of the License, or
 
13
    (at your option) any later version.
 
14
 
 
15
    As a special exception, you have permission to link Ipe with the
 
16
    CGAL library and distribute executables, as long as you follow the
 
17
    requirements of the Gnu General Public License in regard to all of
 
18
    the software in the executable aside from CGAL.
 
19
 
 
20
    Ipe is distributed in the hope that it will be useful, but WITHOUT
 
21
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
22
    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
23
    License for more details.
 
24
 
 
25
    You should have received a copy of the GNU General Public License
 
26
    along with Ipe; if not, you can find it at
 
27
    "http://www.gnu.org/copyleft/gpl.html", or write to the Free
 
28
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
29
 
 
30
*/
 
31
 
 
32
#ifndef QIPE_H
 
33
#define QIPE_H
 
34
 
 
35
#include "ipebase.h"
 
36
#include "ipexml.h"
 
37
#include "ipecolor.h"
 
38
 
 
39
#include <qstring.h>
 
40
#include <qpixmap.h>
 
41
 
 
42
// --------------------------------------------------------------------
 
43
 
 
44
class QIODevice;
 
45
class IpeStyleSheet;
 
46
 
 
47
extern QPixmap ColorPixmap(IpeAttribute sym, const IpeStyleSheet *sheet);
 
48
 
 
49
inline IpeString IpeQ(const QString &str)
 
50
{
 
51
  return IpeString(str.utf8());
 
52
}
 
53
 
 
54
inline QString QIpe(const IpeString &str)
 
55
{
 
56
  return QString::fromUtf8(str.CString());
 
57
}
 
58
 
 
59
class IpeQStream : public IpeStream {
 
60
public:
 
61
  IpeQStream(QIODevice *file);
 
62
  virtual void PutChar(char ch);
 
63
  virtual void PutString(IpeString s);
 
64
  virtual void PutCString(const char *s);
 
65
  virtual void PutRaw(const char *data, int size);
 
66
private:
 
67
  QIODevice *iDevice;
 
68
};
 
69
 
 
70
class XmlQStringSource : public IpeXmlDataSource {
 
71
public:
 
72
  XmlQStringSource(QString str);
 
73
  virtual int GetChar();
 
74
private:
 
75
  IpeString iData;
 
76
  int iPos;
 
77
};
 
78
 
 
79
class XmlQSource : public IpeXmlDataSource {
 
80
public:
 
81
  XmlQSource(QIODevice *dev, bool skipPercent = false);
 
82
  virtual int GetChar();
 
83
private:
 
84
  bool iSkipPercent;
 
85
  QIODevice *iDev;
 
86
};
 
87
 
 
88
inline IpeStream &operator<<(IpeStream &stream, const QString &str)
 
89
{
 
90
  stream << IpeQ(str);
 
91
  return stream;
 
92
}
 
93
 
 
94
// --------------------------------------------------------------------
 
95
#endif