+++ /dev/null
-//===-- CFData.cpp ----------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Created by Greg Clayton on 1/16/08.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CFData.h"
-
-//----------------------------------------------------------------------
-// CFData constructor
-//----------------------------------------------------------------------
-CFData::CFData(CFDataRef data) :
- CFReleaser<CFDataRef>(data)
-{
-
-}
-
-//----------------------------------------------------------------------
-// CFData copy constructor
-//----------------------------------------------------------------------
-CFData::CFData(const CFData& rhs) :
- CFReleaser<CFDataRef>(rhs)
-{
-
-}
-
-//----------------------------------------------------------------------
-// Destructor
-//----------------------------------------------------------------------
-CFData::~CFData()
-{
-}
-
-
-CFIndex
-CFData::GetLength() const
-{
- CFDataRef data = get();
- if (data)
- return CFDataGetLength (data);
- return 0;
-}
-
-
-const uint8_t*
-CFData::GetBytePtr() const
-{
- CFDataRef data = get();
- if (data)
- return CFDataGetBytePtr (data);
- return NULL;
-}
-
-CFDataRef
-CFData::Serialize(CFPropertyListRef plist, CFPropertyListFormat format)
-{
- CFAllocatorRef alloc = kCFAllocatorDefault;
- reset();
- CFReleaser<CFWriteStreamRef> stream (::CFWriteStreamCreateWithAllocatedBuffers (alloc, alloc));
- ::CFWriteStreamOpen (stream.get());
- CFIndex len = ::CFPropertyListWriteToStream (plist, stream.get(), format, NULL);
- if (len > 0)
- reset((CFDataRef)::CFWriteStreamCopyProperty (stream.get(), kCFStreamPropertyDataWritten));
- ::CFWriteStreamClose (stream.get());
- return get();
-}
-
+++ /dev/null
-//===-- CFData.h ------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Created by Greg Clayton on 1/16/08.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef __CFData_h__
-#define __CFData_h__
-
-#include "CFUtils.h"
-
-class CFData : public CFReleaser<CFDataRef>
-{
-public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- CFData(CFDataRef data = NULL);
- CFData(const CFData& rhs);
- virtual ~CFData();
-
- CFDataRef Serialize(CFPropertyListRef plist, CFPropertyListFormat format);
- const uint8_t* GetBytePtr () const;
- CFIndex GetLength () const;
-protected:
- //------------------------------------------------------------------
- // Classes that inherit from CFData can see and modify these
- //------------------------------------------------------------------
-};
-
-#endif // #ifndef __CFData_h__