1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <ingo_weinhold@gmx.de> 7 */ 8 #ifndef _PACKAGE__PRIVATE__ACTIVATION_TRANSACTION_H_ 9 #define _PACKAGE__PRIVATE__ACTIVATION_TRANSACTION_H_ 10 11 12 #include <Archivable.h> 13 #include <package/PackageDefs.h> 14 #include <StringList.h> 15 16 17 namespace BPackageKit { 18 namespace BPrivate { 19 20 21 class BActivationTransaction : public BArchivable { 22 public: 23 BActivationTransaction(); 24 BActivationTransaction(BMessage* archive, 25 status_t* _error = NULL); 26 virtual ~BActivationTransaction(); 27 28 status_t SetTo(BPackageInstallationLocation location, 29 int64 changeCount, 30 const BString& directoryName); 31 32 status_t InitCheck() const; 33 34 BPackageInstallationLocation Location() const; 35 void SetLocation( 36 BPackageInstallationLocation location); 37 38 int64 ChangeCount() const; 39 void SetChangeCount(int64 changeCount); 40 41 const BString& TransactionDirectoryName() const; 42 void SetTransactionDirectoryName( 43 const BString& directoryName); 44 45 const BStringList& PackagesToActivate() const; 46 bool SetPackagesToActivate( 47 const BStringList& packages); 48 bool AddPackageToActivate(const BString& package); 49 50 const BStringList& PackagesToDeactivate() const; 51 bool SetPackagesToDeactivate( 52 const BStringList& packages); 53 bool AddPackageToDeactivate(const BString& package); 54 55 virtual status_t Archive(BMessage* archive, 56 bool deep = true) const; 57 static BArchivable* Instantiate(BMessage* archive); 58 59 private: 60 static status_t _ExtractStringList(BMessage* archive, 61 const char* field, BStringList& _list); 62 63 private: 64 BPackageInstallationLocation fLocation; 65 int64 fChangeCount; 66 BString fTransactionDirectoryName; 67 BStringList fPackagesToActivate; 68 BStringList fPackagesToDeactivate; 69 }; 70 71 72 } // namespace BPrivate 73 } // namespace BPackageKit 74 75 76 #endif // _PACKAGE__PRIVATE__ACTIVATION_TRANSACTION_H_ 77