Ananas Library 0.9.5
atemplate.h
1/****************************************************************************
2** $Id: atemplate.h,v 1.12 2007/08/04 14:22:02 app Exp $
3**
4** Report metadata object header file of
5** Ananas application library
6**
7** Created : 20031201
8**
9** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10** Copyright (C) 2003-2005 Grigory Panov, Yoshkar-Ola.
11**
12** This file is part of the Designer application of the Ananas
13** automation accounting system.
14**
15** This file may be distributed and/or modified under the terms of the
16** GNU General Public License version 2 as published by the Free Software
17** Foundation and appearing in the file LICENSE.GPL included in the
18** packaging of this file.
19**
20** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22**
23** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
24** See http://www.leaderit.ru/gpl/ for GPL licensing information.
25**
26** Contact org@leaderit.ru if any conditions of this licensing are
27** not clear to you.
28**
29**********************************************************************/
30
31#ifndef ATEMPLATE_H
32#define ATEMPLATE_H
33
34#include "ananasglobal.h"
35#include "itemplate.h"
36
37#define token_open "<#"
38#define token_close "#>"
39
40#include <qobject.h>
41#include <qdict.h>
42#include <qstringlist.h>
43
102class ANANAS_EXPORT aTemplate : public iTemplate
103{
104 Q_OBJECT
105public:
106
107 aTemplate();
108 virtual ~aTemplate();
109
110 bool open( const QString &fname );
111 void close();
112 void clear(){ buf="";};
113 QString getValue( const QString &name );
114 void setValue( const QString &name, const QString &value );
115 QString exec( const QString &sname );
116 QString result(){ return buf;};
117 bool save( const QString & fname );
118 void cleanUpTags();
119 virtual void setDir(const QString &dir);
120 virtual QString getDir();
121
122protected:
123 QString templateDir;
124
125private:
126 QString buf;
127 QString tpl;
128 QDict<QString> values;
129
130 void freeValues();
131};
132
133#endif //ATEMPLATE_H
Definition atemplate.h:103
QString result()
Definition atemplate.h:116
void clear()
Definition atemplate.h:112
Definition itemplate.h:59
virtual void setValue(const QString &name, const QString &value)
Definition itemplate.cpp:115
virtual void close()
Definition itemplate.cpp:87
virtual bool open(const QString &fname)=0
Definition itemplate.cpp:73
virtual void cleanUpTags()
Definition itemplate.cpp:186
virtual void setDir(const QString &dir)
Definition itemplate.cpp:199
virtual QString getDir()
Definition itemplate.cpp:212
virtual QString getValue(const QString &name)
Definition itemplate.cpp:100
virtual QString exec(const QString &sname)
Definition itemplate.cpp:145
virtual bool save(const QString &fname)
Definition itemplate.cpp:129