diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-26 01:17:20 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-26 01:17:20 (GMT) |
commit | 4058b501914216bf28ab62c02b78abcbf7f5a3c9 (patch) | |
tree | 5dc502f69aa8f2151c9adfee3580f1d1aa0833aa /src/declarative/qml/rewriter/textwriter_p.h | |
parent | 334e406ff6441d3980741683714087c59c7dd123 (diff) | |
download | Qt-4058b501914216bf28ab62c02b78abcbf7f5a3c9.zip Qt-4058b501914216bf28ab62c02b78abcbf7f5a3c9.tar.gz Qt-4058b501914216bf28ab62c02b78abcbf7f5a3c9.tar.bz2 |
roberto: Added support for CSS like numeric literals e.g. 10p
Diffstat (limited to 'src/declarative/qml/rewriter/textwriter_p.h')
-rw-r--r-- | src/declarative/qml/rewriter/textwriter_p.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/declarative/qml/rewriter/textwriter_p.h b/src/declarative/qml/rewriter/textwriter_p.h new file mode 100644 index 0000000..52d18d3 --- /dev/null +++ b/src/declarative/qml/rewriter/textwriter_p.h @@ -0,0 +1,60 @@ +#ifndef TEXTWRITER_H +#define TEXTWRITER_H + +#include <QtCore/QString> +#include <QtCore/QList> +#include <QtGui/QTextCursor> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +namespace JavaScript { + +class TextWriter +{ + QString *string; + QTextCursor *cursor; + + struct Replace { + int pos; + int length; + QString replacement; + }; + + QList<Replace> replaceList; + + struct Move { + int pos; + int length; + int to; + }; + + QList<Move> moveList; + + bool hasOverlap(int pos, int length); + bool hasMoveInto(int pos, int length); + + void doReplace(const Replace &replace); + void doMove(const Move &move); + + void write_helper(); + +public: + TextWriter(); + + void replace(int pos, int length, const QString &replacement); + void move(int pos, int length, int to); + + void write(QString *s); + void write(QTextCursor *textCursor); + +}; + +} // end of namespace JavaScript + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // TEXTWRITER_H |