mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 07:20:47 +00:00
Corrected FSF address and moved comment about NET-Community
support into SUPPORT file. Additional NSImage work. Added resources for common TIFF images. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@1869 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5f53cbb482
commit
9d24cda5cb
164 changed files with 656 additions and 920 deletions
|
@ -15,8 +15,9 @@
|
|||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# License along with this library; see the file COPYING.LIB.
|
||||
# If not, write to the Free Software Foundation, Inc.,
|
||||
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,111 +0,0 @@
|
|||
/* A demonstration of writing and reading with NSArchiver */
|
||||
|
||||
#include <objects/objects.h>
|
||||
#include <Foundation/NSArchiver.h>
|
||||
#include <Foundation/NSAutoreleasePool.h>
|
||||
|
||||
@interface TestClass : NSObject
|
||||
{
|
||||
id next_responder;
|
||||
}
|
||||
|
||||
- (void)setNextResponder: anObject;
|
||||
- nextResponder;
|
||||
@end
|
||||
|
||||
@implementation TestClass
|
||||
|
||||
- (void)setNextResponder: anObject
|
||||
{
|
||||
next_responder = anObject;
|
||||
}
|
||||
|
||||
- nextResponder
|
||||
{
|
||||
return next_responder;
|
||||
}
|
||||
|
||||
// NSCoding protocol
|
||||
- (void)encodeWithCoder:aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
[aCoder encodeObjectReference:next_responder withName:@"Next Responder"];
|
||||
}
|
||||
|
||||
- initWithCoder:aDecoder
|
||||
{
|
||||
id d;
|
||||
[super initWithCoder:aDecoder];
|
||||
[aDecoder decodeObjectAt:&next_responder withName:&d];
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
int main()
|
||||
{
|
||||
id arp;
|
||||
id r1, r2;
|
||||
|
||||
arp = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// Create a simple loop
|
||||
r1 = [[TestClass alloc] init];
|
||||
r2 = [[TestClass alloc] init];
|
||||
[r1 setNextResponder: r2];
|
||||
[r2 setNextResponder: r1];
|
||||
|
||||
printf("Writing\n");
|
||||
printf("%d\n", [r1 hash]);
|
||||
printf("%d\n", [r2 hash]);
|
||||
printf("%d\n", [[r1 nextResponder] hash]);
|
||||
printf("%d\n", [[r2 nextResponder] hash]);
|
||||
|
||||
//[Coder setDefaultCStreamClass: [TextCStream class]];
|
||||
|
||||
/* Write it to a file */
|
||||
{
|
||||
id d = [[NSMutableData alloc] init];
|
||||
id a = [[NSArchiver alloc] initForWritingWithMutableData: d];
|
||||
|
||||
[a startEncodingInterconnectedObjects];
|
||||
[a encodeRootObject: r1 withName:@"one"];
|
||||
[a encodeObject: r2 withName:@"another"];
|
||||
[a finishEncodingInterconnectedObjects];
|
||||
|
||||
[d writeToFile: @"./nsarchiver.dat" atomically:NO];
|
||||
|
||||
[d release];
|
||||
[a release];
|
||||
}
|
||||
|
||||
/* Release the object that was coded */
|
||||
[r1 release];
|
||||
[r2 release];
|
||||
|
||||
/* Read it back in from the file */
|
||||
printf("\nReading:\n");
|
||||
{
|
||||
id d = [[NSData alloc] initWithContentsOfFile: @"./nsarchiver.dat"];
|
||||
id a = [[NSUnarchiver alloc] initForReadingWithData: d];
|
||||
|
||||
[a startDecodingInterconnectedObjects];
|
||||
[a decodeObjectAt: &r1 withName:&d];
|
||||
[a decodeObjectAt: &r2 withName:&d];
|
||||
[a finishDecodingInterconnectedObjects];
|
||||
}
|
||||
|
||||
/* Display what we read, to make sure it matches what we wrote */
|
||||
{
|
||||
printf("%d\n", [r1 hash]);
|
||||
printf("%d\n", [r2 hash]);
|
||||
printf("%d\n", [[r1 nextResponder] hash]);
|
||||
printf("%d\n", [[r2 nextResponder] hash]);
|
||||
}
|
||||
|
||||
/* Do the autorelease. */
|
||||
[arp release];
|
||||
|
||||
exit(0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue