GNUstep Core Data  0.1
NSFetchedPropertyDescription.m
1 /* Implementation of the NSFetchedPropertyDescription class for the GNUstep
2  Core Data framework.
3  Copyright (C) 2005 Free Software Foundation, Inc.
4 
5  Written by: Saso Kiselkov <diablos@manga.sk>
6  Date: August 2005
7 
8  This file is part of the GNUstep Core Data framework.
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free
22  Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
23  */
24 
25 #import "CoreDataHeaders.h"
26 
27 @implementation NSFetchedPropertyDescription
28 
29 - (void) dealloc
30 {
31  TEST_RELEASE(_fetchRequest);
32 
33  [super dealloc];
34 }
35 
40 - (NSFetchRequest *) fetchRequest
41 {
42  return _fetchRequest;
43 }
44 
48 - (void) setFetchRequest: (NSFetchRequest *) request
49 {
50  [self _ensureEditableWithReason: _(@"Tried to set the fetch request "
51  @"of a fetched property already in use")];
52 
53  ASSIGN(_fetchRequest, request);
54 }
55 
56 - (id) initWithCoder: (NSCoder *) coder
57 {
58  if ((self = [super initWithCoder: coder]))
59  {
60  if ([coder allowsKeyedCoding])
61  {
62  ASSIGN(_fetchRequest, [coder decodeObjectForKey: @"FetchRequest"]);
63  }
64  else
65  {
66  ASSIGN(_fetchRequest, [coder decodeObject]);
67  }
68  }
69  return self;
70  }
71 
72 - (void) encodeWithCoder: (NSCoder *) coder
73 {
74  if ([coder allowsKeyedCoding])
75  {
76  [coder encodeObject: _fetchRequest forKey: @"FetchRequest"];
77  }
78  else
79  {
80  [coder encodeObject: _fetchRequest];
81  }
82 }
83 
84 @end
An object for storing details about managed object fetches.