xref: /aoo4110/main/soldep/bootstrp/dep.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "dep.hxx"
25 
26 // class SByteExtStringList
27 
28 /*****************************************************************************/
~SByteExtStringList()29 SByteExtStringList::~SByteExtStringList()
30 /*****************************************************************************/
31 {
32 	if (bDeleteStrings)
33 		while( Count()) {
34 			delete GetObject((sal_uIntPtr)0);
35 			Remove((sal_uIntPtr)0);
36 		}
37 }
38 
39 // class VersionDepInfo
40 
41 /*****************************************************************************/
~VersionDepInfo()42 VersionDepInfo::~VersionDepInfo()
43 /*****************************************************************************/
44 {
45 	if (pVersion)
46 		delete pVersion;
47 }
48 
49 /*****************************************************************************/
Clear()50 void VersionDepInfo::Clear()
51 /*****************************************************************************/
52 {
53 	while( Count()) {
54 		delete GetObject((sal_uIntPtr)0);
55 		Remove((sal_uIntPtr)0);
56 	}
57 }
58 
59 // class VersionDepInfoList
60 
61 /*****************************************************************************/
GetVersion(ByteString & rVersion)62 VersionDepInfo*	VersionDepInfoList::GetVersion (ByteString& rVersion)
63 /*****************************************************************************/
64 {
65 	VersionDepInfo* pInfo = First();
66 	while (pInfo)
67 	{
68 		const ByteString* pStr = pInfo->GetVersion();
69 		if (*pStr == rVersion)
70 			return pInfo;
71 		pInfo = Next();
72 	}
73 	return NULL;
74 }
75 
76 /*****************************************************************************/
RemoveVersion(ByteString & rVersion)77 void VersionDepInfoList::RemoveVersion (ByteString& rVersion)
78 /*****************************************************************************/
79 {
80 	VersionDepInfo* pInfo = First();
81 	while (pInfo)
82 	{
83 		const ByteString* pStr = pInfo->GetVersion();
84 		if (*pStr == rVersion)
85 		{
86 			Remove (pInfo);
87 			delete pInfo;
88 			return;
89 		}
90 		pInfo = Next();
91 	}
92 }
93 
94 /*****************************************************************************/
InsertVersion(ByteString & rVersion)95 VersionDepInfo*	VersionDepInfoList::InsertVersion (ByteString& rVersion)
96 /*****************************************************************************/
97 {
98 	VersionDepInfo* pInfo = First();
99 	while (pInfo)
100 	{
101 		const ByteString* pStr = pInfo->GetVersion();
102 		if (*pStr == rVersion)
103 		{
104 			pInfo->Clear();
105 			return pInfo;
106 		}
107 		pInfo = Next();
108 	}
109 	pInfo = new VersionDepInfo (rVersion);
110 	Insert (pInfo, LIST_APPEND);
111 	return pInfo;
112 }
113