File: //opt/alt/alt-nodejs24/root/usr/share/doc/alt-nodejs24-libicu-doc/uobject_8h.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ICU 77.1: common/unicode/uobject.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">ICU 77.1
 <span id="projectnumber">77.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_bdd9a5d540de89e9fe90efdfc6973a4f.html">common</a></li><li class="navelem"><a class="el" href="dir_f59c6450ff718ff1b085cfd1c36acbd7.html">unicode</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> |
<a href="#namespaces">Namespaces</a> |
<a href="#define-members">Macros</a> |
<a href="#typedef-members">Typedefs</a> </div>
<div class="headertitle">
<div class="title">uobject.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>C++ API: Common ICU base class UObject.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include "<a class="el" href="utypes_8h_source.html">unicode/utypes.h</a>"</code><br />
<code>#include "<a class="el" href="platform_8h_source.html">unicode/platform.h</a>"</code><br />
</div>
<p><a href="uobject_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classicu_1_1UMemory.html">icu::UMemory</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classicu_1_1UMemory.html" title="UMemory is the common ICU base class. ">UMemory</a> is the common ICU base class. <a href="classicu_1_1UMemory.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classicu_1_1UObject.html">icu::UObject</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classicu_1_1UObject.html" title="UObject is the common ICU "boilerplate" class. ">UObject</a> is the common ICU "boilerplate" class. <a href="classicu_1_1UObject.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespaceicu"><td class="memItemLeft" align="right" valign="top">  </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceicu.html">icu</a></td></tr>
<tr class="memdesc:namespaceicu"><td class="mdescLeft"> </td><td class="mdescRight">File <a class="el" href="coll_8h.html" title="C++ API: Collation Service. ">coll.h</a>. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:af7c94be4153b43ae35af9fe0447c9d3f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="uobject_8h.html#af7c94be4153b43ae35af9fe0447c9d3f">U_NO_THROW</a>   noexcept</td></tr>
<tr class="memdesc:af7c94be4153b43ae35af9fe0447c9d3f"><td class="mdescLeft"> </td><td class="mdescRight"><pre class="fragment"> Since ICU 64, use noexcept instead.</pre> <a href="#af7c94be4153b43ae35af9fe0447c9d3f">More...</a><br /></td></tr>
<tr class="separator:af7c94be4153b43ae35af9fe0447c9d3f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0415b3e188980bcb82e31c091265f34b"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="uobject_8h.html#a0415b3e188980bcb82e31c091265f34b">UOBJECT_DEFINE_RTTI_IMPLEMENTATION</a>(myClass)</td></tr>
<tr class="memdesc:a0415b3e188980bcb82e31c091265f34b"><td class="mdescLeft"> </td><td class="mdescRight">This is a simple macro to add ICU RTTI to an ICU object implementation. <a href="#a0415b3e188980bcb82e31c091265f34b">More...</a><br /></td></tr>
<tr class="separator:a0415b3e188980bcb82e31c091265f34b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa53bdd883d784e4c951b051faffc29d0"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="uobject_8h.html#aa53bdd883d784e4c951b051faffc29d0">UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION</a>(myClass)</td></tr>
<tr class="memdesc:aa53bdd883d784e4c951b051faffc29d0"><td class="mdescLeft"> </td><td class="mdescRight">This macro adds ICU RTTI to an ICU abstract class implementation. <a href="#aa53bdd883d784e4c951b051faffc29d0">More...</a><br /></td></tr>
<tr class="separator:aa53bdd883d784e4c951b051faffc29d0"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a22af10545208a455a6e884008df48e9f"><td class="memItemLeft" align="right" valign="top">typedef void * </td><td class="memItemRight" valign="bottom"><a class="el" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a></td></tr>
<tr class="memdesc:a22af10545208a455a6e884008df48e9f"><td class="mdescLeft"> </td><td class="mdescRight">UClassID is used to identify classes without using the compiler's RTTI. <a href="#a22af10545208a455a6e884008df48e9f">More...</a><br /></td></tr>
<tr class="separator:a22af10545208a455a6e884008df48e9f"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>C++ API: Common ICU base class UObject. </p>
<p class="definition">Definition in file <a class="el" href="uobject_8h_source.html">uobject.h</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="af7c94be4153b43ae35af9fe0447c9d3f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af7c94be4153b43ae35af9fe0447c9d3f">◆ </a></span>U_NO_THROW</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define U_NO_THROW   noexcept</td>
</tr>
</table>
</div><div class="memdoc">
<p><pre class="fragment"> Since ICU 64, use noexcept instead.</pre> </p>
<p>Previously, define this to define the throw() specification so certain functions do not throw any exceptions</p>
<p>UMemory operator new methods should have the throw() specification appended to them, so that the compiler adds the additional nullptr check before calling constructors. Without, if <code>operator new</code> returns nullptr the constructor is still called, and if the constructor references member data, (which it typically does), the result is a segmentation violation.</p>
<dl class="stable"><dt><b><a class="el" href="stable.html#_stable002804">Stable:</a></b></dt><dd>ICU 4.2. Since ICU 64, Use noexcept instead. See ICU-20422. </dd></dl>
<p class="definition">Definition at line <a class="el" href="uobject_8h_source.html#l00049">49</a> of file <a class="el" href="uobject_8h_source.html">uobject.h</a>.</p>
</div>
</div>
<a id="aa53bdd883d784e4c951b051faffc29d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa53bdd883d784e4c951b051faffc29d0">◆ </a></span>UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">myClass</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> U_EXPORT2 myClass::getStaticClassID() { \</div><div class="line"> static <span class="keywordtype">char</span> classID = 0; \</div><div class="line"> return (<a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a>)&classID; \</div><div class="line"> }</div><div class="ttc" id="uobject_8h_html_a22af10545208a455a6e884008df48e9f"><div class="ttname"><a href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a></div><div class="ttdeci">void * UClassID</div><div class="ttdoc">UClassID is used to identify classes without using the compiler&#39;s RTTI. </div><div class="ttdef"><b>Definition:</b> <a href="uobject_8h_source.html#l00096">uobject.h:96</a></div></div>
</div><!-- fragment -->
<p>This macro adds ICU RTTI to an ICU abstract class implementation. </p>
<p>This macro should be invoked in *.cpp files. The corresponding header should declare getStaticClassID.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">myClass</td><td>The name of the class that needs RTTI defined. </td></tr>
</table>
</dd>
</dl>
<dl class="internal"><dt><b><a class="el" href="internal.html#_internal000164">Internal:</a></b></dt><dd>Do not use. This API is for internal use only. </dd></dl>
<p class="definition">Definition at line <a class="el" href="uobject_8h_source.html#l00312">312</a> of file <a class="el" href="uobject_8h_source.html">uobject.h</a>.</p>
</div>
</div>
<a id="a0415b3e188980bcb82e31c091265f34b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0415b3e188980bcb82e31c091265f34b">◆ </a></span>UOBJECT_DEFINE_RTTI_IMPLEMENTATION</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION</td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname">myClass</td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> U_EXPORT2 myClass::getStaticClassID() { \</div><div class="line"> static <span class="keywordtype">char</span> classID = 0; \</div><div class="line"> return (<a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a>)&classID; \</div><div class="line"> } \</div><div class="line"> UClassID myClass::getDynamicClassID() const \</div><div class="line"> { <span class="keywordflow">return</span> myClass::getStaticClassID(); }</div><div class="ttc" id="uobject_8h_html_a22af10545208a455a6e884008df48e9f"><div class="ttname"><a href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a></div><div class="ttdeci">void * UClassID</div><div class="ttdoc">UClassID is used to identify classes without using the compiler&#39;s RTTI. </div><div class="ttdef"><b>Definition:</b> <a href="uobject_8h_source.html#l00096">uobject.h:96</a></div></div>
</div><!-- fragment -->
<p>This is a simple macro to add ICU RTTI to an ICU object implementation. </p>
<p>This does not go into the header. This should only be used in *.cpp files.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">myClass</td><td>The name of the class that needs RTTI defined. </td></tr>
</table>
</dd>
</dl>
<dl class="internal"><dt><b><a class="el" href="internal.html#_internal000163">Internal:</a></b></dt><dd>Do not use. This API is for internal use only. </dd></dl>
<p class="definition">Definition at line <a class="el" href="uobject_8h_source.html#l00295">295</a> of file <a class="el" href="uobject_8h_source.html">uobject.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="a22af10545208a455a6e884008df48e9f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a22af10545208a455a6e884008df48e9f">◆ </a></span>UClassID</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef void* <a class="el" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>UClassID is used to identify classes without using the compiler's RTTI. </p>
<p>This was used before C++ compilers consistently supported RTTI. ICU 4.6 requires compiler RTTI to be turned on.</p>
<p>Each class hierarchy which needs to implement polymorphic clone() or <a class="el" href="namespaceicu.html#a1c2f6ca43e636f38d1a3291eb851e9f0" title="Global operator == for StringPiece. ">operator==()</a> defines two methods, described in detail below. UClassID values can be compared using <a class="el" href="namespaceicu.html#a1c2f6ca43e636f38d1a3291eb851e9f0" title="Global operator == for StringPiece. ">operator==()</a>. Nothing else should be done with them.</p>
<dl class="section user"><dt></dt><dd>In class hierarchies that implement "poor man's RTTI", each concrete subclass implements getDynamicClassID() in the same way:</dd></dl>
<div class="fragment"><div class="line"><span class="keyword">class </span>Derived {</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="keyword">virtual</span> <a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> getDynamicClassID()<span class="keyword"> const</span></div><div class="line"><span class="keyword"> </span>{ <span class="keywordflow">return</span> Derived::getStaticClassID(); }</div><div class="line">}</div></div><!-- fragment --><p>Each concrete class implements getStaticClassID() as well, which allows clients to test for a specific type.</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>Derived {</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> <span class="keyword">static</span> <a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> U_EXPORT2 getStaticClassID();</div><div class="line"><span class="keyword">private</span>:</div><div class="line"> <span class="keyword">static</span> <span class="keywordtype">char</span> fgClassID;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="comment">// In Derived.cpp:</span></div><div class="line"><a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a> Derived::getStaticClassID()</div><div class="line"> { <span class="keywordflow">return</span> (<a class="code" href="uobject_8h.html#a22af10545208a455a6e884008df48e9f">UClassID</a>)&Derived::fgClassID; }</div><div class="line"><span class="keywordtype">char</span> Derived::fgClassID = 0; <span class="comment">// Value is irrelevant</span></div></div><!-- fragment --> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable002805">Stable:</a></b></dt><dd>ICU 2.0 </dd></dl>
<p class="definition">Definition at line <a class="el" href="uobject_8h_source.html#l00096">96</a> of file <a class="el" href="uobject_8h_source.html">uobject.h</a>.</p>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>