GNUstep Core Data  0.1
NSFetchedPropertyDescription.m
00001 /* Implementation of the NSFetchedPropertyDescription class for the GNUstep
00002    Core Data framework.
00003    Copyright (C) 2005 Free Software Foundation, Inc.
00004 
00005    Written by:  Saso Kiselkov <diablos@manga.sk>
00006    Date: August 2005
00007 
00008    This file is part of the GNUstep Core Data framework.
00009 
00010    This library is free software; you can redistribute it and/or
00011    modify it under the terms of the GNU Lesser General Public
00012    License as published by the Free Software Foundation; either
00013    version 2.1 of the License, or (at your option) any later version.
00014 
00015    This library is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018    Lesser General Public License for more details.
00019 
00020    You should have received a copy of the GNU Lesser General Public
00021    License along with this library; if not, write to the Free
00022    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
00023  */
00024 
00025 #import "CoreDataHeaders.h"
00026 
00027 @implementation NSFetchedPropertyDescription
00028 
00029 - (void) dealloc
00030 {
00031   TEST_RELEASE(_fetchRequest);
00032 
00033   [super dealloc];
00034 }
00035 
00040 - (NSFetchRequest *) fetchRequest
00041 {
00042   return _fetchRequest;
00043 }
00044 
00048 - (void) setFetchRequest: (NSFetchRequest *) request
00049 {
00050   [self _ensureEditableWithReason: _(@"Tried to set the fetch request "
00051                                      @"of a fetched property already in use")];
00052 
00053   ASSIGN(_fetchRequest, request);
00054 }
00055 
00056 - (id) initWithCoder: (NSCoder *) coder
00057 {
00058         if ((self = [super initWithCoder: coder]))
00059     {
00060       if ([coder allowsKeyedCoding])
00061         {
00062           ASSIGN(_fetchRequest, [coder decodeObjectForKey: @"FetchRequest"]);
00063         }
00064       else
00065         {
00066           ASSIGN(_fetchRequest, [coder decodeObject]);
00067         }
00068         }
00069         return self;
00070  }
00071 
00072 - (void) encodeWithCoder: (NSCoder *) coder
00073 {
00074   if ([coder allowsKeyedCoding])
00075     {
00076       [coder encodeObject: _fetchRequest forKey: @"FetchRequest"];
00077     }
00078   else
00079     {
00080       [coder encodeObject: _fetchRequest];
00081     }
00082 }
00083 
00084 @end