1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-02 09:27:55 +01:00
Telegram/Telegraph/TGDocumentAttributeFilename.m
2015-10-01 19:19:52 +03:00

44 lines
981 B
Objective-C

#import "TGDocumentAttributeFilename.h"
#import "PSKeyValueCoder.h"
@implementation TGDocumentAttributeFilename
- (instancetype)initWithFilename:(NSString *)filename
{
self = [super init];
if (self != nil)
{
_filename = filename;
}
return self;
}
- (instancetype)initWithKeyValueCoder:(PSKeyValueCoder *)coder
{
return [self initWithFilename:[coder decodeStringForCKey:"f"]];
}
- (void)encodeWithKeyValueCoder:(PSKeyValueCoder *)coder
{
[coder encodeString:_filename forCKey:"f"];
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
return [self initWithFilename:[aDecoder decodeObjectForKey:@"filename"]];
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
if (_filename != nil)
[aCoder encodeObject:_filename forKey:@"filename"];
}
- (BOOL)isEqual:(id)object
{
return [object isKindOfClass:[TGDocumentAttributeFilename class]] && TGObjectCompare(_filename, ((TGDocumentAttributeFilename *)object)->_filename);
}
@end