⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 variantexception.htm

📁 The goal of this library is to make ODBC recordsets look just like an STL container. As a user, you
💻 HTM
字号:
<html>


<head>
<style>
CODE {COLOR: #990000;}
.code{COLOR: #990000}
.codeComment{COLOR: #008000}
.codeHighlight{BACKGROUND-COLOR: #FFFF00}
.codeFileName{FONT-WEIGHT: bold;}
</style>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Gradman">
<meta name="KeyWords"
content="DTL, Oracle, ODBC, database API, C++, Template Library">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<!--
  -- Copyright 2000
  -- Michael Gradman & Corwin Joy
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Corwin Joy & Michael Gradman make no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  --
  --
  -- Copyright (c) 1996-1999
  -- Silicon Graphics Computer Systems, Inc.
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Silicon Graphics makes no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  --
  -- Copyright (c) 1994
  -- Hewlett-Packard Company
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Hewlett-Packard Company makes no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  --
  -->
<!-- Generated by htmldoc -->
<title>VariantException</title>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000EE"
vlink="#551A8B" alink="#FF0000">

<p><font size="6" face="Bookman Old Style"><em><strong><u>dtl</u></strong></em></font></p>

<p><img src="stat.gif" width="6" height="6"> <!--end header--> <br>
</p>
<h1>VariantException</h1>



















<table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td><img src="exceptions.gif" width="194" height="38"></td>
        <td align="right"><img src="type.gif" width="194"
        height="39"></td>
    </tr>
    <tr>
        <td valign="top"><b>Category</b>: exceptions</td>
        <td align="right" valign="top"><b>Component type</b>:
        type</td>
    </tr>
</table>
<h3>Description</h3>

<p><tt>VariantException</tt> is thrown by the variant classes in
the DTL, usually when a variant cannot internally be converted
from one type to another or when a variant object receives an
object of a type it does not know how to handle. An exception of
this type stores strings representing which method the exception
was thrown in and a message describing what error occurred. The
call to the constructor initializes these strings. The user can
extract a stringified message with all of this information from
the exception using the standard <font size="2"
face="Courier New">what() </font><font size="3">method.</font></p>

<h3>Definition</h3>

<p>Defined in the <font size="2" face="Courier New">VariantException.h</font><font
size="1" face="Courier New"> </font>header file. </p>

<h3>Example: Trivial case of throwing and catching a
VariantException</h3>

<p><code>class UnknownToVariant<br>
{ <br>
};<br>
<br>
void IWillThrow()<br>
{ <br>
&nbsp; &nbsp;variant_t v = UnknownToVariant(); <span class="codeComment">// create a
variant using a type that variant_t can't convert</span><br>
&nbsp;&nbsp;&nbsp;char *str = v; <span class="codeComment">// unknown conversion will cause
this statement to throw a VariantException</span><br>
}<br>
<br>
<br>
int main()<br>
{<br>
&nbsp;&nbsp;&nbsp;try<br>
&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="codeComment">// call our method which
throws</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IWillThrow();<br>
&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;catch (RootException &amp;ex)<br>
&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="codeComment">// can also say: cout
&lt;&lt; ex &lt;&lt; endl;</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="codeComment">// operator&lt;&lt;() for
RootExceptions just streams out what()</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; ex.what()
&lt;&lt; endl;<br>
&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;return 0; <span class="codeComment">// won't reach here ... exception
thrown above</span><br>
}</code></p>

<h3>Model of</h3>

<p>Standard C++ library exception.</p>

<h3>Public base classes</h3>

<p><font size="2" face="Courier New">RootException</font></p>

<h3>Members</h3>

<table border="2">
    <tr>
        <th>Member </th>
        <th>Where defined </th>
        <th>Description </th>
    </tr>
    <tr>
        <td valign="top"><font size="2" face="Courier New">VariantException(const
        string &amp;meth, const string &amp;err)</font></td>
        <td valign="top"><tt>VariantException</tt> </td>
        <td valign="top">Constructor which takes a specific
        method and error string.</td>
    </tr>
    <tr>
        <td valign="top"><font size="2" face="Courier New">virtual
        const char* what() const throw()</font></td>
        <td valign="top"><tt>RootException</tt> </td>
        <td valign="top">Overrides behavior in <font size="2"
        face="Courier New">std::exception. </font><font size="3">Returns
        a C string describing the exception, including the method
        it was thrown in, the error message describing why it was
        thrown, and what type of exception was thrown. Subclasses
        do and may override </font><font size="2"
        face="Courier New">what() </font>based on their needs. <font
        size="3">See Note </font><a href="RootException.htm#1"><font
        size="3">[1]</font></a><font size="3"> in class </font><a
        href="RootException.htm"><font size="2"
        face="Courier New">RootException</font></a><font size="3">.</font></td>
    </tr>
    <tr>
        <td valign="top"><tt>friend ostream &amp;operator&lt;&lt;(ostream
        &amp;o, const RootException &amp;ex)</tt></td>
        <td valign="top"><tt>RootException</tt> </td>
        <td valign="top">Note that this is a friend function, and
        not a member. Streams out <font size="2"
        face="Courier New">ex.what()</font><font size="3"> to </font><font
        size="2" face="Courier New">o.</font><font size="3"> As </font><font
        size="2" face="Courier New">what() </font><font size="3">is
        virtual, the appropriate version of that method will be
        called for </font><font size="2" face="Courier New">ex.</font></td>
    </tr>
</table>

<h3>Notes</h3>

<p>None.<font size="3"><tt><br>
</tt></font></p>

<h3>See also</h3>

<p><a href="RootException.htm"><font size="2" face="Courier New">RootException</font></a>.<br>
<br>
</p>


<hr>

<p><a href="index.htm"><img src="dtl_home.gif" alt="[DTL Home]"
width="54" height="54"></a> <br>
</p>

<p>Copyright 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -