The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > Omni Frameworks
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Adding metadata to OUIDocument Thread Tools Search this Thread Display Modes
What is the best approach to add metadata to our OUIDocument subclass? I'm using the RTFDocument as an example and would like to add additional metadata to it such as keywords and PDF preview. Currently the RTFDocument example uses a flat NSData format rather than an NSFileWrapper, so the first step would be to address that. Something like this might work:

Code:
- (BOOL)readFromURL:(NSURL *)url error:(NSError **)outError;
{    
    self.fileWrapper = [[NSFileWrapper alloc] initWithURL:url options:nil error:outError];
    NSString *rtfFilename = [url lastPathComponent];
    NSFileWrapper *rtfWrapper = [self.fileWrapper.fileWrappers objectForKey:rtfFilename];
    NSString *rtfString = [[NSString alloc] initWithData:[rtfWrapper regularFileContents] encoding:NSUTF8StringEncoding];
    NSAttributedString *attributedString = [OUIRTFReader parseRTFString:rtfString];
    
    _text = [attributedString copy];
    
    return YES;
}
Since there is a reference to the NSFileWrapper from this point, I could lazy load the metadata file and PDF preview similarly. Or perhaps I could lazy load the rtf data as well, just to keep the object graph as small as possible when dealing with a collection of documents.

Any overall thoughts on this? I guess I'm just looking for a code smell more than anything else to make sure I didn't miss anything crucial.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata in Titles/Comments zaxaz OmniOutliner 3 for Mac 1 2012-02-08 10:31 AM
Blank metadata Purge? Mr. Reeee OmniFocus 1 for Mac 3 2009-03-29 04:19 PM
Tags / Metadata in 1.7 ? shishk OmniFocus 1 for Mac 2 2009-03-24 07:53 PM
People Column or Metadata steve OmniFocus 1 for Mac 9 2008-06-05 01:41 PM
Metadata or classes for imported sitemaps monkeycyclops OmniGraffle General 3 2007-04-10 12:01 PM


All times are GMT -8. The time now is 12:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.