/*
*********************************************************************
*
*	The Essence of OLE
*
*	Source code sample
*
*	Copyright (c) 1996, Rolling Thunder Computing, Ipswich MA
*
*	e-mail: essence@rollthunder.com
*	CompuServe: 73540,3430
*	Web: http://www.rollthunder.com
*
*********************************************************************
*/

#include <windows.h>
#include "scripterror.h"


CScriptError::CScriptError  (void)
{
	m_RefCount = 1 ;
}

CScriptError::~CScriptError (void)
{

}


STDMETHODIMP CScriptError::GetExceptionInfo(EXCEPINFO *pexcepinfo)
{
	return S_OK ;
}

STDMETHODIMP CScriptError::GetSourcePosition(DWORD *pdwSourceContext, ULONG *pulLineNumber, LONG *plCharacterPosition)
{
	return S_OK ;
}

STDMETHODIMP CScriptError::GetSourceLineText(BSTR *pbstrSourceLine)
{
	return S_OK ;
}


		
STDMETHODIMP CScriptError::QueryInterface(REFIID riid, LPVOID *ppv)
{
    if (riid == IID_IUnknown || riid == IID_IActiveScriptError)
	{
        *ppv = (void **)this;
		AddRef( ) ;
		return NOERROR;
	}
	else
	{
    	*ppv = NULL ;
    	return  E_NOINTERFACE ;
	}
}


STDMETHODIMP_(ULONG) CScriptError::AddRef(void)
{
    return ++m_RefCount;
}


STDMETHODIMP_(ULONG) CScriptError::Release(void)
{
	m_RefCount -- ;

    if (m_RefCount == 0)
	{
        delete this;
		return 0 ;
	}

    return m_RefCount ;
}

