Mac OS X Reference Library Apple Developer Connection spyglass button

MDLineage Reference

Framework
CoreServices/CoreServices.h
Companion guide
Declared in
MDLineage.h

Overview

The MDLineage functions can be used to set, alter, and store data concerning the relationships between different versions of the same logical file. Lineage information is stored on files using extended attributes. The lineage for a file can be retrieved or searched for using the Spotlight metadata attribute kMDItemDocumentLineage.

Functions by Task

Creating an MDLineage

Adding to, and removing from, a File

Functions

MDLineageCreate

Creates and returns a new, unique lineage.

CFDictionaryRef MDLineageCreate (
   CFAllocatorRef allocator
);
Parameters
allocator

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

Return Value

A new, globally unique lineage, or NULL if there was an error. Ownership follows the Create Rule.

Availability
Declared In
MDLineage.h

MDLineageCreateBranchFromFile

Creates and returns a new lineage descending from a given file.

CFDictionaryRef MDLineageCreateBranchFromFile (
   CFAllocatorRef allocator,
   CFURLRef fileURL
);
Parameters
allocator

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

file

The URL for a file from which to create branched lineage.

Return Value

A new lineage descending from the data in fileURL, or NULL if there was no lineage data associated with fileURL or if there was an error. Ownership follows the Create Rule.

Availability
Declared In
MDLineage.h

MDLineageCreateFromFile

Creates and returns a new, unique lineage using data from a given file.

CFDictionaryRef MDLineageCreateFromFile (
   CFAllocatorRef allocator,
   CFURLRef fileURL
);
Parameters
allocator

The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

fileURL

The URL for a file from which to copy lineage data.

Return Value

A new, globally unique lineage using the data from fileURL, or NULL if there was no lineage data associated with fileURL or if there was an error. Ownership follows the Create Rule.

Availability
Declared In
MDLineage.h

MDLineageRemoveFromFile

Removes any existing lineage from a given file.

Boolean MDLineageRemoveFromFile (
   CFURLRef fileURL
);
Parameters
file

The file from which to remove all lineage data.

Return Value

true if all lineage data was removed from the file at fileURL, otherwise false. If there was no lineage data on the file, returns true.

Availability
Declared In
MDLineage.h

MDLineageSetOnFile

Writes the given lineage data to a given file.

MDLineageSetOnFile (
   CFDictionaryRef lineage,
   CFURLRef fileURL
);
Parameters
lineage

Lineage data obtained from one of the MDLineageCreate functions.

file

The URL for a file on which to write the lineage.

Return Value

true if the operation succeeded, otherwise false.

Discussion

This function overwrites any lineage data already marked on the file.

Availability
Declared In
MDLineage.h


Last updated: 2006-07-13

Did this document help you? Yes It's good, but... Not helpful...