1. spencercw
  2. gb_emulator

Source

gb_emulator / gb_debugger_msvs / properties / expression_property.cpp

/*  Copyright Š 2011 Chris Spencer <spencercw@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include "stdafx.h"

#include "expression_property.h"

#include <iomanip>
#include <sstream>
#include <string>

using std::hex;
using std::setfill;
using std::setw;
using std::wostringstream;
using std::wstring;

// IDebugProperty2 methods

HRESULT CExpressionProperty::GetPropertyInfo(
	DEBUGPROP_INFO_FLAGS dwFields,
	DWORD nRadix,
	DWORD dwTimeout,
	IDebugReference2 **rgpArgs,
	DWORD dwArgCount,
	DEBUG_PROPERTY_INFO *pPropertyInfo)
{
	(void) nRadix;
	(void) dwTimeout;
	(void) rgpArgs;
	(void) dwArgCount;

	memset(pPropertyInfo, 0, sizeof(*pPropertyInfo));

	if (dwFields & DEBUGPROP_INFO_ATTRIB)
	{
		pPropertyInfo->dwFields |= DEBUGPROP_INFO_ATTRIB;
		pPropertyInfo->dwAttrib = DBG_ATTRIB_VALUE_READONLY | DBG_ATTRIB_ACCESS_NONE |
			DBG_ATTRIB_TYPE_NONE | DBG_ATTRIB_DATA;
	}
	if (dwFields & DEBUGPROP_INFO_PROP)
	{
		pPropertyInfo->dwFields |= DEBUGPROP_INFO_PROP;
		pPropertyInfo->pProperty = this;
		pPropertyInfo->pProperty->AddRef();
	}

	return S_OK;
}

HRESULT CExpressionProperty::SetValueAsString(
	const OLECHAR *pszValue,
	DWORD nRadix,
	DWORD dwTimeout)
{
	(void) pszValue;
	(void) nRadix;
	(void) dwTimeout;

	return E_NOTIMPL;
}

HRESULT CExpressionProperty::SetValueAsReference(
	IDebugReference2 **rgpArgs,
	DWORD dwArgCount,
	IDebugReference2 *pValue,
	DWORD dwTimeout)
{
	(void) rgpArgs;
	(void) dwArgCount;
	(void) pValue;
	(void) dwTimeout;

	return E_NOTIMPL;
}

HRESULT CExpressionProperty::EnumChildren(
	DEBUGPROP_INFO_FLAGS dwFields,
	DWORD dwRadix,
	const GUID &guidFilter,
	DBG_ATTRIB_FLAGS dwAttribFilter,
	const OLECHAR *pszNameFilter,
	DWORD dwTimeout,
	IEnumDebugPropertyInfo2 **ppEnum)
{
	(void) dwFields;
	(void) dwRadix;
	(void) guidFilter;
	(void) dwAttribFilter;
	(void) pszNameFilter;
	(void) dwTimeout;

	if (!ppEnum)
	{
		return E_POINTER;
	}

	*ppEnum = NULL;
	return S_FALSE;
}

HRESULT CExpressionProperty::GetParent(IDebugProperty2 **ppParent)
{
	if (!ppParent)
	{
		return E_POINTER;
	}

	*ppParent = NULL;
	return S_GETPARENT_NO_PARENT;
}

HRESULT CExpressionProperty::GetDerivedMostProperty(IDebugProperty2 **ppDerivedMost)
{
	(void) ppDerivedMost;

	return E_NOTIMPL;
}

HRESULT CExpressionProperty::GetMemoryBytes(IDebugMemoryBytes2 **ppMemoryBytes)
{
	(void) ppMemoryBytes;

	return E_NOTIMPL;
}

HRESULT CExpressionProperty::GetMemoryContext(IDebugMemoryContext2 **ppMemory)
{
	if (!ppMemory)
	{
		return E_POINTER;
	}

	*ppMemory = memoryContext_;
	(*ppMemory)->AddRef();
	return S_OK;
}

HRESULT CExpressionProperty::GetSize(DWORD *pdwSize)
{
	(void) pdwSize;

	return E_NOTIMPL;
}

HRESULT CExpressionProperty::GetReference(IDebugReference2 **ppReference)
{
	(void) ppReference;

	return E_NOTIMPL;
}

HRESULT CExpressionProperty::GetExtendedInfo(const GUID &guidExtendedInfo, VARIANT *pExtendedInfo)
{
	(void) guidExtendedInfo;
	(void) pExtendedInfo;

	return E_NOTIMPL;
}

// CExpressionProperty methods

void CExpressionProperty::Init(IDebugMemoryContext2 *memoryContext)
{
	memoryContext_ = memoryContext;
}