// bytearrayconv.h: interface for the bytearrayconv class.
//
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000 Robert Cunnings. All rights reserved.
//
// You may copy, modify, distribute or publish this code free of charge.
//
// NO WARRANTY: This software is provided AS IS, without warranty of any kind.
//
//////////////////////////////////////////////////////////////////////
//
// Routines to convert to and from SAFEARRAY's of type VT_UI1.
// 
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BYTEARRAYCONV_H__B3AA67F1_5A35_42C6_BE8E_F2CF05B37564__INCLUDED_)
#define AFX_BYTEARRAYCONV_H__B3AA67F1_5A35_42C6_BE8E_F2CF05B37564__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>
using namespace std;

// byte array helpers for Base64 types
SAFEARRAY *ByteArrayFromString(const string& strSrc);
SAFEARRAY *ByteArrayFromWideString(const wstring& wstrSrc);
SAFEARRAY *ByteArrayFromBSTR(const BSTR bstrSrc);
SAFEARRAY *ByteArrayFromBuffer(const void *pvSrc, long lLength);

bool StringFromByteArray(SAFEARRAY *pArray, string& strDest);
bool WideStringFromByteArray(SAFEARRAY *pArray, wstring& wstrDest);
bool BSTRFromByteArray(SAFEARRAY *pArray, BSTR *pbstrDest);
bool BufferFromByteArray(SAFEARRAY *pArray, void **ppvDest, unsigned long *pLength);


#endif // !defined(AFX_BYTEARRAYCONV_H__B3AA67F1_5A35_42C6_BE8E_F2CF05B37564__INCLUDED_)
