merge the formfield patch from ooo-build
[ooovba.git] / tools / inc / bootstrp / prj.hxx
blobb8320ed844ec97802925ff66791320ebf66a8c6b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: prj.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _PRJ_HXX
32 #define _PRJ_HXX
34 #include <tools/fsys.hxx>
35 #include <tools/stream.hxx>
36 #include "bootstrp/listmacr.hxx"
37 #include <vos/mutex.hxx>
39 #define OS_NONE 0x0000
40 #define OS_WIN16 0x0001
41 #define OS_WIN32 0x0002
42 #define OS_OS2 0x0004
43 #define OS_UNX 0x0008
44 #define OS_ALL ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX )
46 #define COMMAND_PROJECTROOT 0x0000
47 #define COMMAND_NMAKE 0x0001
48 #define COMMAND_GET 0x0002
49 #define COMMAND_USER_START 0x0003
50 #define COMMAND_USER_END 0xFFFE
51 #define COMMAND_ALLDIRS 0xFFFF
53 class SByteStringList;
54 class GenericInformationList;
57 // Pfade auf Konfigurationsdateien des Build-Servers
59 #define REQUEST_DIR \\src\data4\source\b_server\server\newjob
61 /*********************************************************************
63 * Die Klasse CommandData haelte alle Informationen, die fuer die
64 * Abarbeitung eines Kommandos (nmake, get) noetig sind
66 *********************************************************************/
68 class CommandData
70 ByteString aPrj;
71 ByteString aLogFileName;
72 ByteString aInpath;
73 ByteString aUpd;
74 ByteString aUpdMinor;
75 ByteString aProduct;
76 ByteString aCommand;
77 ByteString aPath;
78 ByteString aPrePath;
79 ByteString aPreFix;
80 ByteString aCommandPara;
81 ByteString aComment;
82 ByteString sClientRestriction;
83 SByteStringList *pDepList;
84 USHORT nOSType;
85 USHORT nCommand;
87 ULONG nDepth; // Tiefe der Abhaenigkeit
89 public:
90 CommandData();
91 ~CommandData();
92 ByteString GetProjectName(){return aPrj;}
93 void SetProjectName( ByteString aName ){aPrj = aName;}
94 ByteString GetLogFile(){return aLogFileName;}
95 void SetLogFile( ByteString aName ){aLogFileName = aName;}
96 ByteString GetInpath(){return aInpath;}
97 void SetInpath( ByteString aName ){aInpath = aName;}
98 ByteString GetUpd(){return aUpd;}
99 void SetUpd( ByteString aName ){aUpd = aName;}
100 ByteString GetUpdMinor(){return aUpdMinor;}
101 void SetUpdMinor( ByteString aName ){aUpdMinor = aName;}
102 ByteString GetProduct(){return aProduct;}
103 void SetProduct( ByteString aName ){aProduct = aName;}
104 ByteString GetCommand(){return aCommand;}
105 void SetCommand ( ByteString aName ){aCommand = aName;}
106 ByteString GetCommandPara(){return aCommandPara;}
107 void SetCommandPara ( ByteString aName ){aCommandPara = aName;}
108 ByteString GetComment(){return aComment;}
109 void SetComment ( ByteString aCommentString ){aComment = aCommentString;}
110 ByteString GetPath(){return aPath;}
111 void SetPath( ByteString aName ){aPath = aName;}
112 ByteString GetPrePath(){return aPrePath;}
113 void SetPrePath( ByteString aName ){aPrePath = aName;}
114 USHORT GetOSType(){return nOSType;}
115 ByteString GetOSTypeString();
116 void SetOSType( USHORT nType ){nOSType = nType;}
117 USHORT GetCommandType(){return nCommand;}
118 ByteString GetCommandTypeString();
119 void SetCommandType( USHORT nCommandType ){nCommand = nCommandType;}
120 SByteStringList* GetDependencies(){return pDepList;}
121 void SetDependencies( SByteStringList *pList ){pDepList = pList;}
122 ByteString GetClientRestriction() { return sClientRestriction; }
123 void SetClientRestriction( ByteString sRestriction ) { sClientRestriction = sRestriction; }
125 void AddDepth(){nDepth++;}
126 ULONG GetDepth(){return nDepth;}
129 /*********************************************************************
131 * Die Klasse SimpleConfig kann benutzt werden, um aus einer Textdatei
132 * alle Tokens zu lesen
134 *********************************************************************/
136 class SimpleConfig
138 long nLine;
139 String aFileName;
140 SvFileStream aFileStream;
141 ByteString aTmpStr;
142 ByteString aStringBuffer;
144 ByteString GetNextLine();
145 public:
146 SimpleConfig(String aSimpleConfigFileName);
147 SimpleConfig(DirEntry& rDirEntry);
148 ~SimpleConfig();
149 ByteString GetNext();
150 ByteString GetCleanedNextLine( BOOL bReadComments = FALSE );
153 #define ENV_GUI 0x00000000
154 #define ENV_OS 0x00000001
155 #define ENV_UPD 0x00000002
156 #define ENV_UPDMIN 0x00000004
157 #define ENV_INPATH 0x00000008
158 #define ENV_OUTPATH 0x00000010
159 #define ENV_GUIBASE 0x00000020
160 #define ENV_CVER 0x00000040
161 #define ENV_GVER 0x00000080
162 #define ENV_GUIENV 0x00000100
163 #define ENV_CPU 0x00000200
164 #define ENV_CPUNAME 0x00000400
165 #define ENV_DLLSUFF 0x00000800
166 #define ENV_COMEX 0x00001000
167 #define ENV_COMPATH 0x00002000
168 #define ENV_INCLUDE 0x00004000
169 #define ENV_LIB 0x00008000
170 #define ENV_PATH 0x00010000
171 #define ENV_SOLVER 0x00020000
172 #define ENV_SOLENV 0x00040000
173 #define ENV_SOLROOT 0x00080000
174 #define ENV_DEVROOT 0x00100000
175 #define ENV_EMERG 0x00200000
176 #define ENV_STAND 0x00400000
178 /*********************************************************************
180 * class Prj
181 * alle Daten eines Projektes werden hier gehalten
183 *********************************************************************/
185 DECL_DEST_LIST ( PrjList_tmp, PrjList, CommandData * )
187 class Star;
188 class Prj : public PrjList
190 friend class Star;
191 private:
192 BOOL bVisited;
194 ByteString aPrjPath;
195 ByteString aProjectName;
196 ByteString aProjectPrefix; // max. 2-buchstabige Abk.
197 SByteStringList* pPrjInitialDepList;
198 SByteStringList* pPrjDepList;
199 BOOL bHardDependencies;
200 BOOL bSorted;
202 public:
203 Prj();
204 Prj( ByteString aName );
205 ~Prj();
206 void SetPreFix( ByteString aPre ){aProjectPrefix = aPre;}
207 ByteString GetPreFix(){return aProjectPrefix;}
208 ByteString GetProjectName()
209 {return aProjectName;}
210 void SetProjectName(ByteString aName)
211 {aProjectName = aName;}
212 BOOL InsertDirectory( ByteString aDirName , USHORT aWhat,
213 USHORT aWhatOS, ByteString aLogFileName,
214 const ByteString &rClientRestriction );
215 CommandData* RemoveDirectory( ByteString aLogFileName );
216 CommandData* GetDirectoryList ( USHORT nWhatOs, USHORT nCommand );
217 CommandData* GetDirectoryData( ByteString aLogFileName );
218 inline CommandData* GetData( ByteString aLogFileName )
219 { return GetDirectoryData( aLogFileName ); };
221 SByteStringList* GetDependencies( BOOL bExpanded = TRUE );
222 void AddDependencies( ByteString aStr );
223 void HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; }
224 BOOL HasHardDependencies() { return bHardDependencies; }
227 /*********************************************************************
229 * class Star
230 * Diese Klasse liest die Projectstruktur aller StarDivision Projekte
231 * aus \\dev\data1\upenv\data\config\solar.lst aus
233 *********************************************************************/
235 DECL_DEST_LIST ( StarList_tmp, StarList, Prj* )
236 DECLARE_LIST ( SolarFileList, String* )
238 class StarFile
240 private:
241 String aFileName;
242 Date aDate;
243 Time aTime;
245 BOOL bExists;
247 public:
248 StarFile( const String &rFile );
249 const String &GetName() { return aFileName; }
250 Date GetDate() { return aDate; }
251 Time GetTime() { return aTime; }
253 BOOL NeedsUpdate();
254 BOOL Exists() { return bExists; }
257 DECLARE_LIST( StarFileList, StarFile * )
259 #define STAR_MODE_SINGLE_PARSE 0x0000
260 #define STAR_MODE_RECURSIVE_PARSE 0x0001
261 #define STAR_MODE_MULTIPLE_PARSE 0x0002
263 class Star : public StarList
265 private:
266 ByteString aStarName;
268 static Link aDBNotFoundHdl;
269 protected:
270 NAMESPACE_VOS( OMutex ) aMutex;
272 USHORT nStarMode;
273 SolarFileList aFileList;
274 StarFileList aLoadedFilesList;
275 String sSourceRoot;
277 void InsertSolarList( String sProject );
278 String CreateFileName( String sProject );
280 void Expand_Impl();
281 void ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj );
283 private:
284 void Read( String &rFileName );
285 void Read( SolarFileList *pSOlarFiles );
287 public:
288 Star();
289 Star( String aFileName, USHORT nMode = STAR_MODE_SINGLE_PARSE );
290 Star( SolarFileList *pSolarFiles );
291 Star( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE,
292 const char *pSourceRoot = NULL );
294 ~Star();
296 static void SetDBNotFoundHdl( const Link &rLink ) { aDBNotFoundHdl = rLink; }
298 ByteString GetName(){ return aStarName; };
300 BOOL HasProject( ByteString aProjectName );
301 Prj* GetPrj( ByteString aProjectName );
302 ByteString GetPrjName( DirEntry &rPath );
304 void InsertToken( char *pChar );
305 BOOL NeedsUpdate();
307 USHORT GetMode() { return nStarMode; }
310 class StarWriter : public Star
312 private:
313 USHORT WritePrj( Prj *pPrj, SvFileStream& rStream );
315 public:
316 StarWriter( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE );
317 StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE );
318 StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE,
319 const char *pSourceRoot = NULL );
321 void CleanUp();
323 BOOL InsertProject ( Prj* pNewPrj );
324 Prj* RemoveProject ( ByteString aProjectName );
326 USHORT Read( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE );
327 USHORT Read( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE );
328 USHORT Write( String aFileName );
329 USHORT WriteMultiple( String rSourceRoot );
331 void InsertTokenLine( ByteString& rString );
334 #endif