Commiting implementation of NSDataLink.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18471 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-01-24 20:12:04 +00:00
parent d99febaf24
commit af88bed81e
3 changed files with 85 additions and 26 deletions

View file

@ -1,6 +1,11 @@
2004-01-24 15:17 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/AppKit/NSDataLink.h: Added ivars.
* Source/NSDataLink.m: Added implementation of some methods.
2004-01-23 21:32 Gregory John Casamento <greg_casamento@yahoo.com>
* GSNibTemplates.m: Removal of some commented out test code.
* Source/GSNibTemplates.m: Removal of some commented out test code.
2004-01-22 13:15 Alexander Malmberg <alexander@malmberg.org>

View file

@ -60,6 +60,24 @@ APPKIT_EXPORT NSString *NSDataLinkFileNameExtension;
@interface NSDataLink : NSObject <NSCoding>
{
// Attributes
@private
// link info.
NSDataLinkNumber linkNumber;
NSDataLinkDisposition disposition;
NSDataLinkUpdateMode updateMode;
NSDataLinkManager *manager;
// info about the source.
NSDate *lastUpdateTime;
NSString *sourceApplicationName;
NSString *sourceFilename;
NSSelection *sourceSelection;
NSArray *types;
// info about the destination
NSString *destinationApplicationName;
NSString *destinationFilename;
NSSelection *destinationSelection;
}
//
@ -111,13 +129,6 @@ APPKIT_EXPORT NSString *NSDataLinkFileNameExtension;
- (void)setUpdateMode:(NSDataLinkUpdateMode)mode;
- (BOOL)updateDestination;
- (NSDataLinkUpdateMode)updateMode;
//
// NSCoding protocol
//
- (void)encodeWithCoder: (NSCoder *)aCoder;
- initWithCoder: (NSCoder *)aDecoder;
@end
#endif // _GNUstep_H_NSDataLink

View file

@ -37,7 +37,7 @@
if (self == [NSDataLink class])
{
// Initial version
[self setVersion:1];
[self setVersion: 1];
}
}
@ -54,9 +54,15 @@
- (id)initLinkedToSourceSelection:(NSSelection *)selection
managedBy:(NSDataLinkManager *)linkManager
supportingTypes:(NSArray *)newTypes
supportingTypes:(NSArray *)newTypes
{
return nil;
if((self = [self init]) != nil)
{
ASSIGN(sourceSelection,selection);
ASSIGN(manager,linkManager);
ASSIGN(types,newTypes);
}
return self;
}
- (id)initWithContentsOfFile:(NSString *)filename
@ -90,17 +96,17 @@ supportingTypes:(NSArray *)newTypes
//
- (NSDataLinkDisposition)disposition
{
return 0;
return disposition;
}
- (NSDataLinkNumber)linkNumber
{
return 0;
return linkNumber;
}
- (NSDataLinkManager *)manager
{
return nil;
return manager;
}
//
@ -108,7 +114,7 @@ supportingTypes:(NSArray *)newTypes
//
- (NSDate *)lastUpdateTime
{
return nil;
return lastUpdateTime;
}
- (BOOL)openSource
@ -118,22 +124,22 @@ supportingTypes:(NSArray *)newTypes
- (NSString *)sourceApplicationName
{
return nil;
return sourceApplicationName;
}
- (NSString *)sourceFilename
{
return nil;
return sourceFilename;
}
- (NSSelection *)sourceSelection
{
return nil;
return sourceSelection;
}
- (NSArray *)types
{
return nil;
return types;
}
//
@ -141,17 +147,17 @@ supportingTypes:(NSArray *)newTypes
//
- (NSString *)destinationApplicationName
{
return nil;
return destinationApplicationName;
}
- (NSString *)destinationFilename
{
return nil;
return destinationFilename;
}
- (NSSelection *)destinationSelection
{
return nil;
return destinationSelection;
}
//
@ -163,10 +169,13 @@ supportingTypes:(NSArray *)newTypes
}
- (void)noteSourceEdited
{}
{
}
- (void)setUpdateMode:(NSDataLinkUpdateMode)mode
{}
{
updateMode = mode;
}
- (BOOL)updateDestination
{
@ -175,7 +184,7 @@ supportingTypes:(NSArray *)newTypes
- (NSDataLinkUpdateMode)updateMode
{
return 0;
return updateMode;
}
//
@ -183,10 +192,44 @@ supportingTypes:(NSArray *)newTypes
//
- (void) encodeWithCoder: (NSCoder*)aCoder
{
[aCoder encodeValueOfObjCType: @encode(int) at: &linkNumber];
[aCoder encodeValueOfObjCType: @encode(int) at: &disposition];
[aCoder encodeValueOfObjCType: @encode(int) at: &updateMode];
[aCoder encodeValueOfObjCType: @encode(id) at: &manager];
[aCoder encodeValueOfObjCType: @encode(id) at: &lastUpdateTime];
[aCoder encodeValueOfObjCType: @encode(id) at: &sourceApplicationName];
[aCoder encodeValueOfObjCType: @encode(id) at: &sourceFilename];
[aCoder encodeValueOfObjCType: @encode(id) at: &sourceSelection];
[aCoder encodeValueOfObjCType: @encode(id) at: &types];
[aCoder encodeValueOfObjCType: @encode(id) at: &destinationApplicationName];
[aCoder encodeValueOfObjCType: @encode(id) at: &destinationFilename];
[aCoder encodeValueOfObjCType: @encode(id) at: &destinationSelection];
}
- (id) initWithCoder: (NSCoder*)aDecoder
- (id) initWithCoder: (NSCoder*)aCoder
{
int version = [aCoder versionForClassName: @"NSDataLink"];
if(version == 1)
{
[aCoder decodeValueOfObjCType: @encode(int) at: &linkNumber];
[aCoder decodeValueOfObjCType: @encode(int) at: &disposition];
[aCoder decodeValueOfObjCType: @encode(int) at: &updateMode];
[aCoder decodeValueOfObjCType: @encode(id) at: &manager];
[aCoder decodeValueOfObjCType: @encode(id) at: &lastUpdateTime];
[aCoder decodeValueOfObjCType: @encode(id) at: &sourceApplicationName];
[aCoder decodeValueOfObjCType: @encode(id) at: &sourceFilename];
[aCoder decodeValueOfObjCType: @encode(id) at: &sourceSelection];
[aCoder decodeValueOfObjCType: @encode(id) at: &types];
[aCoder decodeValueOfObjCType: @encode(id) at: &destinationApplicationName];
[aCoder decodeValueOfObjCType: @encode(id) at: &destinationFilename];
[aCoder decodeValueOfObjCType: @encode(id) at: &destinationSelection];
}
else
{
NSLog(@"No decoder for NSDataLink version #%d",version);
}
return self;
}