2014 snapchat source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

180 lines
5.1 KiB

// ed265cb0c346ae35dce70d3fc12a0bd8deae0802
// Generated by the value-object.rb DO NOT EDIT!!
#import "SCManagedRecordedVideo.h"
#import <FastCoding/FastCoder.h>
@implementation SCManagedRecordedVideo
- (instancetype)initWithVideoURL:(NSURL *)videoURL
rawVideoDataFileURL:(NSURL *)rawVideoDataFileURL
placeholderImage:(UIImage *)placeholderImage
isFrontFacingCamera:(BOOL)isFrontFacingCamera
{
self = [super init];
if (self) {
_videoURL = [(NSObject *)videoURL copy];
_rawVideoDataFileURL = [(NSObject *)rawVideoDataFileURL copy];
_placeholderImage = [(NSObject *)placeholderImage copy];
_isFrontFacingCamera = isFrontFacingCamera;
}
return self;
}
#pragma mark - NSCopying
- (instancetype)copyWithZone:(NSZone *)zone
{
// Immutable object, bypass copy
return self;
}
#pragma mark - NSCoding
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
if (self) {
_videoURL = [aDecoder decodeObjectForKey:@"videoURL"];
_rawVideoDataFileURL = [aDecoder decodeObjectForKey:@"rawVideoDataFileURL"];
_placeholderImage = [aDecoder decodeObjectForKey:@"placeholderImage"];
_isFrontFacingCamera = [aDecoder decodeBoolForKey:@"isFrontFacingCamera"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_videoURL forKey:@"videoURL"];
[aCoder encodeObject:_rawVideoDataFileURL forKey:@"rawVideoDataFileURL"];
[aCoder encodeObject:_placeholderImage forKey:@"placeholderImage"];
[aCoder encodeBool:_isFrontFacingCamera forKey:@"isFrontFacingCamera"];
}
#pragma mark - FasterCoding
- (BOOL)preferFasterCoding
{
return YES;
}
- (void)encodeWithFasterCoder:(id<FCFasterCoder>)fasterCoder
{
[fasterCoder encodeBool:_isFrontFacingCamera];
[fasterCoder encodeObject:_placeholderImage];
[fasterCoder encodeObject:_rawVideoDataFileURL];
[fasterCoder encodeObject:_videoURL];
}
- (void)decodeWithFasterDecoder:(id<FCFasterDecoder>)fasterDecoder
{
_isFrontFacingCamera = (BOOL)[fasterDecoder decodeBool];
_placeholderImage = (UIImage *)[fasterDecoder decodeObject];
_rawVideoDataFileURL = (NSURL *)[fasterDecoder decodeObject];
_videoURL = (NSURL *)[fasterDecoder decodeObject];
}
- (void)setObject:(id)val forUInt64Key:(uint64_t)key
{
switch (key) {
case 50783861721184594ULL:
_placeholderImage = (UIImage *)val;
break;
case 13152167848358790ULL:
_rawVideoDataFileURL = (NSURL *)val;
break;
case 48945309622713334ULL:
_videoURL = (NSURL *)val;
break;
}
}
- (void)setBool:(BOOL)val forUInt64Key:(uint64_t)key
{
switch (key) {
case 11924284868025312ULL:
_isFrontFacingCamera = (BOOL)val;
break;
}
}
+ (uint64_t)fasterCodingVersion
{
return 17435789727352013688ULL;
}
+ (uint64_t *)fasterCodingKeys
{
static uint64_t keys[] = {
4 /* Total */,
FC_ENCODE_KEY_TYPE(11924284868025312, FCEncodeTypeBool),
FC_ENCODE_KEY_TYPE(50783861721184594, FCEncodeTypeObject),
FC_ENCODE_KEY_TYPE(13152167848358790, FCEncodeTypeObject),
FC_ENCODE_KEY_TYPE(48945309622713334, FCEncodeTypeObject),
};
return keys;
}
#pragma mark - isEqual
- (BOOL)isEqual:(id)object
{
if (self == object) {
return YES;
}
if (![object isMemberOfClass:[self class]]) {
return NO;
}
SCManagedRecordedVideo *other = (SCManagedRecordedVideo *)object;
if (other.videoURL != _videoURL && ![(NSObject *)other.videoURL isEqual:_videoURL]) {
return NO;
}
if (other.rawVideoDataFileURL != _rawVideoDataFileURL &&
![(NSObject *)other.rawVideoDataFileURL isEqual:_rawVideoDataFileURL]) {
return NO;
}
if (other.placeholderImage != _placeholderImage &&
![(NSObject *)other.placeholderImage isEqual:_placeholderImage]) {
return NO;
}
if (other.isFrontFacingCamera != _isFrontFacingCamera) {
return NO;
}
return YES;
}
- (NSUInteger)hash
{
NSUInteger subhashes[] = {[_videoURL hash], [_rawVideoDataFileURL hash], [_placeholderImage hash],
(NSUInteger)_isFrontFacingCamera};
NSUInteger result = subhashes[0];
for (int i = 1; i < 4; i++) {
unsigned long long base = (((unsigned long long)result) << 32 | subhashes[i]);
base = (~base) + (base << 18);
base ^= (base >> 31);
base *= 21;
base ^= (base >> 11);
base += (base << 6);
base ^= (base >> 22);
result = (NSUInteger)base;
}
return result;
}
#pragma mark - Print description in console: lldb> po #{variable name}
- (NSString *)description
{
NSMutableString *desc = [NSMutableString string];
[desc appendString:@"{\n"];
[desc appendFormat:@"\tvideoURL:%@\n", [_videoURL description]];
[desc appendFormat:@"\trawVideoDataFileURL:%@\n", [_rawVideoDataFileURL description]];
[desc appendFormat:@"\tplaceholderImage:%@\n", [_placeholderImage description]];
[desc appendFormat:@"\tisFrontFacingCamera:%@\n", [@(_isFrontFacingCamera) description]];
[desc appendString:@"}\n"];
return [desc copy];
}
@end