CatNiP docutest
Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11
LocalDataHandler Class Reference

LocalDataHandler.m CatNiP. More...

#import <LocalDataHandler.h>

List of all members.

Public Member Functions

(id) - init [implementation]
(int) - int_cmp [implementation]

Static Public Member Functions

(NSMutableDictionary *) + createComposerDictionary:
 Create dictionary from given LocalScoreData array with composers as keys and NSMutableArrays of CompositionData objects as values.
(LocalScoreData *) + createLocalScoreData:ofComposition:localScores:
 Creates LocalScoreData objects for given parameters.
(void) + deleteFile:
 Attemps to delete file in filepath from memory.
(void) + deleteFiles:
 Attemps to delete files in filepaths from memory.
(NSMutableArray *) + loadLocalScoresFromDefaultFile
 Loads and returns previously saved LocalScoreDatas from default file.
(NSMutableArray *) + loadPlaylistsFromDefaultFile:
 Loads and returns previously saved playlist array from default file.
(void) + removeAndDeleteCompositionDataArray:fromScoreArray:andDictionary:andPlaylistArray:
 Removes references and deletes pdf-files associated with scores in given CompositionData array from given score array, dictionary and playlist array.
(void) + removeAndDeleteLocalScoreData:fromScoreArray:andDictionary:andPlaylistArray:
 Removes references and deletes pdf-files associated with given LocalScoreData from given score array, dictionary and playlist array.
(void) + removeAndDeleteScoreDataArray:fromScoreArray:andDictionary:andPlaylistArray:
 Removes references and deletes pdf-files associated with scores in given LocalScoreData array from given score array, dictionary and playlist array.
(void) + removeCompositionDataArray:fromDictionary:
 Removes references to scores in CompositionData array from dictionary.
(void) + removeCompositionDataArray:fromPlaylistArray:
 Removes references to scores in CompositionData array from playlist arrays scorelists.
(void) + removeCompositionDataArray:fromScoreArray:
 Removes references to scores in CompositionData array from score array.
(void) + removeLocalScoreData:fromDictionary:
 Removes reference(s) to given LocalScoreData from dictionary.
(void) + removeLocalScoreData:fromPlaylistArray:
 Remove references of LocalScoreData from given Playlist array.
(void) + removeLocalScoreData:fromScoreArray:
 Removes reference(s) to given LocalScoreData from array of LocalScoreData objects.
(void) + removeScoreDataArray:fromDictionary:
 Removes references to scores in LocalScoreData array from dictionary.
(void) + removeScoreDataArray:fromPlaylistArray:
 Removes references to scores in LocalScoreData array from playlist array's scorelists.
(void) + removeScoreDataArray:fromScoreArray:
 Removes references to scores in LocalScoreData array from score array.
(void) + savePlaylistsToDefaultFile:
 Saves given array of Playlist objects to default file.
(void) + saveScoresToDefaultFile:
 Saves given array of LocalScoreData objects to default file.
(BOOL) + scoreArray:hasScoreWithPdfFileName:
 Searchs if given score array has score with same pdf filename as given parameter.
(NSInteger) + searchFreeIndexForScore:
 Searches given array of LocalScoreDatas for first free index and return it.

Detailed Description

LocalDataHandler.m CatNiP.

Class to handle all local data saving and loading. Also manages local data types by removing references and deleting files.

Created by Simo M Linkola, tkol on 6/10/11. Copyright 2011 __MyCompanyName__. All rights reserved.


Member Function Documentation

+ (NSMutableDictionary *) createComposerDictionary: (NSArray *)  scores

Create dictionary from given LocalScoreData array with composers as keys and NSMutableArrays of CompositionData objects as values.

Does not allow duplicate scores to be added.

Duplicates are checked by searching first if composer exists, then if composition exists and then searching compositions scores for same .pdf filepath. If two separate compositions are associated with pdf-files with same filepath WILL ALLOW both to be added.

Parameters:
createComposerDictionaryarray of LocalScoreDatas from which the dictionary will be created
Returns:
created dictionary with composers as keys and NSMutableArrays of CompositionDatas as values.

Here is the caller graph for this function:

+ (LocalScoreData *) createLocalScoreData: (NSArray *)  fileNameParams
ofComposition: (CompositionData *)  comp
localScores: (NSArray *)  scores 

Creates LocalScoreData objects for given parameters.

Parameters:
fileNameParamsArray for score's file name (0) and file path (1)
ofCompositionCompositionData object of given composer and composition created by IMSLP composition query. Contains composer and composition name and array of ScoreData objects.
localScoresArray of LocalScoreData objects
Returns:
LocalScoreData object representing given arguments

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) deleteFile: (NSString *)  filepath

