2 * XMLFile.h - TaskJuggler
4 * Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006
5 * by Chris Schlaeger <cs@kde.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
19 #include "ParserElement.h"
25 class ParserTreeContext;
28 * @short File Parser for project files.
29 * @author Chris Schlaeger <cs@kde.org>
35 * A XMLFile cannot exist without a project. So the constructor needs
36 * to know what Project object to fill, when it parses the project files.
42 * The files XML files needs to be opened before the parser can be
44 * @param file The file name of the file to start with.
45 * @param parentPath The path of the file that included this file. This
46 * feature is for internal use only. It's not part of the public API.
47 * @param taskPrefix The ID prefix of the parent task. This is needed when
48 * the tasks of the project file should be read as a sub-task of an
49 * already existing task.
50 * @param This flag must be true if a top-level file should be processed.
51 * This is a file, that is not included by any other file.
53 bool readDOM(const QString& file, const QString& parentPath,
54 const QString& taskPrefix, bool masterfile = false);
57 * Calling the parse function will start the processing of the DOM tree
58 * It will automatically read all include files as well. The
59 * collected data is stored into the Project object.
64 XMLFile() {}; // don't use
66 void createParseTree();
67 void createSubTreeTimeInterval(const QString& id, ParserFunctionPtr preFunc,
68 ParserNode* parentNode,
69 ParserFunctionPtr postFunc = 0);
70 void createSubTreeWorkingHours(ParserFunctionPtr func,
71 ParserElement* parentEl,
72 ParserFunctionPtr postFunc);
73 void createSubTreeVacationList(ParserFunctionPtr func,
74 ParserNode* parentNode);
75 void createSubTreeCustomAttribute(ParserNode* parentNode);
77 bool parseNode(const ParserNode* pn, QDomNode n, ParserTreeContext ptc);
79 bool doTaskJuggler(QDomNode& n, ParserTreeContext& ptc);
80 bool doProject(QDomNode& n, ParserTreeContext& ptc);
81 bool doProjectStart(QDomNode& n, ParserTreeContext& ptc);
82 bool doProjectEnd(QDomNode& n, ParserTreeContext& ptc);
83 bool doProjectNow(QDomNode& n, ParserTreeContext& ptc);
84 bool doCurrencyFormat(QDomNode& n, ParserTreeContext& ptc);
85 bool doScenario(QDomNode& n, ParserTreeContext& ptc);
86 bool doExtend(QDomNode& n, ParserTreeContext& ptc);
87 bool doExtendAttribute(QDomNode& n, ParserTreeContext& ptc);
88 bool doProjectWeekdayWorkingHours(QDomNode& n, ParserTreeContext& ptc);
89 bool doProjectWeekdayWorkingHoursPost(QDomNode& n, ParserTreeContext& ptc);
90 bool doShiftWeekdayWorkingHours(QDomNode& n, ParserTreeContext& ptc);
91 bool doShiftWeekdayWorkingHoursPost(QDomNode& n, ParserTreeContext& ptc);
92 bool doResourceWeekdayWorkingHours(QDomNode& n, ParserTreeContext& ptc);
93 bool doResourceWeekdayWorkingHoursPost(QDomNode& n, ParserTreeContext& ptc);
94 bool doTimeInterval(QDomNode& n, ParserTreeContext& ptc);
95 bool doTimeIntervalStart(QDomNode& n, ParserTreeContext& ptc);
96 bool doTimeIntervalEnd(QDomNode& n, ParserTreeContext& ptc);
97 bool doProjectVacation(QDomNode& n, ParserTreeContext& ptc);
98 bool doResourceVacation(QDomNode& n, ParserTreeContext& ptc);
99 bool doVacationStart(QDomNode& n, ParserTreeContext& ptc);
100 bool doVacationEnd(QDomNode& n, ParserTreeContext& ptc);
101 bool doCustomAttribute(QDomNode& n, ParserTreeContext& ptc);
102 bool doTextAttribute(QDomNode& n, ParserTreeContext& ptc);
103 bool doReferenceAttribute(QDomNode& n, ParserTreeContext& ptc);
104 bool doShiftList(QDomNode& n, ParserTreeContext& ptc);
105 bool doShift(QDomNode& n, ParserTreeContext& ptc);
106 bool doResourceList(QDomNode& n, ParserTreeContext& ptc);
107 bool doResource(QDomNode& n, ParserTreeContext& ptc);
108 bool doShiftSelection(QDomNode& n, ParserTreeContext& ptc);
109 bool doAccountList(QDomNode& n, ParserTreeContext& ptc);
110 bool doAccount(QDomNode& n, ParserTreeContext& ptc);
111 bool doTaskList(QDomNode& n, ParserTreeContext& ptc);
112 bool doTask(QDomNode& n, ParserTreeContext& ptc);
113 bool doTaskScenario(QDomNode& n, ParserTreeContext& ptc);
114 bool doTaskScenarioStart(QDomNode& n, ParserTreeContext& ptc);
115 bool doTaskScenarioEnd(QDomNode& n, ParserTreeContext& ptc);
116 bool doTaskScenarioMaxEnd(QDomNode& n, ParserTreeContext& ptc);
117 bool doTaskScenarioMinEnd(QDomNode& n, ParserTreeContext& ptc);
118 bool doTaskScenarioMaxStart(QDomNode& n, ParserTreeContext& ptc);
119 bool doTaskScenarioMinStart(QDomNode& n, ParserTreeContext& ptc);
120 bool doAllocate(QDomNode& n, ParserTreeContext& ptc);
121 bool doCandidate(QDomNode& n, ParserTreeContext& ptc);
122 bool doDepends(QDomNode& n, ParserTreeContext& ptc);
123 bool doPrecedes(QDomNode& n, ParserTreeContext& ptc);
124 bool doDependencyGapScenario(QDomNode& n, ParserTreeContext& ptc);
125 bool doNote(QDomNode& n, ParserTreeContext& ptc);
126 bool doFlag(QDomNode& n, ParserTreeContext& ptc);
127 bool doResourceBooking(QDomNode& n, ParserTreeContext& ptc);
128 bool doBooking(QDomNode& n, ParserTreeContext& ptc);
129 bool doBookingPost(QDomNode& n, ParserTreeContext& ptc);
135 static ParserNode* parserRootNode;