blob: b17093976ea9767eb9c1c39c047724e4e2728ee0 [file] [log] [blame]
{{+bindTo:partials.standard_nacl_api}}
<h1>pp::IMEInputEvent Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::IMEInputEvent" --><!-- doxytag: inherits="pp::InputEvent" --><div class="dynheader">
Inheritance diagram for pp::IMEInputEvent:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_i_m_e_input_event__inherit__graph.png" border="0" usemap="#pp_1_1_i_m_e_input_event_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_i_m_e_input_event_inherit__map" id="pp_1_1_i_m_e_input_event_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_input_event.html" title="This class represents an input event resource." alt="" coords="15,80,129,107"></area><area shape="rect" id="node3" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="20,5,124,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_i_m_e_input_event-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a44a2a4139e63a21757a50c731e17bacd">IMEInputEvent</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#aedfd74fe9ee6c1cbdbcc9f78b25a5621">IMEInputEvent</a> (const <a class="el" href="classpp_1_1_input_event.html">InputEvent</a> &amp;event)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a9004ae92edc6bcb797dd3720acb290af">IMEInputEvent</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;text, const std::vector&lt; uint32_t &gt; &amp;segment_offsets, int32_t target_segment, const std::pair&lt; uint32_t, uint32_t &gt; &amp;selection)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var.html">Var</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#ae2b82f9465fa0847af7e0214fb43232f">GetText</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#aee5f2af391fd269f35271012247768ac">GetSegmentNumber</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a3deeed9cfbc9f2cff0cb027b870e3ce6">GetSegmentOffset</a> (uint32_t index) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#ada4e768c2aea31e443d8bc9d5e4a9f36">GetTargetSegment</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a94e9078036a3bdf0af6d5508d9115cf6">GetSelection</a> (uint32_t *start, uint32_t *end) const </td></tr>
</table>
<hr /><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a44a2a4139e63a21757a50c731e17bacd"></a><!-- doxytag: member="pp::IMEInputEvent::IMEInputEvent" ref="a44a2a4139e63a21757a50c731e17bacd" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a44a2a4139e63a21757a50c731e17bacd">pp::IMEInputEvent::IMEInputEvent</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Constructs an <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> IME input event object. </p>
</div>
</div>
<a class="anchor" id="aedfd74fe9ee6c1cbdbcc9f78b25a5621"></a><!-- doxytag: member="pp::IMEInputEvent::IMEInputEvent" ref="aedfd74fe9ee6c1cbdbcc9f78b25a5621" args="(const InputEvent &amp;event)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a44a2a4139e63a21757a50c731e17bacd">pp::IMEInputEvent::IMEInputEvent</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_input_event.html">InputEvent</a> &amp;&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Constructs an IME input event object from the provided generic input event. </p>
<p>If the given event is itself <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> or is not an IME input event, the object will be <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">event</td><td>A generic input event. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9004ae92edc6bcb797dd3720acb290af"></a><!-- doxytag: member="pp::IMEInputEvent::IMEInputEvent" ref="a9004ae92edc6bcb797dd3720acb290af" args="(const InstanceHandle &amp;instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, const Var &amp;text, const std::vector&lt; uint32_t &gt; &amp;segment_offsets, int32_t target_segment, const std::pair&lt; uint32_t, uint32_t &gt; &amp;selection)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_i_m_e_input_event.html#a44a2a4139e63a21757a50c731e17bacd">pp::IMEInputEvent::IMEInputEvent</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_InputEvent_Type&#160;</td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_TimeTicks&#160;</td>
<td class="paramname"><em>time_stamp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> &amp;&#160;</td>
<td class="paramname"><em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::vector&lt; uint32_t &gt; &amp;&#160;</td>
<td class="paramname"><em>segment_offsets</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>target_segment</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::pair&lt; uint32_t, uint32_t &gt; &amp;&#160;</td>
<td class="paramname"><em>selection</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This constructor manually constructs an IME event from the provided parameters. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance for which this event occurred.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>A <code>PP_InputEvent_Type</code> identifying the type of input event. The type must be one of the ime event types.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">time_stamp</td><td>A <code>PP_TimeTicks</code> indicating the time when the event occurred.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">text</td><td>The string returned by <code>GetText</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">segment_offsets</td><td>The array of numbers returned by <code>GetSegmentOffset</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">target_segment</td><td>The number returned by <code>GetTargetSegment</code>.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">selection</td><td>The range returned by <code>GetSelection</code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="aee5f2af391fd269f35271012247768ac"></a><!-- doxytag: member="pp::IMEInputEvent::GetSegmentNumber" ref="aee5f2af391fd269f35271012247768ac" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t <a class="el" href="classpp_1_1_i_m_e_input_event.html#aee5f2af391fd269f35271012247768ac">pp::IMEInputEvent::GetSegmentNumber</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the number of segments in the composition text. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of segments. For events other than COMPOSITION_UPDATE, returns 0. </dd></dl>
</div>
</div>
<a class="anchor" id="a3deeed9cfbc9f2cff0cb027b870e3ce6"></a><!-- doxytag: member="pp::IMEInputEvent::GetSegmentOffset" ref="a3deeed9cfbc9f2cff0cb027b870e3ce6" args="(uint32_t index) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t <a class="el" href="classpp_1_1_i_m_e_input_event.html#a3deeed9cfbc9f2cff0cb027b870e3ce6">pp::IMEInputEvent::GetSegmentOffset</a> </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>index</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the position of the index-th segmentation point in the composition text. </p>
<p>The position is given by a byte-offset (not a character-offset) of the string returned by <a class="el" href="classpp_1_1_i_m_e_input_event.html#ae2b82f9465fa0847af7e0214fb43232f" title="Returns the composition text as a UTF-8 string for the given IME event.">GetText()</a>. It always satisfies 0=GetSegmentOffset(0) &lt; ... &lt; GetSegmentOffset(i) &lt; GetSegmentOffset(i+1) &lt; ... &lt; GetSegmentOffset(<a class="el" href="classpp_1_1_i_m_e_input_event.html#aee5f2af391fd269f35271012247768ac" title="Returns the number of segments in the composition text.">GetSegmentNumber()</a>)=(byte-length of <a class="el" href="classpp_1_1_i_m_e_input_event.html#ae2b82f9465fa0847af7e0214fb43232f" title="Returns the composition text as a UTF-8 string for the given IME event.">GetText()</a>). Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range of the i-th segment, and hence <a class="el" href="classpp_1_1_i_m_e_input_event.html#aee5f2af391fd269f35271012247768ac" title="Returns the number of segments in the composition text.">GetSegmentNumber()</a> can be a valid argument to this function instead of an off-by-1 error.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ime_event</td><td>A <code>PP_Resource</code> corresponding to an IME event.</td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>An integer indicating a segment.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The byte-offset of the segmentation point. If the event is not COMPOSITION_UPDATE or index is out of range, returns 0. </dd></dl>
</div>
</div>
<a class="anchor" id="a94e9078036a3bdf0af6d5508d9115cf6"></a><!-- doxytag: member="pp::IMEInputEvent::GetSelection" ref="a94e9078036a3bdf0af6d5508d9115cf6" args="(uint32_t *start, uint32_t *end) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="classpp_1_1_i_m_e_input_event.html#a94e9078036a3bdf0af6d5508d9115cf6">pp::IMEInputEvent::GetSelection</a> </td>
<td>(</td>
<td class="paramtype">uint32_t *&#160;</td>
<td class="paramname"><em>start</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *&#160;</td>
<td class="paramname"><em>end</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Obtains the range selected by caret in the composition text. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">start</td><td>An integer indicating a start offset of selection range.</td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">end</td><td>An integer indicating an end offset of selection range. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ada4e768c2aea31e443d8bc9d5e4a9f36"></a><!-- doxytag: member="pp::IMEInputEvent::GetTargetSegment" ref="ada4e768c2aea31e443d8bc9d5e4a9f36" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_i_m_e_input_event.html#ada4e768c2aea31e443d8bc9d5e4a9f36">pp::IMEInputEvent::GetTargetSegment</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the index of the current target segment of composition. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>An integer indicating the index of the target segment. When there is no active target segment, or the event is not COMPOSITION_UPDATE, returns -1. </dd></dl>
</div>
</div>
<a class="anchor" id="ae2b82f9465fa0847af7e0214fb43232f"></a><!-- doxytag: member="pp::IMEInputEvent::GetText" ref="ae2b82f9465fa0847af7e0214fb43232f" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var.html">Var</a> <a class="el" href="classpp_1_1_i_m_e_input_event.html#ae2b82f9465fa0847af7e0214fb43232f">pp::IMEInputEvent::GetText</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the composition text as a UTF-8 string for the given IME event. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A string var representing the composition text. For non-IME input events the return value will be an undefined var. </dd></dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="input__event_8h.html">input_event.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}