2 * ProjectFile.h - TaskJuggler
4 * Copyright (c) 2001, 2002 by Chris Schlaeger <cs@suse.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
13 #ifndef _ProjectFile_h_
14 #define _ProjectFile_h_
21 #include "MacroTable.h"
36 * @short File Parser for project files.
37 * @author Chris Schlaeger <cs@suse.de>
43 * A ProjectFile cannot exist without a project. So the constructor needs
44 * to know what Project object to fill, when it parses the project files.
46 ProjectFile(Project* p);
50 * The top-level project files needs to be opened before the parser can be
52 * @param file The file name of the file to start with.
53 * @param parentPath The path of the file that included this file. This
54 * feature is for internal use only. It's not part of the public API.
55 * @param taskPrefix The ID prefix of the parent task. This is needed when
56 * the tasks of the project file should be read as a sub-task of an
57 * already existing task.
59 bool open(const QString& file, const QString& parentPath,
60 const QString& taskPrefix);
62 * Close the just read input file.
67 * Calling the parse function will start the processing of the opened
68 * project file. It will automatically read all include files as well. The
69 * collected data is stored into the Project object.
74 * The rest of the public methods are for use by FileInfo and are not part
75 * of the library public interface.
78 TokenType nextToken(QString& token);
79 void returnToken(TokenType t, const QString& buf)
81 if (!openFiles.isEmpty())
82 openFiles.last()->returnToken(t, buf);
84 const QString& getFile()
86 if (openFiles.isEmpty())
88 return openFiles.last()->getFile();
92 if (openFiles.isEmpty())
94 return openFiles.last()->getLine();
97 bool moreFiles() { return !openFiles.isEmpty(); }
99 const QString& getTaskPrefix();
101 void fatalError(const char* msg, ...);
103 MacroTable& getMacros() { return macros; }
106 ProjectFile() {}; // don't use
110 bool readTask(Task* parent);
111 bool readTaskSupplement(QString prefix);
112 bool readTaskBody(Task* task);
113 bool readResource(Resource* parent);
114 bool readResourceSupplement();
115 bool readResourceBody(Resource* r);
116 bool readVacation(time_t& from, time_t& to, bool readName = FALSE,
118 bool readAccount(Account* parent);
119 bool readShift(Shift* parent);
120 Shift* readShiftSelection(time_t& from, time_t& to);
121 Booking* readBooking();
122 bool readCredit(Account* a);
123 bool readAllocate(Task* t);
124 bool readPlanTimeFrame(double& d, bool workingDays);
125 bool readTimeValue(ulong& value);
126 bool readPercent(double& value);
127 bool readWorkingHours(int& dayOfWeek, QPtrList<Interval>* l);
128 bool readPriority(int& priority);
129 bool checkReportInterval(ReportHtml* report);
130 bool readHTMLReport(const QString& reportType);
131 bool readHTMLAccountReport();
132 bool readExportReport();
133 bool readXMLReport();
134 bool readHtmlUrl(ReportHtml* report);
136 bool readICalTaskReport();
138 Operation* readLogicalExpression(int precedence = 0);
139 Operation* readFunctionCall(const QString& name);
140 bool readSorting(Report* report, int which);
141 time_t date2time(const QString& date);
142 int hhmm2time(const QString& hhmm);
146 QPtrList<FileInfo> openFiles;
147 QStringList includedFiles;