-
Notifications
You must be signed in to change notification settings - Fork 0
/
aeasy_parse.h
executable file
·85 lines (74 loc) · 3.55 KB
/
aeasy_parse.h
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
/* --------------------------------------------------------------------------------------------
* aeasy_parse.h
* --------------------------------------------------------------------------------------------
* DESCRIPTION: Class for parsing the album source file
* --------------------------------------------------------------------------------------------
* COPYRIGHT: Copyright (c) 2005-2013
* Clive Levinson <[email protected]>
* Bundu Technology Ltd.
* --------------------------------------------------------------------------------------------
* LICENCE: AlbumEasy is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your option)
* any later version.
* --------------------------------------------------------------------------------------------
* AUTHORS: Clive Levinson
* --------------------------------------------------------------------------------------------
* REVISIONS: Date Version Who Comment
*
* 2011/04/26 3.0 cl First QT Version
* -------------------------------------------------------------------------------------------- */
#ifndef _AEASY_PARSE_H
#define _AEASY_PARSE_H
#include "AlbumEasy.h"
class CAlbumData;
class CConfig;
class CFontFileList;
/************************************************************************************************
CParser: class responsible for parsing the album source
************************************************************************************************/
class CParser:public QObject
{
Q_OBJECT
public:
bool parseFile(QFile *file,CAlbumData *album,QWidget *parent,CConfig *config,
CFontFileList *fontFiles);
signals:
void logMessage(QString text,QString colour="",bool bold=false);
private:
void cleanLine(QString &buf);
bool splitLine(QString line,QString &cmnd,QString &parms);
bool processCommand(QString cmnd,QString parms);
bool parseBlankParameters(QString cmnd,QString parms);
void extractParameterField(QString &parms,QString &field,bool toUpper=false);
int parseDoubleParameters(QString cmnd,QString &parms,int count,double *vals,
bool displayErr=true);
bool parseTextField(QString cmnd,QString &parms,QString &text);
bool parseFontParameters(QString cmnd,QString &parms,int &fidex,double &size);
bool pageRequired(QString cmnd);
bool rowRequired(QString cmnd);
void displayError(int line,QString msg);
public:
bool processPageSizeCommand(QString cmnd,QString parms);
bool processPageMarginsCommand(QString cmnd,QString parms);
bool processPageBorderCommand(QString cmnd,QString parms);
bool processPageSpacingCommand(QString cmnd,QString parms);
bool processPageTitleCommand(QString cmnd,QString parms);
bool processDefineFontCommand(QString cmnd,QString parms);
bool processPageStartCommand(QString cmnd,QString parms);
bool processPageTextCommand(QString cmnd,QString parms);
bool processRowAlignCommand(QString cmnd,QString parms);
bool processRowStartCommand(QString cmnd,QString parms);
bool processStampAddCommand(QString cmnd,QString parms);
private:
int m_currentLine;
CAlbumData *m_albumData;
CFontFileList *m_fontFiles;
QWidget *m_parent;
CConfig *m_config;
};
inline void CParser::displayError(int line,QString msg)
{
emit(logMessage(tr("<b>Error in line %1: </b> %2").arg(line).arg(msg),"red",false));
}
#endif // _AEASY_PARSE_H