Attemps to delete file in filepath from memory.

Parameters:
deleteFileNSString object representing filepath to the file to be deleted.

Here is the caller graph for this function:

+ (void) deleteFiles: (NSArray *)  filepaths

Attemps to delete files in filepaths from memory.

Parameters:
deleteFilesNSArray of NSString objects representing filepaths to files to be deleted.

Here is the caller graph for this function:

- (id) init [implementation]
- (int) int_cmp (const void *)  a
(const void *)  b 
[implementation]

Here is the caller graph for this function:

+ (NSMutableArray *) loadLocalScoresFromDefaultFile

Loads and returns previously saved LocalScoreDatas from default file.

Default file is 'catnip_local.data' in application's documents-folder.

Returns:
array of LocalScoreData objects. If no previously saved LocalScoreData objects are found, returns empty array.

Here is the caller graph for this function:

+ (NSMutableArray *) loadPlaylistsFromDefaultFile: (NSArray *)  allScores

Loads and returns previously saved playlist array from default file.

Default file is 'catnip_playlists.data' in application's documents-folder.

Saved playlists have only information about name and LocalScoreData object's index-properties in array. Therefore each time playlists are loaded allLocalScores are hashed in dictionary with indeces as keys and references to LocalScoreData objects as values. Returned playlist array is formed by searching each saved playlists scores from this hashtable.

Parameters:
loadPlaylistsFromDefaultFileNSArray of all LocalScoreDatas saved in 'catnip_local.data'
Returns:
Constructed array of Playlist objects with references to LocalScoreData objects. If no previously saved Playlists are found returns empty array.

Here is the caller graph for this function:

+ (void) removeAndDeleteCompositionDataArray: (NSArray *)  cdarray
fromScoreArray: (NSMutableArray *)  sarray
andDictionary: (NSMutableDictionary *)  dict
andPlaylistArray: (NSMutableArray *)  parray 

Removes references and deletes pdf-files associated with scores in given CompositionData array from given score array, dictionary and playlist array.

Parameters:
removeAndDeleteCompositionDataArrayNSArray of CompositionData objects
fromScoreArrayNSArray of LocalScoreData objects
andDictionaryNSDictionary in form made by createComposerDictionary:
andPlaylistArrayNSArray of Playlist objects

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) removeAndDeleteLocalScoreData: (LocalScoreData*)  score
fromScoreArray: (NSMutableArray *)  sarray
andDictionary: (NSMutableDictionary *)  dict
andPlaylistArray: (NSMutableArray *)  parray 

Removes references and deletes pdf-files associated with given LocalScoreData from given score array, dictionary and playlist array.

Parameters:
removeAndDeleteLocalScoreDataLocalScoreData object to be deleted
fromScoreArrayNSArray of LocalScoreData objects
andDictionaryNSDictionary in form made by createComposerDictionary:
andPlaylistArrayNSArray of Playlist objects

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) removeAndDeleteScoreDataArray: (NSArray *)  sdarray
fromScoreArray: (NSMutableArray *)  sarray
andDictionary: (NSMutableDictionary *)  dict
andPlaylistArray: (NSMutableArray *)  parray 

Removes references and deletes pdf-files associated with scores in given LocalScoreData array from given score array, dictionary and playlist array.

Parameters:
removeAndDeleteScoreDataArrayNSArray of LocalScoreData objects
fromScoreArrayNSArray of LocalScoreData objects
andDictionaryNSDictionary in form made by createComposerDictionary:
andPlaylistArrayNSArray of Playlist objects

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) removeCompositionDataArray: (NSArray *)  cdarray
fromDictionary: (NSMutableDictionary *)  dict 

Removes references to scores in CompositionData array from dictionary.

Parameters:
removeCompositionDataArrayNSArray of CompositionData objects
fromDictionaryNSDictionary in form made by createComposerDictionary:

Here is the call graph for this function:

+ (void) removeCompositionDataArray: (NSArray *)  cdarray
fromPlaylistArray: (NSMutableArray *)  parray 

Removes references to scores in CompositionData array from playlist arrays scorelists.

Parameters:
removeCompositionDataArrayNSArray of CompositionData objects
fromPlaylistArrayNSArray of Playlist objects

Here is the call graph for this function:

+ (void) removeCompositionDataArray: (NSArray *)  cdarray
fromScoreArray: (NSMutableArray *)  sarray 

