#[repr(C)]pub struct CGImageMetadataTag { /* private fields */ }
CGImageMetadata
only.Expand description
an individual metadata tag
A CGImageMetadataTag encapsulates an EXIF, IPTC, or XMP property. All tags contain a namespace, prefix, name, type, and value. Please see
CGImageMetadataTagCreate
for more details.
See also Apple’s documentation
Implementations§
Source§impl CGImageMetadataTag
impl CGImageMetadataTag
Sourcepub unsafe fn new(
xmlns: &CFString,
prefix: Option<&CFString>,
name: &CFString,
type: CGImageMetadataType,
value: &CFType,
) -> Option<CFRetained<CGImageMetadataTag>>
pub unsafe fn new( xmlns: &CFString, prefix: Option<&CFString>, name: &CFString, type: CGImageMetadataType, value: &CFType, ) -> Option<CFRetained<CGImageMetadataTag>>
Creates a new CGImageMetadataTag
Parameter xmlns
: The namespace for the tag. The value can be a common XMP namespace
defined above, such as kCGImageMetadataNamespaceExif, or a CFString with a
custom namespace URI. Custom namespaces must be a valid XML namespace. By
convention, namespaces should end with either ‘/’ or ‘#’. For example, exif
uses the namespace “http://ns.adobe.com/exif/1.0/”.
Parameter prefix
: An abbreviation for the XML namespace. The value can be NULL if
the namespace is defined as a constant. Custom prefixes must be a valid XML
name. For example, the prefix used for “http://ns.adobe.com/exif/1.0/” is “exif”.
The XMP serialization of the tag will use the prefix. Prefixes are also
important for path-based CGImageMetadata functions, such as
CGImageMetadataCopyStringValueWithPath
or
CGImageMetadataSetValueWithPath
.
Parameter name
: The name of the tag. It must be a valid XMP name.
Parameter type
: The type of the tag’s value. Must be a constant from
CGImageMetadataType
.
Parameter value
: The value of the tag. Allowable CFTypes include CFStringRef,
CFNumberRef, CFBooleanRef, CFArrayRef, and CFDictionaryRef. The CFType of ‘value’
must correspond to the ‘type’. The elements of a CFArray must be either a
CFStringRef or CGImageMetadataTagRef. The keys of a CFDictionary must be
CFStringRefs with valid XMP names. The values of a CFDictionary must be either
CFStringRefs or CGImageMetadataTagRefs. A shallow copy of the value is stored
in the tag. Therefore, modifying a mutable value after the tag is created
will not affect the tag’s value.
Returns: Returns a pointer to a new CGImageMetadataTag. Returns NULL if a tag could not be created with the specified parameters.
Sourcepub unsafe fn namespace(
self: &CGImageMetadataTag,
) -> Option<CFRetained<CFString>>
pub unsafe fn namespace( self: &CGImageMetadataTag, ) -> Option<CFRetained<CFString>>
*!
Returns a copy of the tag’s namespace
Sourcepub unsafe fn prefix(self: &CGImageMetadataTag) -> Option<CFRetained<CFString>>
pub unsafe fn prefix(self: &CGImageMetadataTag) -> Option<CFRetained<CFString>>
Returns a copy of the tag’s prefix
Sourcepub unsafe fn name(self: &CGImageMetadataTag) -> Option<CFRetained<CFString>>
pub unsafe fn name(self: &CGImageMetadataTag) -> Option<CFRetained<CFString>>
Returns a copy of the tag’s name
Sourcepub unsafe fn value(self: &CGImageMetadataTag) -> Option<CFRetained<CFType>>
pub unsafe fn value(self: &CGImageMetadataTag) -> Option<CFRetained<CFType>>
Returns a shallow copy of the tag’s value
This function should only be used to read the tag’s value. CGImageMetadataCopyTagWithPath returns a copy of the tag (including a copy of the tag’s value). Therefore mutating a tag’s value returned from this function may not actually mutate the value in the CGImageMetadata. It is recommended to create a new tag followed by CGImageMetadataSetTagWithPath, or use CGImageMetadataSetValueWithPath to mutate a metadata value.
Sourcepub unsafe fn type(self: &CGImageMetadataTag) -> CGImageMetadataType
pub unsafe fn type(self: &CGImageMetadataTag) -> CGImageMetadataType
Get the type of the CGImageMetadataTag
Returns: Returns a CGImageMetadataType constant for the CGImageMetadataTag. This is primarily used to determine how to interpret the tag’s value.
Sourcepub unsafe fn qualifiers(
self: &CGImageMetadataTag,
) -> Option<CFRetained<CFArray>>
pub unsafe fn qualifiers( self: &CGImageMetadataTag, ) -> Option<CFRetained<CFArray>>
Return a copy of the tag’s qualifiers
XMP allows properties to contain supplemental properties called qualifiers. Qualifiers are themselves CGImageMetadataTags with their own namespace, prefix, name, and value. A common use is the xml:lang qualifier for elements of an alternate-text array.
Returns: Returns a copy of the array of qualifiers. Elements of the array are CGImageMetadataTags. Returns NULL if the tag does not have any qualifiers. The copy is shallow, the qualifiers are not deep copied.
Methods from Deref<Target = CFType>§
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: ConcreteType,
Attempt to downcast the type to that of type T
.
This is the reference-variant. Use CFRetained::downcast
if you
want to convert a retained type. See also ConcreteType
for more
details on which types support being converted to.
Sourcepub fn retain_count(&self) -> usize
pub fn retain_count(&self) -> usize
Get the reference count of the object.
This function may be useful for debugging. You normally do not use this function otherwise.
Beware that some things (like CFNumber
s, small CFString
s etc.) may
not have a normal retain count for optimization purposes, and can
return usize::MAX
in that case.
Trait Implementations§
Source§impl AsRef<AnyObject> for CGImageMetadataTag
impl AsRef<AnyObject> for CGImageMetadataTag
Source§impl AsRef<CFType> for CGImageMetadataTag
impl AsRef<CFType> for CGImageMetadataTag
Source§impl AsRef<CGImageMetadataTag> for CGImageMetadataTag
impl AsRef<CGImageMetadataTag> for CGImageMetadataTag
Source§impl Borrow<AnyObject> for CGImageMetadataTag
impl Borrow<AnyObject> for CGImageMetadataTag
Source§impl Borrow<CFType> for CGImageMetadataTag
impl Borrow<CFType> for CGImageMetadataTag
Source§impl ConcreteType for CGImageMetadataTag
impl ConcreteType for CGImageMetadataTag
Source§impl Debug for CGImageMetadataTag
impl Debug for CGImageMetadataTag
Source§impl Deref for CGImageMetadataTag
impl Deref for CGImageMetadataTag
Source§impl Hash for CGImageMetadataTag
impl Hash for CGImageMetadataTag
Source§impl Message for CGImageMetadataTag
impl Message for CGImageMetadataTag
Source§impl PartialEq for CGImageMetadataTag
impl PartialEq for CGImageMetadataTag
Source§impl RefEncode for CGImageMetadataTag
impl RefEncode for CGImageMetadataTag
Source§const ENCODING_REF: Encoding
const ENCODING_REF: Encoding
Source§impl Type for CGImageMetadataTag
impl Type for CGImageMetadataTag
Source§fn retain(&self) -> CFRetained<Self>where
Self: Sized,
fn retain(&self) -> CFRetained<Self>where
Self: Sized,
Source§fn as_concrete_TypeRef(&self) -> &Self
fn as_concrete_TypeRef(&self) -> &Self
core-foundation
crate.Source§unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation
crate. Read moreSource§fn as_CFTypeRef(&self) -> &CFType
fn as_CFTypeRef(&self) -> &CFType
core-foundation
crate.Source§unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>where
Self: Sized,
core-foundation
crate. Read more