Carbon


Resource Attribute Constants

Header: Resources.h

enum {
    resSysHeap = 64,
    resPurgeable = 32,
    resLocked = 16,
    resProtected = 8,
    resPreload = 4,
    resChanged = 2,
    mapReadOnly = 128,
    mapCompact = 64,
    mapChanged = 32
};

Constant descriptions

resSysHeap

This attribute indicates whether the resource is read into the system heap (resSysHeap attribute is set to 1) or your application’s heap (resSysHeap attribute is set to 0).

If you are setting your resource’s attributes with SetResAttrs, you should set this bit to 0 for your application’s resources. Note that if you do set the resSysHeap attribute to 1 and the resource is too large for the system heap, the bit is cleared and the resource is read into the application heap.

resPurgeable

If this attribute is set to 1, the resource is purgeable; if it’s 0, the resource is nonpurgeable. However, do not use SetResAttrs to make a purgeable resource nonpurgeable.

Because a locked resource is nonrelocatable and nonpurgeable, the resLocked attribute overrides the resPurgeable attribute.

resLocked

If this attribute is 1, the resource is nonpurgeable regardless of whether resPurgeable is set. If it’s 0, the resource is purgeable or nonpurgeable depending on the value of the resPurgeable attribute.

resProtected

If this attribute is set to 1, your application can’t use Resource Manager functions to change the resource ID or resource name, modify the resource contents, or remove the resource from its resource fork. However, you can use the SetResAttrs function to remove this protection. Note that this attribute change takes effect immediately.

resPreload

If this attribute is set to 1, the Resource Manager reads the resource’s resource data into memory immediately after opening its resource fork. You can use this setting to make multiple resources available for your application as soon as possible, rather than reading each one into memory individually. If both the resPreload attribute and the resLocked attribute are set, the Resource Manager loads the resource as low in the heap as possible.

resChanged

If this attribute is set to 1, the resource has been changed; if it’s 0, the resource hasn’t been changed. This attribute is used only while the resource map is in memory. The resChanged attribute must be 0 in the resource fork on disk.

Do not use SetResAttrs to set the resChanged attribute. Be sure the attrs parameter passed to SetResAttrs doesn’t change the current setting of this attribute. To set the resChanged attribute, call the ChangedResource function.

mapReadOnly
mapCompact
mapChanged

The SetResAttrs and GetResAttrs functions use these constants to refer to each attribute.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)