1 /*******************************************************************
2 
3 Part of the Fritzing project - http://fritzing.org
4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de
5 
6 Fritzing is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 Fritzing is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with Fritzing.  If not, see <http://www.gnu.org/licenses/>.
18 
19 ********************************************************************
20 
21 $Revision: 6904 $:
22 $Author: irascibl@gmail.com $:
23 $Date: 2013-02-26 16:26:03 +0100 (Di, 26. Feb 2013) $
24 
25 ********************************************************************/
26 
27 #ifndef SVGPATHRUNNER_H
28 #define SVGPATHRUNNER_H
29 
30 #include <QVariant>
31 #include <QVector>
32 
33 struct PathCommand {
34 	bool relative;
35 	int argCount;
36 	QChar command;
37 };
38 
39 class SVGPathRunner : public QObject
40 {
41 	Q_OBJECT
42 
43 public:
44     SVGPathRunner();
45     ~SVGPathRunner();
46 
47 public:
48 	bool runPath(QVector<QVariant> & pathData, void * userData);
49 
50 signals:
51 	// note: must connect to this signal via Qt::DirectConnection since args is modified immediately after the signal
52 	void commandSignal(QChar command, bool relative, QList<double> & args, void * userData);
53 
54 protected:
55 	static void initStates();
56 
57 protected:
58 	static QHash<QChar, PathCommand *> pathCommands;
59 
60 };
61 
62 #endif // SVGPATHRUNNER_H
63