NNTagging Reference Library

NNTaggableObject Class Reference

NNTaggableObject Class Reference

Inherits from
Declared in NNTaggableObject.h

Overview

Abstract class representing a taggable object (normally a file but can be anything really)

Tags must be loaded by subclass!

Tasks

Class Methods

replaceMetadataValue:forAttribute:

+ (id)replaceMetadataValue:(id)attrValue forAttribute:(NSString *)attrName
Parameters
attrValue

Value to replace

attrName

Name of the value's attribute

Return Value

Replacement value, e.g. PDF for com.adobe.pdf

Declared In
NNTaggableObject.h

Instance Methods

tags

- (NSMutableSet *)tags
Return Value

Tags on this object

Declared In
NNTaggableObject.h

setTags:

- (void)setTags:(NSMutableSet *)someTags
Discussion

should be used internally only (for example to implement copying), as it does not save the new tags to the backup storage

if you want to do that, please call initiateSave afterwards

Declared In
NNTaggableObject.h

retryCount

- (NSInteger)retryCount
Return Value

Current retry count

Declared In
NNTaggableObject.h

incrementRetryCount

- (void)incrementRetryCount
Discussion

Increments the current retry count by 1.

Declared In
NNTaggableObject.h

setRetryCount:

- (void)setRetryCount:(NSInteger)i
Parameters
i

New retry count

Declared In
NNTaggableObject.h

displayName

- (NSString *)displayName
Return Value

Display name (use this to show a representation of the object in your app)

Declared In
NNTaggableObject.h

setDisplayName:

- (void)setDisplayName:(NSString *)aDisplayName
Parameters
aDisplayName

New display name

Declared In
NNTaggableObject.h

contentType

- (NSString *)contentType
Return Value

Content type of object

Discussion

See the Spotlight constants for a meaning of this.

Declared In
NNTaggableObject.h

setContentType:

- (void)setContentType:(NSString *)aContentType
Parameters
aContentType

New content type

Declared In
NNTaggableObject.h

contentTypeIdentifier

- (NSString *)contentTypeIdentifier
Return Value

Content type identifier

Discussion

See the Spotlight constants for a meaning of this.

Declared In
NNTaggableObject.h

setContentTypeIdentifier:

- (void)setContentTypeIdentifier:(NSString *)aContentTypeIdentifier
Parameters
aContentTypeIdentifier

New content type identifier

Declared In
NNTaggableObject.h

contentTypeTree

- (NSArray *)contentTypeTree
Return Value

Content type tree

Discussion

See the Spotlight constants for a meaning of this.

Declared In
NNTaggableObject.h

setContentTypeTree:

- (void)setContentTypeTree:(NSArray *)aContentTypeTree
Parameters
aContentTypeTree

New content type tree

Declared In
NNTaggableObject.h

lastUsedDate

- (NSDate *)lastUsedDate
Return Value

Date when this object was last used/opened

Declared In
NNTaggableObject.h

setLastUsedDate:

- (void)setLastUsedDate:(NSDate *)aDate
Parameters
aDate

New last used date

Declared In
NNTaggableObject.h

addTag:

- (void)addTag:(NNTag *)tag
Parameters
tag

Tag to add

Discussion

Add a tag to the object - update will be saved to backing store.

Declared In
NNTaggableObject.h

addTags:

- (void)addTags:(NSArray *)someTags
Parameters
someTags

Tags to add

Discussion

Add multiple tags to object - update will be saved to backing store.

Declared In
NNTaggableObject.h

removeTag:

- (void)removeTag:(NNTag *)tag
Parameters
tag

Tag to remove

Discussion

Remove a tag from object - update will be saved to backing store.

Declared In
NNTaggableObject.h

removeTags:

- (void)removeTags:(NSArray *)someTags
Parameters
someTags

Tags to remove

Discussion

Remove multiple tags from object - update will be saved to backing store.

Declared In
NNTaggableObject.h

removeAllTags

- (void)removeAllTags
Discussion

Removes all tags from object - update will be saved to backing store.

Declared In
NNTaggableObject.h

initiateSave

- (void)initiateSave
Discussion

Call this if you want to save to harddisk, don't call saveTags directly!

Declared In
NNTaggableObject.h

handleFileManagement

- (void)handleFileManagement
Discussion

Will be called when files are scheduled for file managing, abstract method does nothing, subclass may implement on demand

  • only called if pref is set.

Declared In
NNTaggableObject.h

saveTags

- (BOOL)saveTags
Return Value

Success or failure

Discussion

Must be implemented by subclass, save tags to backing storage.

DO NOT CALL THIS DIRECTLY - use initiateSave instead, NNTagSave will take care of everything else.

Declared In
NNTaggableObject.h

renameTo:errorWindow:

- (void)renameTo:(NSString *)newName errorWindow:(NSWindow *)window
Parameters
newName

New name for taggable object

window

Error window

Discussion

Will be called on renaming, must be implemented in subclass.

Declared In
NNTaggableObject.h

moveToTrash:errorWindow:

- (void)moveToTrash:(BOOL)flag errorWindow:(NSWindow *)window
Parameters
flag

YES trashes, NO does nothing

window

Error window

Discussion

Will be called on moving to trash, must be implemented in subclass.

Declared In
NNTaggableObject.h

validateNewName:

- (BOOL)validateNewName:(NSString *)newName
Parameters
newName

Proposed name

Return Value

YES if valid, else NO

Discussion

Checks if new name for object is valid for example: NNFile needs to check if the filename is free in the directory

must be implemented by subclass!

Declared In
NNTaggableObject.h

shouldManageFiles

- (BOOL)shouldManageFiles
Return Value

YES if files should be managed

Declared In
NNTaggableObject.h

setShouldManageFiles:

- (void)setShouldManageFiles:(BOOL)flag
Parameters
flag

Determines if files should be managed

Declared In
NNTaggableObject.h

shouldManageFilesAutomatically

- (BOOL)shouldManageFilesAutomatically
Return Value

YES if files are managed automatically

Declared In
NNTaggableObject.h

setShouldManageFilesAutomatically:

- (void)setShouldManageFilesAutomatically:(BOOL)flag
Parameters
flag

Determines if files should be managed automatically

Declared In
NNTaggableObject.h

isWritable

- (BOOL)isWritable
Return Value

YES if metadata can be written, NO otherwise

Discussion

Call this to check if metadata can be written to the object

Declared In
NNTaggableObject.h

Last updated: 2010-5-13