OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
except.cpp
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectComponents
3// Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6// OLE Exception classes
7//----------------------------------------------------------------------------
8#include <ocf/pch.h>
9#include <ocf/defs.h>
10#include <ocf/oleutil.h>
11#include <owl/string.h>
12
13
14namespace ocf {
15
16using namespace owl;
17
18//
19//
20//
22{
23}
24
25//
26//
27//
28TXOle*
30{
31 return new TXOle(*this);
32}
33
34//
35//
36//
37void
39{
40 throw *this;
41}
42
43//
44//
45//
46void
48{
49 if (FAILED(hr))
50 Throw(hr, msg);
51}
52
53//
54//
55//
56void
58{
59 Check(hr, 0);
60}
61
62//
63//
64//
65void
67{
68 int msg_len = msg ? static_cast<int>(_tcslen(msg)) : 0;
69 TAPointer<_TCHAR> buf(new _TCHAR[256 + msg_len]);
70 wsprintf(buf, _T("%s failed, "), msg ? msg : _T("OLE call"));
71
72 int len = static_cast<int>(_tcslen(buf));
73 OleErrorFromCode(hr, buf + len, 256 + msg_len - len - 2);
74 _tcscat(buf, _T("."));
75
76 WARN(hr != HR_NOERROR, buf);
77 throw TXOle((_TCHAR*)buf, hr);
78}
79
80//
81//
82//
83void
85{
87 int len = static_cast<int>(_tcslen(error.c_str()));
88 len = len > size ? len-1 : size-1;
89 _tcsncpy(buffer,error.c_str(),len);
90 buffer[len] = 0;
91}
92
93} // OCF namespace
94
95//==============================================================================
96
97
#define WARN(condition, message)
Definition checks.h:273
OLE API related exception object.
Definition except.h:33
static void Check(HRESULT stat, LPCTSTR msg)
Definition except.cpp:47
TXOle(const owl::tstring &msg, HRESULT stat)
Definition except.h:58
static void OleErrorFromCode(HRESULT stat, TCHAR *buffer, int size)
Definition except.cpp:84
void Throw()
Definition except.cpp:38
TXOle * Clone()
Definition except.cpp:29
#define _tcscat
Definition cygwin.h:83
#define _tcsncpy
Definition cygwin.h:80
#define _tcslen
Definition cygwin.h:74
#define _T(x)
Definition cygwin.h:51
const tstring & SysMessage() const
Definition module.h:1560
Include for OC, gets common headers when precompiled headers are enabled.
Object Component Framework (COM encapsulation)
Definition appdesc.h:22
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
std::string tstring
Definition defs.h:79
ObjectComponents fundamental definitions.
#define HR_NOERROR
Definition defs.h:73
Low level OLE Utility class definitions.
Definition of class TString, a flexible universal string envelope class.