-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScrError.h
More file actions
69 lines (64 loc) · 1.62 KB
/
ScrError.h
File metadata and controls
69 lines (64 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright(c) 2000 arton
*
* You may distribute under the terms of either the GNU General Public
* License
*
* $Date: 2006-11-04 17:29:08 +0900 (Sat, 04 11 2006) $
*/
#ifndef RSCRERROR_HEADER
#define RSCRERROR_HEADER
class CScrError : public IActiveScriptError
{
public:
CScrError(VALUE info);
CScrError(VALUE info, LPCSTR str, int offset = 0);
CScrError(LPCSTR);
HRESULT STDMETHODCALLTYPE QueryInterface(
const IID & riid,
void **ppvObj)
{
if (!ppvObj) return E_POINTER;
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IActiveScriptError))
{
InterlockedIncrement(&m_lRefCount);
*ppvObj = this;
return S_OK;
}
return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE AddRef()
{
return InterlockedIncrement(&m_lRefCount);
}
ULONG STDMETHODCALLTYPE Release()
{
if (InterlockedDecrement(&m_lRefCount) == 0)
{
delete this;
return 0;
}
return m_lRefCount;
}
HRESULT STDMETHODCALLTYPE GetExceptionInfo(
EXCEPINFO *pexcepinfo // structure for exception information
);
HRESULT STDMETHODCALLTYPE GetSourcePosition(
DWORD *pdwSourceContext, // context cookie
ULONG *pulLineNumber, // line number of error
LONG *pichCharPosition // character position of error
);
HRESULT STDMETHODCALLTYPE GetSourceLineText(
BSTR *pbstrSourceLine // address of buffer for source line
);
private:
void CreateErrorBase(VALUE v);
int GetErrorLine();
void SetSource(LPCSTR);
LONG m_lRefCount;
int m_nLine;
std::string m_strMessage;
std::string m_strBacktrace;
std::string m_strSource;
};
#endif