Pepper_31_C++_interfaces
Public Member Functions | List of all members
pp::IMEInputEvent Class Reference

#include <input_event.h>

Inheritance diagram for pp::IMEInputEvent:
Inheritance graph
Collaboration diagram for pp::IMEInputEvent:
Collaboration graph

Public Member Functions

 IMEInputEvent ()
 Constructs an is_null() IME input event object. More...
 
 IMEInputEvent (const InputEvent &event)
 
 IMEInputEvent (const InstanceHandle &instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, const Var &text, const std::vector< uint32_t > &segment_offsets, int32_t target_segment, const std::pair< uint32_t, uint32_t > &selection)
 
Var GetText () const
 
uint32_t GetSegmentNumber () const
 
uint32_t GetSegmentOffset (uint32_t index) const
 
int32_t GetTargetSegment () const
 
void GetSelection (uint32_t *start, uint32_t *end) const
 
- Public Member Functions inherited from pp::InputEvent
 InputEvent ()
 Default constructor that creates an is_null() InputEvent object. More...
 
 InputEvent (PP_Resource input_event_resource)
 
 ~InputEvent ()
 
PP_InputEvent_Type GetType () const
 
PP_TimeTicks GetTimeStamp () const
 
uint32_t GetModifiers () const
 
- Public Member Functions inherited from pp::Resource
 Resource ()
 The default constructor. More...
 
 Resource (const Resource &other)
 
virtual ~Resource ()
 Destructor. More...
 
Resourceoperator= (const Resource &other)
 
bool is_null () const
 
PP_Resource pp_resource () const
 
PP_Resource detach ()
 

Additional Inherited Members

- Protected Member Functions inherited from pp::Resource
 Resource (PP_Resource resource)
 
 Resource (PassRef, PP_Resource resource)
 
void PassRefFromConstructor (PP_Resource resource)
 

Detailed Description

Definition at line 346 of file input_event.h.

Constructor & Destructor Documentation

pp::IMEInputEvent::IMEInputEvent ( )

Constructs an is_null() IME input event object.

pp::IMEInputEvent::IMEInputEvent ( const InputEvent event)
explicit

Constructs an IME input event object from the provided generic input event. If the given event is itself is_null() or is not an IME input event, the object will be is_null().

Parameters
[in]eventA generic input event.
pp::IMEInputEvent::IMEInputEvent ( const InstanceHandle instance,
PP_InputEvent_Type  type,
PP_TimeTicks  time_stamp,
const Var text,
const std::vector< uint32_t > &  segment_offsets,
int32_t  target_segment,
const std::pair< uint32_t, uint32_t > &  selection 
)

This constructor manually constructs an IME event from the provided parameters.

Parameters
[in]instanceThe instance for which this event occurred.
[in]typeA PP_InputEvent_Type identifying the type of input event. The type must be one of the ime event types.
[in]time_stampA PP_TimeTicks indicating the time when the event occurred.
[in]textThe string returned by GetText.
[in]segment_offsetsThe array of numbers returned by GetSegmentOffset.
[in]target_segmentThe number returned by GetTargetSegment.
[in]selectionThe range returned by GetSelection.

Member Function Documentation

uint32_t pp::IMEInputEvent::GetSegmentNumber ( ) const

Returns the number of segments in the composition text.

Returns
The number of segments. For events other than COMPOSITION_UPDATE, returns 0.
uint32_t pp::IMEInputEvent::GetSegmentOffset ( uint32_t  index) const

Returns the position of the index-th segmentation point in the composition text. The position is given by a byte-offset (not a character-offset) of the string returned by GetText(). It always satisfies 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range of the i-th segment, and hence GetSegmentNumber() can be a valid argument to this function instead of an off-by-1 error.

Parameters
[in]ime_eventA PP_Resource corresponding to an IME event.
[in]indexAn integer indicating a segment.
Returns
The byte-offset of the segmentation point. If the event is not COMPOSITION_UPDATE or index is out of range, returns 0.
void pp::IMEInputEvent::GetSelection ( uint32_t *  start,
uint32_t *  end 
) const

Obtains the range selected by caret in the composition text.

Parameters
[out]startAn integer indicating a start offset of selection range.
[out]endAn integer indicating an end offset of selection range.
int32_t pp::IMEInputEvent::GetTargetSegment ( ) const

Returns the index of the current target segment of composition.

Returns
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.
Var pp::IMEInputEvent::GetText ( ) const

Returns the composition text as a UTF-8 string for the given IME event.

Returns
A string var representing the composition text. For non-IME input events the return value will be an undefined var.

The documentation for this class was generated from the following file: