sbLibraryChangeset.h
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2011 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
30 #ifndef __SB_LIBRARYCHANGESET_H__
31 #define __SB_LIBRARYCHANGESET_H__
32 
33 #include <sbILibraryChangeset.h>
34 
35 #include <nsIArray.h>
36 #include <nsIClassInfo.h>
37 #include <sbIMediaItem.h>
38 
39 #include <nsCOMPtr.h>
40 #include <nsStringGlue.h>
41 
42 #define SB_PROPERTY_CHANGE_IID \
43 { 0x2cb3d75f, 0xfd37, 0x4ae0, { 0xa7, 0xf1, 0xe8, 0x5c, 0x7b, 0xb9, 0xd1, 0x7b } }
44 
45 #define SB_LIBRARY_CHANGE_IID \
46 { 0x681aebb6, 0xa22c, 0x491f, { 0x9b, 0xc1, 0xc0, 0xa6, 0x2, 0x1d, 0xee, 0xc5 } }
47 
48 #define SB_LIBRARY_CHANGESET_IID \
49 { 0x4597d14e, 0x4130, 0x4438, { 0xb7, 0xbd, 0x5d, 0x9c, 0x1b, 0x8c, 0xb7, 0x7b } }
50 
52  public nsIClassInfo
53 {
54 public:
56  NS_DECL_SBICHANGEOPERATION
57  NS_DECL_SBIPROPERTYCHANGE
58  NS_DECL_NSICLASSINFO
59  NS_DECLARE_STATIC_IID_ACCESSOR(SB_PROPERTY_CHANGE_IID)
60 
62 
63  nsresult InitWithValues(PRUint32 aOperation,
64  const nsAString &aID,
65  const nsAString &aOldValue,
66  const nsAString &aNewValue);
67 
68  nsresult SetOperation(PRUint32 aOperation);
69 
70  nsresult SetID(const nsAString &aID);
71 
72  nsresult SetOldValue(const nsAString &aOldValue);
73  nsresult SetNewValue(const nsAString &aNewValue);
74 
75 private:
76  ~sbPropertyChange();
77 
78 protected:
79  PRUint32 mOperation;
80 
81  nsString mID;
82 
83  nsString mOldValue;
84  nsString mNewValue;
85 };
86 
87 NS_DEFINE_STATIC_IID_ACCESSOR(sbPropertyChange,
89 
90 class sbLibraryChange : public sbILibraryChange,
91  public nsIClassInfo
92 {
93 public:
95  NS_DECL_SBICHANGEOPERATION
96  NS_DECL_SBILIBRARYCHANGE
97  NS_DECL_NSICLASSINFO
98  NS_DECLARE_STATIC_IID_ACCESSOR(SB_LIBRARY_CHANGE_IID)
99 
100  sbLibraryChange();
101 
102  nsresult InitWithValues(PRUint32 aOperation,
103  PRUint64 aTimestamp,
104  sbIMediaItem *aSourceItem,
105  sbIMediaItem *aDestinationItem,
106  nsIArray *aProperties,
107  nsIArray *aListItems);
108 
109  nsresult SetOperation(PRUint32 aOperation);
110 
111  nsresult SetTimestamp(PRUint64 aTimestamp);
112  nsresult SetItems(sbIMediaItem *aSourceItem,
113  sbIMediaItem *aDestinationItem);
114  nsresult SetProperties(nsIArray *aProperties);
115  nsresult SetListItems(nsIArray *aProperties);
116 
117 private:
118  ~sbLibraryChange();
119 
120 protected:
121  PRUint32 mOperation;
122 
123  PRUint64 mTimestamp;
124 
125  nsCOMPtr<sbIMediaItem> mSourceItem;
126  nsCOMPtr<sbIMediaItem> mDestinationItem;
127 
128  nsCOMPtr<nsIArray> mProperties;
129  nsCOMPtr<nsIArray> mListItems;
130 };
131 
132 NS_DEFINE_STATIC_IID_ACCESSOR(sbLibraryChange,
134 
135 class sbLibraryChangeset : public sbILibraryChangeset,
136  public nsIClassInfo
137 {
138 public:
140  NS_DECL_NSICLASSINFO
141  NS_DECL_SBILIBRARYCHANGESET
142  NS_DECLARE_STATIC_IID_ACCESSOR(SB_LIBRARY_CHANGESET_IID)
143 
144  sbLibraryChangeset();
145 
146  nsresult InitWithValues(nsIArray *aSourceLists,
147  sbIMediaList *aDestinationList,
148  nsIArray *aChanges);
149 
150  nsresult SetSourceLists(nsIArray *aSourceLists);
151  nsresult SetDestinationList(sbIMediaList *aDestinationList);
152 
153 private:
154  ~sbLibraryChangeset();
155 
156 protected:
157  nsCOMPtr<nsIArray> mSourceLists;
158 
159  nsCOMPtr<sbIMediaList> mDestinationList;
160 
161  nsCOMPtr<nsIArray> mChanges;
162 };
163 
164 NS_DEFINE_STATIC_IID_ACCESSOR(sbLibraryChangeset,
166 
167 #endif /* __SB_LIBRARYCHANGESET_H__ */
nsresult SetOldValue(const nsAString &aOldValue)
nsresult SetOperation(PRUint32 aOperation)
nsCOMPtr< nsIArray > mProperties
nsCOMPtr< nsIArray > mChanges
nsresult SetID(const nsAString &aID)
A brief description of the contents of this interface.
#define SB_PROPERTY_CHANGE_IID
PRUint32 mOperation
NS_DECL_ISUPPORTS NS_DECL_SBICHANGEOPERATION NS_DECL_SBIPROPERTYCHANGE NS_DECL_NSICLASSINFO sbPropertyChange()
NS_DEFINE_STATIC_IID_ACCESSOR(sbPropertyChange,{0x2cb3d75f, 0xfd37, 0x4ae0,{0xa7, 0xf1, 0xe8, 0x5c, 0x7b, 0xb9, 0xd1, 0x7b}}) class sbLibraryChange nsresult InitWithValues(PRUint32 aOperation, PRUint64 aTimestamp, sbIMediaItem *aSourceItem, sbIMediaItem *aDestinationItem, nsIArray *aProperties, nsIArray *aListItems)
#define SB_LIBRARY_CHANGESET_IID
nsresult SetItems(sbIMediaItem *aSourceItem, sbIMediaItem *aDestinationItem)
nsCOMPtr< sbIMediaItem > mSourceItem
nsresult SetListItems(nsIArray *aProperties)
nsCOMPtr< nsIArray > mListItems
nsresult SetNewValue(const nsAString &aNewValue)
PRUint64 mTimestamp
nsresult SetSourceLists(nsIArray *aSourceLists)
nsCOMPtr< sbIMediaList > mDestinationList
nsCOMPtr< nsIArray > mSourceLists
#define SB_LIBRARY_CHANGE_IID
nsresult InitWithValues(PRUint32 aOperation, const nsAString &aID, const nsAString &aOldValue, const nsAString &aNewValue)
nsresult SetOperation(PRUint32 aOperation)
Interface that defines a single item of media in the system.
nsresult SetTimestamp(PRUint64 aTimestamp)
nsresult SetProperties(nsIArray *aProperties)
nsresult SetDestinationList(sbIMediaList *aDestinationList)
nsCOMPtr< sbIMediaItem > mDestinationItem