File: EOSharedEditingContext.h

package info (click to toggle)
gnustep-dl2 0.12.0%2Bgit20250112-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,092 kB
  • sloc: objc: 68,223; makefile: 60; sh: 48
file content (104 lines) | stat: -rw-r--r-- 3,205 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* -*-objc-*-
   EOSharedEditingContext.h

   Copyright (C) 2005 Free Software Foundation, Inc.

   Author: David Ayers <ayers@fsfe.org>
   Date: November 2005

   This file is part of the GNUstep Database Library.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.
   If not, write to the Free Software Foundation,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef	__EOSharedEditingContext_h__
#define	__EOSharedEditingContext_h__

#include <EOControl/EOEditingContext.h>
#include <EOControl/EODefines.h>

@class NSString;
@class NSArray;
@class NSMutableArray;
@class NSDictionary;
@class NSMutableDictionary;
@class NSUndoManager;
@class EOMultiReaderLock;
@class EOFetchSpecification;
@class EOGlobalID;

GDL2CONTROL_EXPORT
NSString *EODefaultSharedEditingContextWasInitializedNotification;

GDL2CONTROL_EXPORT
NSString *EOSharedEditingContextInitializedObjectsNotification;

@interface EOSharedEditingContext : EOEditingContext
{
  NSRecursiveLock *_sharedLock; /* FIXME: Use EOMultiReaderLock.  */
  int _readerLockCount;
  int _readerLockCountSuspended;
  NSMutableArray *_initializedGlobalIDs;
  NSMutableDictionary *_objsByEntity;
  NSMutableDictionary *_objsByEntityFetchSpec;
}

+ (EOSharedEditingContext *)defaultSharedEditingContext;
+ (void)setDefaultSharedEditingContext: (EOSharedEditingContext *)context;

- (NSDictionary *)objectsByEntityName;
- (NSDictionary *)objectsByEntityNameAndFetchSpecificationName;
- (void)bindObjectsWithFetchSpecification: (EOFetchSpecification *)fetchSpec
				   toName: (NSString *)name;

- (void)lockForReading;
- (void)unlockForReading;
- (BOOL)tryLockForReading;
- (void)suspendReaderLocks;
- (void)retrieveReaderLocks;

- (NSArray *)objectsWithFetchSpecification: (EOFetchSpecification *)fetchSpec
			    editingContext: (EOEditingContext *)context;

- (EOSharedEditingContext *)sharedEditingContext;
- (void)setSharedEditingContext: (EOSharedEditingContext *)sharedContext;

- (void)reset;
- (void)setUndoManager: (NSUndoManager *)undoManager;

- (id)objectForGlobalID: (EOGlobalID *)globalID;
- (id)faultForGlobalID: (EOGlobalID *)globalID
	editingContext: (EOEditingContext *)context;
- (void)refaultObject: (id)object
	 withGlobalID: (EOGlobalID *)globalID 
       editingContext: (EOEditingContext *)context;

- (NSArray *)updatedObjects;
- (NSArray *)insertedObjects;
- (NSArray *)deletedObjects;

- (BOOL)hasChanges;
- (void)validateChangesForSave;

- (NSArray *)registeredObjects;

- (void)objectWillChange: (id)object;
- (void)insertObject: (id)object;
- (void)deleteObject: (id)object;
- (void)saveChanges;
@end

#endif