File: programming/cocoa/Filie.zip/Filie/Filie/UKFolderMetaStorage.m


/* =============================================================================
    PROJECT:    Filie
    FILE:       UKFolderMetaStorage.m
    
    COPYRIGHT:  (c) 2004 by M. Uli Kusterer, all rights reserved.
    
    AUTHORS:    M. Uli Kusterer - UK
    
    LICENSES:   GNU GPL
    
    REVISIONS:
        2004-11-30  UK  Created.
   ========================================================================== */
 
// -----------------------------------------------------------------------------
//  Headers:
// -----------------------------------------------------------------------------
 
#import "UKFolderMetaStorage.h"
#include <unistd.h>
#include <sys/types.h>
// -----------------------------------------------------------------------------
//  storageForURL:
//      Factory method that creates a storage object for an item (usually a
//      file) that has the specified URL. Calls initForURL:.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  initForURL:
//      Constructor that creates a storage object for an item (usually a
//      file) that has the specified URL.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
"%@""Error loading meta storage file %@"// -----------------------------------------------------------------------------
//  dealloc:
//      Destructor.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setObject:forKey:
//      Attach a property with the specified key/value combination to the
//      file/folder represented by this storage. Used to e.g. keep around the
//      dimensions of the window displayed for a folder.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  objectForKey:
//      Return a property of the storage's file based on its key. Counterpart
//      to setObject:forKey:.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  dictionaryForFile:
//      Return a dictionary of properties for a particular file in this storage,
//      specified by its name (not by its path). This usually only makes sense
//      if this storage is for a folder or smart folder which may contain other
//      files.
//
//      Returns NIL if there is no information for a file of that name in the
//      storage yet.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
"FileInfo"// -----------------------------------------------------------------------------
//  newDictionaryForFile:
//      Like dictionaryForFile:, but this creates a dictionary and associates
//      it with the specified file name if there isn't one yet.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
"FileInfo""FileInfo"// -----------------------------------------------------------------------------
//  synchronize:
//      Write changes made to the storage to disk.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  clean:
//      Remove any unused entries for files that no longer exist from the
//      storage. Not yet implemented. Should probably change to use the file
//      data source to find out whether a file exists.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  setDisplayRect:
//      Shorthand for storing the @"DisplayRect" property in the storage. Used
//      for saving position and dimensions of the window.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
"DisplayRect"];
    }
}
 
 
// -----------------------------------------------------------------------------
//  displayRect:
//      Shorthand for getting the @"DisplayRect" property from the storage.
//      Counterpart to setDisplayRect:.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
"DisplayRect"// -----------------------------------------------------------------------------
//  folderURL:
//      Return the URL for which this storage was created. This is the URL
//      passed to initForURL.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//  storageFileURL:
//      Return the URL for the on-disk file used for the storage. Used
//      internally to make it easy to change the scheme used.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
// Pre-generate some path stuff we may need:
    storageFolder = [@"~/Library/Application Support/Filie/""Meta Data"// Remote URL or so? Generate local storage file:
#if 1
#else
#endif
"/"":"".Filie_Store_%lu"// Generate path for .Filie_Store file, if that isn't writable, generate local storage file:
// -----------------------------------------------------------------------------
//  isEmpty:
//      Returns YES if this is a new, empty storage. You can use this to
//      optimize your code when a folder is initially loaded.
//
//  REVISIONS:
//      2004-12-22  UK  Documented.
// -----------------------------------------------------------------------------
"FileInfo"// Make it really old.
 

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.