-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #702 from meganz/release/v3.1.5
Release/v3.1.5
- Loading branch information
Showing
62 changed files
with
2,041 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* @file MEGAEvent.h | ||
* @brief Provides information about an event | ||
* | ||
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand | ||
* | ||
* This file is part of the MEGA SDK - Client Access Engine. | ||
* | ||
* Applications using the MEGA API must present a valid application key | ||
* and comply with the the rules set forth in the Terms of Service. | ||
* | ||
* The MEGA SDK is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* @copyright Simplified (2-clause) BSD License. | ||
* | ||
* You should have received a copy of the license along with this | ||
* program. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
typedef NS_ENUM(NSUInteger, Event) { | ||
EventCommitDB, | ||
EventAccountConfirmation = 1 | ||
}; | ||
|
||
/** | ||
* @brief Provides information about an event | ||
* | ||
* Objects of this class aren't live, they are snapshots of the state of the event | ||
* when the object is created, they are immutable. | ||
*/ | ||
@interface MEGAEvent : NSObject | ||
|
||
/** | ||
* @brief The type of the event associated with the object | ||
*/ | ||
@property (nonatomic, readonly) Event type; | ||
|
||
/** | ||
* @brief Text relative to this event | ||
*/ | ||
@property (nonatomic, readonly) NSString *text; | ||
|
||
/** | ||
* @brief Creates a copy of this MEGAEvent object | ||
* | ||
* The resulting object is fully independent of the source MEGAEvent, | ||
* it contains a copy of all internal attributes, so it will be valid after | ||
* the original object is deleted. | ||
* | ||
* You are the owner of the returned object | ||
* | ||
* @return Copy of the MEGAEvent object | ||
*/ | ||
- (instancetype)clone; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* @file MEGAEvent.mm | ||
* @brief Provides information about an event | ||
* | ||
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand | ||
* | ||
* This file is part of the MEGA SDK - Client Access Engine. | ||
* | ||
* Applications using the MEGA API must present a valid application key | ||
* and comply with the the rules set forth in the Terms of Service. | ||
* | ||
* The MEGA SDK is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* @copyright Simplified (2-clause) BSD License. | ||
* | ||
* You should have received a copy of the license along with this | ||
* program. | ||
*/ | ||
|
||
#import "MEGAEvent.h" | ||
#import "megaapi.h" | ||
|
||
using namespace mega; | ||
|
||
@interface MEGAEvent () | ||
|
||
@property MegaEvent *megaEvent; | ||
@property BOOL cMemoryOwn; | ||
|
||
@end | ||
|
||
@implementation MEGAEvent | ||
|
||
- (instancetype)initWithMegaEvent:(MegaEvent *)megaEvent cMemoryOwn:(BOOL)cMemoryOwn { | ||
self = [super init]; | ||
|
||
if (self) { | ||
_megaEvent = megaEvent; | ||
_cMemoryOwn = cMemoryOwn; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)dealloc { | ||
if (self.cMemoryOwn) { | ||
delete _megaEvent; | ||
} | ||
} | ||
|
||
- (instancetype)clone { | ||
return self.megaEvent ? [[MEGAEvent alloc] initWithMegaEvent:self.megaEvent->copy() cMemoryOwn:YES] : nil; | ||
} | ||
|
||
- (MegaEvent *)getCPtr { | ||
return self.megaEvent; | ||
} | ||
|
||
- (Event)type { | ||
return (Event) (self.megaEvent ? self.megaEvent->getType() : 0); | ||
} | ||
|
||
- (NSString *)text { | ||
return self.megaEvent ? [[NSString alloc] initWithUTF8String:self.megaEvent->getText()] : nil; | ||
} | ||
|
||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* @file MEGAHandleList.h | ||
* @brief List of MegaHandle | ||
* | ||
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand | ||
* | ||
* This file is part of the MEGA SDK - Client Access Engine. | ||
* | ||
* Applications using the MEGA API must present a valid application key | ||
* and comply with the the rules set forth in the Terms of Service. | ||
* | ||
* The MEGA SDK is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* @copyright Simplified (2-clause) BSD License. | ||
* | ||
* You should have received a copy of the license along with this | ||
* program. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/** | ||
* @brief List of MegaHandle objects | ||
* | ||
*/ | ||
@interface MEGAHandleList : NSObject | ||
|
||
/** | ||
* @brief The number of handles in the list | ||
*/ | ||
@property (readonly, nonatomic) NSUInteger size; | ||
|
||
/** | ||
* @brief Creates a copy of this MEGAHandleList object | ||
* | ||
* The resulting object is fully independent of the source MEGAHandleList, | ||
* it contains a copy of all internal attributes, so it will be valid after | ||
* the original object is deleted. | ||
* | ||
* You are the owner of the returned object | ||
* | ||
* @return Copy of the MEGAHandleList object | ||
*/ | ||
- (instancetype)clone; | ||
|
||
/** | ||
* @brief Add new handle to handleList | ||
* @param handle to be added. | ||
*/ | ||
- (void)addMegaHandle:(uint64_t)handle; | ||
|
||
/** | ||
* @brief Returns the MegaHandle at the position index in the MEGAHandleList | ||
* | ||
* | ||
* If the index is >= the size of the list, this function returns INVALID_HANDLE. | ||
* | ||
* @param index Position of the MegaHandle that we want to get for the list | ||
* @return handle at the position iindex in the list | ||
*/ | ||
- (uint64_t)megaHandleAtIndex:(NSUInteger)index; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* @file MEGAHandleList.mm | ||
* @brief List of MegaHandle | ||
* | ||
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand | ||
* | ||
* This file is part of the MEGA SDK - Client Access Engine. | ||
* | ||
* Applications using the MEGA API must present a valid application key | ||
* and comply with the the rules set forth in the Terms of Service. | ||
* | ||
* The MEGA SDK is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* @copyright Simplified (2-clause) BSD License. | ||
* | ||
* You should have received a copy of the license along with this | ||
* program. | ||
*/ | ||
|
||
#import "MEGAHandleList.h" | ||
#import "megaapi.h" | ||
|
||
using namespace mega; | ||
|
||
@interface MEGAHandleList () | ||
|
||
@property MegaHandleList *megaHandleList; | ||
@property BOOL cMemoryOwn; | ||
|
||
@end | ||
|
||
@implementation MEGAHandleList | ||
|
||
- (instancetype)init { | ||
self = [super init]; | ||
|
||
if (self != nil) { | ||
_megaHandleList = MegaHandleList::createInstance(); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (instancetype)initWithMegaHandleList:(MegaHandleList *)megaHandleList cMemoryOwn:(BOOL)cMemoryOwn { | ||
self = [super init]; | ||
|
||
if (self) { | ||
_megaHandleList = megaHandleList; | ||
_cMemoryOwn = cMemoryOwn; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)dealloc { | ||
if (self.cMemoryOwn) { | ||
delete _megaHandleList; | ||
} | ||
} | ||
|
||
- (instancetype)clone { | ||
return self.megaHandleList ? [[MEGAHandleList alloc] initWithMegaHandleList:self.megaHandleList cMemoryOwn:YES] : nil; | ||
} | ||
|
||
- (MegaHandleList *)getCPtr { | ||
return self.megaHandleList; | ||
} | ||
|
||
- (NSString *)description { | ||
return [NSString stringWithFormat:@"<%@: size=%ld>", | ||
[self class], (long)self.size]; | ||
} | ||
|
||
- (NSUInteger)size { | ||
return self.megaHandleList ? self.megaHandleList->size() : 0; | ||
} | ||
|
||
- (void)addMegaHandle:(uint64_t)handle { | ||
if (!self.megaHandleList) return; | ||
self.megaHandleList->addMegaHandle(handle); | ||
} | ||
|
||
- (uint64_t)megaHandleAtIndex:(NSUInteger)index { | ||
return self.megaHandleList ? self.megaHandleList->get((unsigned int)index) : INVALID_HANDLE; | ||
} | ||
|
||
@end |
Oops, something went wrong.