Removes references to scores in CompositionData array from score array.

Parameters:
removeCompositionDataArrayNSArray of CompositionData objects
fromScoreArrayNSArray of LocalScoreData objects

Here is the call graph for this function:

+ (void) removeLocalScoreData: (LocalScoreData *)  score
fromDictionary: (NSMutableDictionary *)  dict 

Removes reference(s) to given LocalScoreData from dictionary.

Does not delete the pdf-file associated with the LocalScoreData object.

References are removed by finding value from dictionary for LocalScoreData's composer as key. NSMutableArray of CompositionData's achieved this way is then searched for object with compositionName same as LocalScoreData's composition. If this is found CompositionData's musicScore-array is searched for a LocalScoreData object with same pdf-attribute value by comparing strings.

Parameters:
removeLocalScoreDatascore which references are to be removed
fromDictionarydictionary from which the references will be removed. Dictionary needs to be of same format as createComposerDictionary makes.

Here is the caller graph for this function:

+ (void) removeLocalScoreData: (LocalScoreData *)  score
fromPlaylistArray: (NSMutableArray *)  parray 

Remove references of LocalScoreData from given Playlist array.

Does not delete the pdf-file associated with the LocalScoreData object.

Uses removeLocalScoreData:fromScoreArray: for each Playlist's scorelist.

Parameters:
removeLocalScoreDatascore which references are to be removed
fromPlaylistArrayarray of Playlist objects from which the references will be removed

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) removeLocalScoreData: (LocalScoreData *)  score
fromScoreArray: (NSMutableArray *)  sarray 

Removes reference(s) to given LocalScoreData from array of LocalScoreData objects.

Does not delete the pdf-file associated with the LocalScoreData object.

References are removed by comparing pdf-attribute of given LocalScoreData to array's LocalScoreData objects' pdf-attribute. If they are the same the object in array is removed from the array.

Parameters:
removeLocalScoreDatascore which references are to be removed
fromScoreArrayarray of LocalScoreData objects from which the references will be removed

Here is the caller graph for this function:

+ (void) removeScoreDataArray: (NSArray *)  sdarray
fromDictionary: (NSMutableDictionary *)  dict 

Removes references to scores in LocalScoreData array from dictionary.

Parameters:
removeScoreDataArrayNSArray of LocalScoreData objects
fromDictionaryNSDictionary in form made by createComposerDictionary:

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) removeScoreDataArray: (NSArray *)  sdarray
fromPlaylistArray: (NSMutableArray *)  parray 

Removes references to scores in LocalScoreData array from playlist array's scorelists.

Parameters:
removeScoreDataArrayNSArray of LocalScoreData objects
fromPlaylistArrayNSArray of Playlist objects

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) removeScoreDataArray: (NSArray *)  sdarray
fromScoreArray: (NSMutableArray *)  sarray 

Removes references to scores in LocalScoreData array from score array.

Parameters:
removeScoreDataArrayNSArray of LocalScoreData objects
fromScoreArrayNSArray of LocalScoreData objects

Here is the call graph for this function:

Here is the caller graph for this function:

+ (void) savePlaylistsToDefaultFile: (NSMutableArray *)  playlists

Saves given array of Playlist objects to default file.

Caller should check that given array has nothing but Playlist objects.

Default file is 'catnip_playlists.data' in application's documents-folder.

Here is the caller graph for this function:

+ (void) saveScoresToDefaultFile: (NSMutableArray *)  scores

Saves given array of LocalScoreData objects to default file.

Caller should check that given array has nothing but LocalScoreData objects.

Default file is 'catnip_local.data' in application's documents-folder.

Here is the caller graph for this function:

+ (BOOL) scoreArray: (NSArray *)  sarray
hasScoreWithPdfFileName: (NSString *)  filename 

Searchs if given score array has score with same pdf filename as given parameter.

Parameters:
scoreArrayNSArray of LocalScoreData objects
hasScoreWithPdfFileNamepdf-filename to search from scoreArray
Returns:
YES is match is found. NO otherwise.
+ (NSInteger) searchFreeIndexForScore: (NSArray *)  scores

Searches given array of LocalScoreDatas for first free index and return it.

Indeces start from 1 and increment by one.

Parameters:
searchFreeIndexForScoresNSArray of LocalScoreData objects
Returns:
If given array is null or it's count is 0 returns 1. Otherwise returns first free positive integer which is not index for any of the LocalScoreData objects in given array. If something goes horribly wrong and R'lyeh is rising returns -1.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Properties Defines