Skip to content

Commit

Permalink
Fixed build errors caused by being built inside a library. Moved defi…
Browse files Browse the repository at this point in the history
…nes to ActiveRecordHelpers for the same reason.
  • Loading branch information
zwaldowski committed Jun 21, 2011
1 parent 27fd9b9 commit 4a27029
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 48 deletions.
2 changes: 1 addition & 1 deletion ARCoreDataAction.h
@@ -1,6 +1,6 @@
//
// ARCoreDataAction.h
// Freshpod
// MagicalRecord
//
// Created by Saul Mora on 2/24/11.
// Copyright 2011 Magical Panda Software. All rights reserved.
Expand Down
5 changes: 4 additions & 1 deletion ARCoreDataAction.m
@@ -1,14 +1,17 @@
//
// ARCoreDataAction.m
// Freshpod
// MagicalRecord
//
// Created by Saul Mora on 2/24/11.
// Copyright 2011 Magical Panda Software. All rights reserved.
//

#import "ARCoreDataAction.h"
#import "NSManagedObjectContext+ActiveRecord.h"
#import <CoreData/CoreData.h>

static dispatch_queue_t coredata_background_save_queue;
dispatch_queue_t background_save_queue(void);

dispatch_queue_t background_save_queue()
{
Expand Down
16 changes: 16 additions & 0 deletions ActiveRecordHelpers.h
@@ -1,5 +1,6 @@
//
// ActiveRecordHelpers.h
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand All @@ -8,6 +9,21 @@
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

// enable to use caches for the fetchedResultsControllers (iOS only)
// #define STORE_USE_CACHE

#define kCreateNewCoordinatorOnBackgroundOperations 0

#define ENABLE_ACTIVE_RECORD_LOGGING

#ifdef DDLogWarn
#define ARLog(...) DDLogWarn(__VA_ARGS__)
#elif ENABLE_ACTIVE_RECORD_LOGGING
#define ARLog(...) NSLog(@"%s(%x) %@", __PRETTY_FUNCTION__, (unsigned int)self, [NSString stringWithFormat:__VA_ARGS__])
#else
#define ARLog(...) ((void)0)
#endif

#ifdef NS_BLOCKS_AVAILABLE

@class NSManagedObjectContext;
Expand Down
2 changes: 2 additions & 0 deletions ActiveRecordHelpers.m
@@ -1,5 +1,6 @@
//
// ActiveRecordHelpers.m
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand All @@ -10,6 +11,7 @@
#import "NSPersistentStoreCoordinator+ActiveRecord.h"
#import "NSManagedObjectModel+ActiveRecord.h"
#import "NSPersistentStore+ActiveRecord.h"
#import "ARCoreDataAction.h"
#import <dispatch/dispatch.h>

@implementation ActiveRecordHelpers
Expand Down
14 changes: 0 additions & 14 deletions CoreData+ActiveRecordFetching.h
@@ -1,18 +1,4 @@

// enable to use caches for the fetchedResultsControllers (iOS only)
// #define STORE_USE_CACHE

#define kCreateNewCoordinatorOnBackgroundOperations 0

#define ENABLE_ACTIVE_RECORD_LOGGING

#ifdef DDLogWarn
#define ARLog(...) DDLogWarn(__VA_ARGS__)
#elif ENABLE_ACTIVE_RECORD_LOGGING
#define ARLog(...) NSLog(@"%s(%x) %@", __PRETTY_FUNCTION__, (unsigned int)self, [NSString stringWithFormat:__VA_ARGS__])
#else
#define ARLog(...) ((void)0)
#endif

#import "ActiveRecordHelpers.h"
#import "ARCoreDataAction.h"
Expand Down
1 change: 1 addition & 0 deletions NSFetchedResultsController+ActiveRecord.h
@@ -1,5 +1,6 @@
//
// NSFetchedResultsController+ActiveRecord.h
// MagicalRecord
//
// Created by Peter Steinberger on 18.04.11.
// Copyright 2011 Peter Steinberger. All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSFetchedResultsController+ActiveRecord.m
@@ -1,5 +1,6 @@
//
// NSFetchedResultsController+ActiveRecord.h
// MagicalRecord
//
// Created by Peter Steinberger on 18.04.11.
// Copyright 2011 Peter Steinberger. All rights reserved.
Expand Down
12 changes: 7 additions & 5 deletions NSManagedObject+ActiveRecord.h
@@ -1,4 +1,6 @@
//
//
// NSManagedObject+ActiveRecord.h
// MagicalRecord
//
// Created by Saul Mora on 11/15/09.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down Expand Up @@ -92,10 +94,10 @@
+ (id) findFirstWithPredicate:(NSPredicate *)searchTerm sortedBy:(NSString *)sortBy ascending:(BOOL)ascending andRetrieveAttributes:(id)attributes, ...;
+ (id) findFirstWithPredicate:(NSPredicate *)searchTerm sortedBy:(NSString *)sortBy ascending:(BOOL)ascending inContext:(NSManagedObjectContext *)context andRetrieveAttributes:(id)attributes, ...;

+ (id)findFirstByUID:(id)searchValue;
+ (id)findFirstByUID:(id)searchValue inContext:(NSManagedObjectContext *)context;
+ (id)findFirstByUIDHash:(id)searchValue;
+ (id)findFirstByUIDHash:(id)searchValue inContext:(NSManagedObjectContext *)context;
+ (id)findFirstByUID:(NSNumber *)searchValue;
+ (id)findFirstByUID:(NSNumber *)searchValue inContext:(NSManagedObjectContext *)context;
+ (id)findFirstByUIDHash:(NSNumber *)searchValue;
+ (id)findFirstByUIDHash:(NSNumber *)searchValue inContext:(NSManagedObjectContext *)context;


+ (id)findFirstByAttribute:(NSString *)attribute withValue:(id)searchValue;
Expand Down
36 changes: 10 additions & 26 deletions NSManagedObject+ActiveRecord.m
@@ -1,4 +1,7 @@

//
// NSManagedObject+ActiveRecord.m
// MagicalRecord
//
// Created by Saul Mora on 11/15/09.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
//
Expand All @@ -7,7 +10,6 @@
#import "NSManagedObject+ActiveRecord.h"
#import "NSManagedObjectContext+ActiveRecord.h"


static NSUInteger defaultBatchSize = kActiveRecordDefaultBatchSize;

@implementation NSManagedObject (ActiveRecord)
Expand Down Expand Up @@ -505,38 +507,20 @@ + (NSArray *)findAllWithPredicate:(NSPredicate *)searchTerm withBlock:(void (^)(
return [self executeFetchRequest:request inContext:[NSManagedObjectContext contextForCurrentThread]];
}

+ (id)findFirstByUID:(id)searchValue {
+ (id)findFirstByUID:(NSNumber *)searchValue {
return [self findFirstByUID:searchValue inContext:[NSManagedObjectContext contextForCurrentThread]];
}

+ (id)findFirstByUID:(id)searchValue inContext:(NSManagedObjectContext *)context {
NSNumber *uidNum;
if ([searchValue isKindOfClass:[NSNumber class]]) {
uidNum = searchValue;
} else if ([searchValue isKindOfClass:[NSString class]]) {
uidNum = [NSNumber numberWithString:searchValue];
} else {
ARLog(@"Wrong type for searchValue!");
return nil;
}
return [self findFirstByAttribute:@"uid" withValue:uidNum];
+ (id)findFirstByUID:(NSNumber *)searchValue inContext:(NSManagedObjectContext *)context {
return [self findFirstByAttribute:@"uid" withValue:searchValue];
}

+ (id)findFirstByUIDHash:(id)searchValue {
+ (id)findFirstByUIDHash:(NSNumber *)searchValue {
return [self findFirstByUID:searchValue inContext:[NSManagedObjectContext contextForCurrentThread]];
}

+ (id)findFirstByUIDHash:(id)searchValue inContext:(NSManagedObjectContext *)context {
NSNumber *uidNum;
if ([searchValue isKindOfClass:[NSNumber class]]) {
uidNum = searchValue;
} else if ([searchValue isKindOfClass:[NSString class]]) {
uidNum = [NSNumber numberWithString:searchValue];
} else {
ARLog(@"Wrong type for searchValue!");
return nil;
}
return [self findFirstByAttribute:@"uidHash" withValue:uidNum];
+ (id)findFirstByUIDHash:(NSNumber *)searchValue inContext:(NSManagedObjectContext *)context {
return [self findFirstByAttribute:@"uidHash" withValue:searchValue];
}

+ (id)findFirst
Expand Down
1 change: 1 addition & 0 deletions NSManagedObjectContext+ActiveRecord.h
@@ -1,5 +1,6 @@
//
// NSManagedObjectContext+ActiveRecord.h
// MagicalRecord
//
// Created by Saul Mora on 11/23/09.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSManagedObjectContext+ActiveRecord.m
@@ -1,5 +1,6 @@
//
// NSManagedObjectContext+ActiveRecord.m
// MagicalRecord
//
// Created by Saul Mora on 11/23/09.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSManagedObjectModel+ActiveRecord.h
@@ -1,5 +1,6 @@
//
// NSManagedObjectModel+ActiveRecord.h
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion NSManagedObjectModel+ActiveRecord.m
@@ -1,6 +1,6 @@
//
// NSManagedObjectModel+ActiveRecord.m
// DocBook
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSPersistentStore+ActiveRecord.h
@@ -1,5 +1,6 @@
//
// NSPersistentStore+ActiveRecord.h
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSPersistentStore+ActiveRecord.m
@@ -1,5 +1,6 @@
//
// NSPersistentStore+ActiveRecord.m
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSPersistentStoreCoordinator+ActiveRecord.h
@@ -1,5 +1,6 @@
//
// NSPersistentStoreCoordinator+ActiveRecord.h
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions NSPersistentStoreCoordinator+ActiveRecord.m
@@ -1,5 +1,6 @@
//
// NSPersistentStoreCoordinator+ActiveRecord.m
// MagicalRecord
//
// Created by Saul Mora on 3/11/10.
// Copyright 2010 Magical Panda Software, LLC All rights reserved.
Expand Down

0 comments on commit 4a27029

Please sign in to comment.