CFUUID.h
 1  /*	CFUUID.h
 2  	Copyright (c) 1999-2019, Apple Inc. and the Swift project authors
 3   
 4  	Portions Copyright (c) 2014-2019, Apple Inc. and the Swift project authors
 5  	Licensed under Apache License v2.0 with Runtime Library Exception
 6  	See http://swift.org/LICENSE.txt for license information
 7  	See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 8  */
 9  
10  #if !defined(__COREFOUNDATION_CFUUID__)
11  #define __COREFOUNDATION_CFUUID__ 1
12  
13  #include <CoreFoundation/CFBase.h>
14  #include <CoreFoundation/CFString.h>
15  
16  CF_IMPLICIT_BRIDGING_ENABLED
17  CF_EXTERN_C_BEGIN
18  
19  typedef const struct CF_BRIDGED_TYPE(id) __CFUUID * CFUUIDRef;
20  
21  typedef struct {
22      UInt8 byte0;
23      UInt8 byte1;
24      UInt8 byte2;
25      UInt8 byte3;
26      UInt8 byte4;
27      UInt8 byte5;
28      UInt8 byte6;
29      UInt8 byte7;
30      UInt8 byte8;
31      UInt8 byte9;
32      UInt8 byte10;
33      UInt8 byte11;
34      UInt8 byte12;
35      UInt8 byte13;
36      UInt8 byte14;
37      UInt8 byte15;
38  } CFUUIDBytes;
39  /* The CFUUIDBytes struct is a 128-bit struct that contains the
40  raw UUID.  A CFUUIDRef can provide such a struct from the
41  CFUUIDGetUUIDBytes() function.  This struct is suitable for
42  passing to APIs that expect a raw UUID.
43  */
44          
45  CF_EXPORT
46  CFTypeID CFUUIDGetTypeID(void);
47  
48  CF_EXPORT
49  CFUUIDRef CFUUIDCreate(CFAllocatorRef alloc);
50      /* Create and return a brand new unique identifier */
51  
52  CF_EXPORT
53  CFUUIDRef CFUUIDCreateWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15);
54      /* Create and return an identifier with the given contents.  This may return an existing instance with its ref count bumped because of uniquing. */
55  
56  CF_EXPORT
57  CFUUIDRef CFUUIDCreateFromString(CFAllocatorRef alloc, CFStringRef uuidStr);
58      /* Converts from a string representation to the UUID.  This may return an existing instance with its ref count bumped because of uniquing. */
59  
60  CF_EXPORT
61  CFStringRef CFUUIDCreateString(CFAllocatorRef alloc, CFUUIDRef uuid);
62      /* Converts from a UUID to its string representation. */
63  
64  CF_EXPORT
65  CFUUIDRef CFUUIDGetConstantUUIDWithBytes(CFAllocatorRef alloc, UInt8 byte0, UInt8 byte1, UInt8 byte2, UInt8 byte3, UInt8 byte4, UInt8 byte5, UInt8 byte6, UInt8 byte7, UInt8 byte8, UInt8 byte9, UInt8 byte10, UInt8 byte11, UInt8 byte12, UInt8 byte13, UInt8 byte14, UInt8 byte15);
66      /* This returns an immortal CFUUIDRef that should not be released.  It can be used in headers to declare UUID constants with #define. */
67  
68  CF_EXPORT
69  CFUUIDBytes CFUUIDGetUUIDBytes(CFUUIDRef uuid);
70  
71  CF_EXPORT
72  CFUUIDRef CFUUIDCreateFromUUIDBytes(CFAllocatorRef alloc, CFUUIDBytes bytes);
73  
74  CF_EXTERN_C_END
75  CF_IMPLICIT_BRIDGING_DISABLED
76  
77  #endif /* ! __COREFOUNDATION_CFUUID__ */
78