update dev300-m58
[ooovba.git] / tools / inc / bootstrp / mkcreate.hxx
blob5bf75497a3ace25c8bd8e38945679f0935db295d
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: mkcreate.hxx,v $
10 * $Revision: 1.4 $
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 _MK_CREATE_HXX
32 #define _MK_CREATE_HXX
34 #include <tools/string.hxx>
35 #include "bootstrp/sstring.hxx"
37 #include <tools/list.hxx>
38 #include "bootstrp/prj.hxx"
40 class SvStream;
41 class SourceDirectoryList;
44 // class SourceDirectoryDependency
47 class CodedDependency : public ByteString
49 private:
50 USHORT nOSType; // operating systems where dependeny exists
52 public:
53 /* create a dependency instance with given coded directory name
55 CodedDependency(
56 const ByteString &rCodedIdentifier, // the coded name of the directory
57 USHORT nOperatingSystems // the operating systems where this dependency exists
58 ) :
59 ByteString( rCodedIdentifier ),
60 nOSType( nOperatingSystems )
64 /* returns the operating system
66 USHORT GetOperatingSystem()
68 return nOSType;
71 /* set operating system
73 void SetOperatingSystem( USHORT nOperatingSystems )
75 nOSType = nOperatingSystems;
78 /* add operating systems if same dependency
80 BOOL TryToMerge(
81 const ByteString &rCodedIdentifier, // the coded name of the directory
82 USHORT nOperatingSystems // the operating systems where this dependency exists
85 if ( rCodedIdentifier != *this )
86 return FALSE;
87 nOSType |= nOperatingSystems;
88 return TRUE;
93 // class Dependecy
96 class Dependency : public ByteString
98 private:
99 USHORT nOSType; // operating systems where dependecy exists
101 public:
102 /* create a dependency instance with given directory name
104 Dependency(
105 const ByteString &rDirectoryName, // the coded name of the directory
106 USHORT nOperatingSystems // the operating systems where this dependency exists
108 ByteString( rDirectoryName ),
109 nOSType( nOperatingSystems )
113 /* returns the operating system
115 USHORT GetOperatingSystem()
117 return nOSType;
122 // class SourceDirectory
125 class SourceDirectory : public ByteString
127 private:
128 SourceDirectory *pParent; // the parent directory
129 SourceDirectoryList *pSubDirectories; // list of sub directories
130 USHORT nOSType; // operating systems where this directory is used
131 USHORT nDepth; // depth of directory structure (root is 0)
133 SByteStringList *pDependencies; // dependencies on other directories in this depth
135 SByteStringList *pCodedDependencies; // dependencies on other directories in different depth
136 SByteStringList *pCodedIdentifier; // symbolic identifier to resolve dependencies
138 /* try to resolve a single dependency
140 Dependency *ResolvesDependency(
141 CodedDependency *pCodedDependency // the dependency
144 /* returns the operating systems of a coded dependency
146 static USHORT GetOSType(
147 const ByteString &sDependExt // the corresponding dependency extension (see also prj.hxx)
150 /* removes this and all sub directories with all dependencies
152 BOOL RemoveDirectoryTreeAndAllDependencies();
154 public:
156 /* create a directory instance with given parent and name, no parent means this is the root
157 * (not the file system root but the root of the source tree, e.g. o:\569)
159 SourceDirectory(
160 const ByteString &rDirectoryName, // name without parent
161 USHORT nOperatingSystem, // the operating systems where this directory is used
162 SourceDirectory *pParentDirectory = NULL // parent (if not root)
164 ~SourceDirectory();
166 /* returns the full absolute path of this directory
168 ByteString GetFullPath();
170 /* returns a list of all sub directories
172 SourceDirectoryList *GetSubDirectories() { return pSubDirectories; }
174 /* returns the Operating systems where this directory is used
176 USHORT GetOperatingSystems() { return nOSType; }
178 /* returns the given directory
180 SourceDirectory *GetDirectory(
181 const ByteString &rDirectoryName, // full path
182 USHORT nOperatingSystem // the operating systems where this directory is used
185 /* create the directory and all mandatory parents
187 SourceDirectory *InsertFull(
188 const ByteString &rDirectoryName, // full path
189 USHORT nOperatingSystem // the operating systems where this directory is used
192 return GetDirectory( rDirectoryName, nOperatingSystem );
195 /* create the directory as sub directory of this directory
197 SourceDirectory *Insert(
198 const ByteString &rDirectoryName, // name without parent
199 USHORT nOperatingSystem // the operating systems where this directory is used
202 /* get the root directory
204 SourceDirectory *GetRootDirectory();
206 /* get sub directory if exists
208 SourceDirectory *GetSubDirectory(
209 const ByteString &rDirectoryPath, // full sub path
210 USHORT nOperatingSystem // the operating systems where this directory is used
213 /* add a dependency for several platforms
215 CodedDependency *AddCodedDependency(
216 const ByteString &rCodedIdentifier, // the coded name of the directory
217 USHORT nOperatingSystems // the operating systems where this dependency exists
220 /* returns the dependency list
222 SByteStringList *GetCodedDependencies()
224 return pCodedDependencies;
227 /* add symbolic identifier to resolve dependencies (to this directory and all parents)
229 CodedDependency *AddCodedIdentifier(
230 const ByteString &rCodedIdentifier, // the coded name of the directory
231 USHORT nOperatingSystems // the operating systems where this dependency exists
234 /* returns the identifier list
236 SByteStringList *GetCodedIdentifier()
238 return pCodedIdentifier;
241 /* create dependencies on other directory, coded dependecies are used
243 void ResolveDependencies();
245 /* returns the target definition for this directory (if dependencies exist)
247 ByteString GetTarget();
249 /* returns the target definition for all sub directory
251 ByteString GetSubDirsTarget();
253 /* create the full directory tree (only virtual, not in file system)
255 static SourceDirectory *CreateRootDirectory(
256 const ByteString &rRoot, // the root directory in file system
257 const ByteString &rVersion, // the solar verion (r.g. SRC590, SRC591 etc.)
258 BOOL bAll = FALSE // add all directories or only buildable ones
261 /* create the makefile.rc in file system
263 BOOL CreateRecursiveMakefile(
264 BOOL bAllChilds = FALSE // create rcursive for all sub directories
269 // class SourceDirectoryList
272 class SourceDirectoryList : public SByteStringList
274 public:
275 /* create a empty directory list
277 SourceDirectoryList()
280 ~SourceDirectoryList();
282 /* search for a directory by directory name
284 SourceDirectory *Search(
285 const ByteString &rDirectoryName // name without parent
288 /* insert a new directory
290 ULONG InsertSorted(
291 SourceDirectory *pDirectory // directory
294 return PutString(( ByteString * ) pDirectory );
298 #endif