25 #ifndef __SBLOCALDATABASESIMPLEMEDIALIST_H__
26 #define __SBLOCALDATABASESIMPLEMEDIALIST_H__
29 #include <sbILocalDatabaseSimpleMediaList.h>
30 #include <sbIMediaListListener.h>
31 #include <sbIOrderableMediaList.h>
32 #include <nsIClassInfo.h>
34 #include <nsStringGlue.h>
35 #include <nsCOMArray.h>
36 #include <nsHashKeys.h>
37 #include <nsInterfaceHashtable.h>
38 #include <nsTHashtable.h>
41 class nsIMutableArray;
59 NS_DECL_ISUPPORTS_INHERITED
61 NS_DECL_SBILOCALDATABASESIMPLEMEDIALIST
62 NS_DECL_SBIORDERABLEMEDIALIST
68 const nsAString& aGuid);
71 NS_IMETHOD
GetType(nsAString& aType);
90 PRUint32 aStartingIndex,
91 nsAString& aStartingOrdinal);
94 nsresult UpdateLastModifiedTime();
96 nsresult ExecuteAggregateQuery(
const nsAString& aQuery, nsAString&
aValue);
98 nsresult UpdateOrdinalByIndex(PRUint32 aIndex,
const nsAString& aOrdinal);
100 nsresult MoveSomeInternal(PRUint32* aFromIndexArray,
101 PRUint32 aFromIndexArrayCount,
103 const nsAString& aOrdinalRoot);
105 nsresult GetNextOrdinal(nsAString&
aValue);
107 nsresult GetBeforeOrdinal(PRUint32 aIndex, nsAString&
aValue);
109 nsresult AddToLastPathSegment(nsAString&
aPath, PRInt32 aToAdd);
111 PRUint32 CountLevels(
const nsAString&
aPath);
113 nsresult CreateQueries();
121 nsString mGetMediaItemIdForGuidQuery;
124 nsString mInsertIntoListQuery;
127 nsString mUpdateListItemOrdinalQuery;
130 nsString mDeleteFirstListItemQuery;
133 nsString mDeleteAllQuery;
136 nsString mDeleteListItemByOrdinalQuery;
139 nsString mGetLastOrdinalQuery;
142 nsString mGetFirstOrdinalQuery;
145 nsCOMPtr<sbILocalDatabaseMediaListCopyListener> mCopyListener;
148 nsTHashtable<nsStringHashKey> mShouldNotifyAfterRemove;
162 NS_DECL_SBIMEDIALISTENUMERATIONLISTENER
165 PRUint32 aStartingIndex,
166 const nsAString& aStartingOrdinal,
168 : mFriendList(aList),
169 mStartingIndex(aStartingIndex),
170 mStartingOrdinal(aStartingOrdinal)
173 mAsyncListener = do_QueryInterface(aListener);
174 mAddListener = do_QueryInterface(aListener);
181 static void*
operator new(
size_t ) CPP_THROW_NEW {
return 0; }
182 static void operator delete(
void* ) { }
185 PRUint32 mStartingIndex;
186 nsString mStartingOrdinal;
192 nsCOMArray<sbIMediaItem> mItemList;
199 nsInterfaceHashtable<nsISupportsHashKey, sbIMediaItem> mItemsToCreateOrAdd;
200 nsCOMPtr<sbILibrary> mListLibrary;
201 nsCOMPtr<sbIAddMediaItemsListener> mAddListener;
202 nsCOMPtr<sbIMediaListAsyncListener> mAsyncListener;
208 nsresult UpdateItemsInForeignLib(nsIArray * aExistingItems,
209 nsIArray * aNewItems);
216 NS_DECL_SBIMEDIALISTENUMERATIONLISTENER
219 : mFriendList(aList),
220 mItemEnumerated(PR_FALSE)
222 NS_ASSERTION(mFriendList,
"Null pointer!");
228 static void*
operator new(
size_t ) CPP_THROW_NEW {
return 0; }
229 static void operator delete(
void* ) { }
232 nsCOMPtr<sbIDatabaseQuery> mDBQuery;
233 nsCOMArray<sbIMediaItem> mNotificationList;
234 nsTArray<PRUint32> mNotificationIndexes;
235 PRBool mItemEnumerated;
[USER CODE SHOULD NOT REFERENCE THIS CLASS]
An object responsible for executing SQL queries on the database.