29 #include <sbILibraryConstraints.h>
30 #include <sbIPropertyArray.h>
32 #include <nsIClassInfoImpl.h>
33 #include <nsIObjectInputStream.h>
34 #include <nsIObjectOutputStream.h>
35 #include <nsIMutableArray.h>
36 #include <nsIProgrammingLanguage.h>
37 #include <nsArrayUtils.h>
38 #include <nsComponentManagerUtils.h>
56 sbLocalDatabaseMediaListViewState::sbLocalDatabaseMediaListViewState() :
75 NS_ASSERTION(aSort,
"aSort is null");
83 NS_ENSURE_ARG_POINTER(aSort);
85 NS_ADDREF(*aSort =
mSort);
93 NS_ENSURE_ARG_POINTER(aSearch);
95 NS_IF_ADDREF(*aSearch =
mSearch);
103 NS_ENSURE_ARG_POINTER(aFilter);
105 NS_IF_ADDREF(*aFilter =
mFilter);
113 NS_ENSURE_ARG_POINTER(aSelection);
123 NS_ENSURE_ARG_POINTER(aFilterSet);
133 NS_ENSURE_ARG_POINTER(aTreeViewState);
149 buff.AppendLiteral(
"sort: ");
150 rv =
mSort->ToString(temp);
151 NS_ENSURE_SUCCESS(rv, rv);
154 buff.AppendLiteral(
" search: ");
157 NS_ENSURE_SUCCESS(rv, rv);
161 buff.AppendLiteral(
"null");
164 buff.AppendLiteral(
" filter: ");
167 NS_ENSURE_SUCCESS(rv, rv);
171 buff.AppendLiteral(
"null");
174 buff.AppendLiteral(
" selection: ");
177 NS_ENSURE_SUCCESS(rv, rv);
181 buff.AppendLiteral(
"null");
184 buff.AppendLiteral(
" filterSet: [");
187 NS_ENSURE_SUCCESS(rv, rv);
190 buff.AppendLiteral(
"]");
192 buff.AppendLiteral(
" treeView: [");
195 NS_ENSURE_SUCCESS(rv, rv);
198 buff.AppendLiteral(
"]");
207 sbLocalDatabaseMediaListViewState::Read(nsIObjectInputStream* aStream)
209 NS_ENSURE_ARG_POINTER(aStream);
213 nsCOMPtr<nsISupports> supports;
215 rv = aStream->ReadObject(PR_TRUE, getter_AddRefs(supports));
216 NS_ENSURE_SUCCESS(rv, rv);
217 mSort = do_QueryInterface(supports, &rv);
218 NS_ENSURE_SUCCESS(rv, rv);
221 rv = aStream->ReadBoolean(&hasSearch);
222 NS_ENSURE_SUCCESS(rv, rv);
225 rv = aStream->ReadObject(PR_TRUE, getter_AddRefs(supports));
226 NS_ENSURE_SUCCESS(rv, rv);
227 mSearch = do_QueryInterface(supports, &rv);
228 NS_ENSURE_SUCCESS(rv, rv);
232 rv = aStream->ReadBoolean(&hasFilter);
233 NS_ENSURE_SUCCESS(rv, rv);
236 rv = aStream->ReadObject(PR_TRUE, getter_AddRefs(supports));
237 NS_ENSURE_SUCCESS(rv, rv);
238 mFilter = do_QueryInterface(supports, &rv);
239 NS_ENSURE_SUCCESS(rv, rv);
243 NS_ENSURE_TRUE(
mSelection, NS_ERROR_OUT_OF_MEMORY);
246 NS_ENSURE_SUCCESS(rv, rv);
249 NS_ENSURE_SUCCESS(rv, rv);
252 rv = aStream->ReadBoolean(&hasFilterSet);
253 NS_ENSURE_SUCCESS(rv, rv);
257 NS_ENSURE_TRUE(
mFilterSet, NS_ERROR_OUT_OF_MEMORY);
260 NS_ENSURE_SUCCESS(rv, rv);
263 PRBool hasTreeViewState;
264 rv = aStream->ReadBoolean(&hasTreeViewState);
265 NS_ENSURE_SUCCESS(rv, rv);
267 if (hasTreeViewState) {
272 NS_ENSURE_SUCCESS(rv, rv);
275 NS_ENSURE_SUCCESS(rv, rv);
284 sbLocalDatabaseMediaListViewState::Write(nsIObjectOutputStream* aStream)
287 NS_ENSURE_ARG_POINTER(aStream);
291 rv = aStream->WriteObject(
mSort, PR_TRUE);
292 NS_ENSURE_SUCCESS(rv, rv);
295 rv = aStream->WriteBoolean(PR_TRUE);
296 NS_ENSURE_SUCCESS(rv, rv);
297 rv = aStream->WriteObject(
mSearch, PR_TRUE);
298 NS_ENSURE_SUCCESS(rv, rv);
301 rv = aStream->WriteBoolean(PR_FALSE);
302 NS_ENSURE_SUCCESS(rv, rv);
306 rv = aStream->WriteBoolean(PR_TRUE);
307 NS_ENSURE_SUCCESS(rv, rv);
308 rv = aStream->WriteObject(
mFilter, PR_TRUE);
309 NS_ENSURE_SUCCESS(rv, rv);
312 rv = aStream->WriteBoolean(PR_FALSE);
313 NS_ENSURE_SUCCESS(rv, rv);
317 NS_ENSURE_SUCCESS(rv, rv);
320 rv = aStream->WriteBoolean(PR_TRUE);
321 NS_ENSURE_SUCCESS(rv, rv);
323 NS_ENSURE_SUCCESS(rv, rv);
326 rv = aStream->WriteBoolean(PR_FALSE);
327 NS_ENSURE_SUCCESS(rv, rv);
331 rv = aStream->WriteBoolean(PR_TRUE);
332 NS_ENSURE_SUCCESS(rv, rv);
334 NS_ENSURE_SUCCESS(rv, rv);
337 rv = aStream->WriteBoolean(PR_FALSE);
338 NS_ENSURE_SUCCESS(rv, rv);
346 sbLocalDatabaseMediaListViewState::GetInterfaces(PRUint32*
count, nsIID***
array)
352 sbLocalDatabaseMediaListViewState::GetHelperForLanguage(PRUint32
language,
360 sbLocalDatabaseMediaListViewState::GetContractID(
char** aContractID)
362 *aContractID = nsnull;
367 sbLocalDatabaseMediaListViewState::GetClassDescription(
char** aClassDescription)
369 *aClassDescription = nsnull;
374 sbLocalDatabaseMediaListViewState::GetClassID(nsCID** aClassID)
381 sbLocalDatabaseMediaListViewState::GetImplementationLanguage(PRUint32* aImplementationLanguage)
383 *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
388 sbLocalDatabaseMediaListViewState::GetFlags(PRUint32 *aFlags)
395 sbLocalDatabaseMediaListViewState::GetClassIDNoAlloc(nsCID* aClassIDNoAlloc)
397 NS_ENSURE_ARG_POINTER(aClassIDNoAlloc);
398 *aClassIDNoAlloc = kMediaListViewStateCID;
static nsresult ToString(const nsDiscriminatedUnion &data, nsACString &outString)
An interface to carry around arrays of nsIProperty instances Note that implementations of the interfa...
#define SB_LOCALDATABASE_MEDIALISTVIEWSTATE_CID