]> git.saurik.com Git - apple/security.git/blame - libsecurity_transform/lib/c++utils.h
Security-55471.14.18.tar.gz
[apple/security.git] / libsecurity_transform / lib / c++utils.h
CommitLineData
b1ab9ed8
A
1#ifndef __CPLUSPLUS_UTILS__
2#define __CPLUSPLUS_UTILS__
3
4#include <string>
5#include <CoreFoundation/CoreFoundation.h>
6
7std::string StringFromCFString(CFStringRef theString);
8CFStringRef CFStringFromString(std::string theString);
9
10// class to automatically manage the lifetime of a CFObject
11
12class CFTypeRefHolder
13{
14private:
15 CFTypeRef mTypeRef;
16
17public:
18 CFTypeRefHolder(CFTypeRef typeRef) : mTypeRef(typeRef) {}
19 virtual ~CFTypeRefHolder();
20
21 void Set(CFTypeRef typeRef); // replace the value in the holder with another -- releases the current value
22 CFTypeRef Get() {return mTypeRef;}
23};
24
25
26
27#endif