/* * SapphireEntityDirectory.h * Sapphire * * Created by Graham Booker on May 26, 2008. * Copyright 2008 Sapphire Development Team and/or www.nanopi.net * All rights reserved. * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU * General Public License as published by the Free Software Foundation; either version 3 of the License, * or (at your option) any later version. * * This program 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 General * Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; if not, * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #import "SapphireEntityDirectory.h" #import "CoreDataSupportFunctions.h" #import "SapphireBasicDirectoryFunctionsImports.h" @implementation SapphireEntityDirectory - (id)initWithEntityName:(NSString *)entityName usingFilter:(NSPredicate *)filter inContext:(NSManagedObjectContext *)context { self = [super init]; if(self == nil) return self; name = [entityName retain]; moc = [context retain]; nameKey = [@"name" retain]; fetchFilter = [filter retain]; Basic_Directory_Function_Inits return self; } - (void) dealloc { [name release]; [moc release]; [entities release]; [nameKey release]; [fetchPredicate release]; [path release]; [notificationName release]; [[NSNotificationCenter defaultCenter] removeObserver:self]; [fetchFilter release]; Basic_Directory_Function_Deallocs [super dealloc]; } - (void)setNameKey:(NSString *)key { [nameKey release]; nameKey = [key retain]; } - (NSArray *)files { return [NSArray array]; } - (NSArray *)directories { return [[entities allKeys] sortedArrayUsingSelector:@selector(nameCompare:)]; } - (NSArray *)metaFiles { return [NSArray array]; } - (NSPredicate *)metaFileFetchPredicate { return fetchPredicate; } - (void)setMetaFileFetchPredicate:(NSPredicate *)predicate { [fetchPredicate release]; fetchPredicate = [predicate retain]; } - (SapphireFileMetaData *)metaDataForFile:(NSString *)file { return nil; } - (id )metaDataForDirectory:(NSString *)directory { return [entities objectForKey:directory]; } - (void)reloadDirectoryContents { NSArray *objects = doFetchRequest(name, moc, fetchFilter); int i, count = [objects count]; NSMutableDictionary *newData = [[NSMutableDictionary alloc] init]; for(i=0; i)parentDirectory { return nil; } #include "SapphireBasicDirectoryFunctions.h" @end