.\" Copyright (C) 2001 Information-technology Promotion Agency (IPA)
.\" Copyright (C) 2001-2009
.\"   National Institute of Advanced Industrial Science and Technology (AIST)
.\" This file is part of the m17n library documentation.
.\" Permission is granted to copy, distribute and/or modify this document
.\" under the terms of the GNU Free Documentation License, Version 1.2 or
.\" any later version published by the Free Software Foundation; with no
.\" Invariant Section, no Front-Cover Texts,
.\" and no Back-Cover Texts.  A copy of the license is included in the
.\" appendix entitled "GNU Free Documentation License".
.TH "Text Property" 3m17n "15 Oct 2009" "" "Version 1.5.5" "" "The m17n Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Text Property \- Function to handle text properties.  

.PP
.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef \fBMPlist\fP *(* \fBMTextPropSerializeFunc\fP )(void *val)"
.br
.RI "\fIType of serializer functions. \fP"
.ti -1c
.RI "typedef void *(* \fBMTextPropDeserializeFunc\fP )(\fBMPlist\fP *plist)"
.br
.RI "\fIType of deserializer functions. \fP"
.ti -1c
.RI "typedef struct \fBMTextProperty\fP \fBMTextProperty\fP"
.br
.RI "\fIType of text properties. \fP"
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBMTextPropertyControl\fP { \fBMTEXTPROP_FRONT_STICKY\fP =  0x01, \fBMTEXTPROP_REAR_STICKY\fP =  0x02, \fBMTEXTPROP_VOLATILE_WEAK\fP =  0x04, \fBMTEXTPROP_VOLATILE_STRONG\fP =  0x08, \fBMTEXTPROP_NO_MERGE\fP =  0x10, \fBMTEXTPROP_CONTROL_MAX\fP =  0x1F }"
.br
.RI "\fIFlag bits to control text property. \fP"
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void * \fBmtext_get_prop\fP (\fBMText\fP *mt, int pos, \fBMSymbol\fP key)"
.br
.RI "\fIGet the value of the topmost text property. \fP"
.ti -1c
.RI "int \fBmtext_get_prop_values\fP (\fBMText\fP *mt, int pos, \fBMSymbol\fP key, void **values, int num)"
.br
.RI "\fIGet multiple values of a text property. \fP"
.ti -1c
.RI "int \fBmtext_get_prop_keys\fP (\fBMText\fP *mt, int pos, \fBMSymbol\fP **keys)"
.br
.RI "\fIGet a list of text property keys at a position of an M-text. \fP"
.ti -1c
.RI "int \fBmtext_put_prop\fP (\fBMText\fP *mt, int from, int to, \fBMSymbol\fP key, void *val)"
.br
.RI "\fISet a text property. \fP"
.ti -1c
.RI "int \fBmtext_put_prop_values\fP (\fBMText\fP *mt, int from, int to, \fBMSymbol\fP key, void **values, int num)"
.br
.RI "\fISet multiple text properties with the same key. \fP"
.ti -1c
.RI "int \fBmtext_push_prop\fP (\fBMText\fP *mt, int from, int to, \fBMSymbol\fP key, void *val)"
.br
.RI "\fIPush a text property. \fP"
.ti -1c
.RI "int \fBmtext_pop_prop\fP (\fBMText\fP *mt, int from, int to, \fBMSymbol\fP key)"
.br
.RI "\fIPop a text property. \fP"
.ti -1c
.RI "int \fBmtext_prop_range\fP (\fBMText\fP *mt, \fBMSymbol\fP key, int pos, int *from, int *to, int deeper)"
.br
.RI "\fIFind the range where the value of a text property is the same. \fP"
.ti -1c
.RI "\fBMTextProperty\fP * \fBmtext_property\fP (\fBMSymbol\fP key, void *val, int control_bits)"
.br
.RI "\fICreate a text property. \fP"
.ti -1c
.RI "\fBMText\fP * \fBmtext_property_mtext\fP (\fBMTextProperty\fP *prop)"
.br
.RI "\fIReturn the M-text of a text property. \fP"
.ti -1c
.RI "\fBMSymbol\fP \fBmtext_property_key\fP (\fBMTextProperty\fP *prop)"
.br
.RI "\fIReturn the key of a text property. \fP"
.ti -1c
.RI "void * \fBmtext_property_value\fP (\fBMTextProperty\fP *prop)"
.br
.RI "\fIReturn the value of a text property. \fP"
.ti -1c
.RI "int \fBmtext_property_start\fP (\fBMTextProperty\fP *prop)"
.br
.RI "\fIReturn the start position of a text property. \fP"
.ti -1c
.RI "int \fBmtext_property_end\fP (\fBMTextProperty\fP *prop)"
.br
.RI "\fIReturn the end position of a text property. \fP"
.ti -1c
.RI "\fBMTextProperty\fP * \fBmtext_get_property\fP (\fBMText\fP *mt, int pos, \fBMSymbol\fP key)"
.br
.RI "\fIGet the topmost text property. \fP"
.ti -1c
.RI "int \fBmtext_get_properties\fP (\fBMText\fP *mt, int pos, \fBMSymbol\fP key, \fBMTextProperty\fP **props, int num)"
.br
.RI "\fIGet multiple text properties. \fP"
.ti -1c
.RI "int \fBmtext_attach_property\fP (\fBMText\fP *mt, int from, int to, \fBMTextProperty\fP *prop)"
.br
.RI "\fIAttach a text property to an M-text. \fP"
.ti -1c
.RI "int \fBmtext_detach_property\fP (\fBMTextProperty\fP *prop)"
.br
.RI "\fIDetach a text property from an M-text. \fP"
.ti -1c
.RI "int \fBmtext_push_property\fP (\fBMText\fP *mt, int from, int to, \fBMTextProperty\fP *prop)"
.br
.RI "\fIPush a text property onto an M-text. \fP"
.ti -1c
.RI "\fBMText\fP * \fBmtext_serialize\fP (\fBMText\fP *mt, int from, int to, \fBMPlist\fP *property_list)"
.br
.RI "\fISerialize text properties in an M-text. \fP"
.ti -1c
.RI "\fBMText\fP * \fBmtext_deserialize\fP (\fBMText\fP *mt)"
.br
.RI "\fIDeserialize text properties in an M-text. \fP"
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "\fBMSymbol\fP \fBMtext_prop_serializer\fP"
.br
.RI "\fISymbol for specifying serializer functions. \fP"
.ti -1c
.RI "\fBMSymbol\fP \fBMtext_prop_deserializer\fP"
.br
.RI "\fISymbol for specifying deserializer functions. \fP"
.in -1c
.SH "Detailed Description"
.PP 
Function to handle text properties. 
.PP
Each character in an M\-text can have properties called \fItext\fP \fIproperties\fP. Text properties store various kinds of information attached to parts of an M\-text to provide application programs with a unified view of those information. As rich information can be stored in M\-texts in the form of text properties, functions in application programs can be simple.
.PP
A text property consists of a \fIkey\fP and \fIvalues\fP, where key is a symbol and values are anything that can be cast to \fC(void *) \fP. Unlike other types of properties, a text property can have multiple values. 'The text property whose key is K' may be shortened to 'K property'. 
.SH "Typedef Documentation"
.PP 
.SS "typedef \fBMPlist\fP*(* \fBMTextPropSerializeFunc\fP)(void *val)"
.PP
Type of serializer functions. 
.PP
This is the type of serializer functions. If the key of a symbol property is \fBMtext_prop_serializer\fP, the value must be of this type.
.PP

\fBSEE ALSO\fp
.RS 4
\fBmtext_serialize()\fP, \fBMtext_prop_serializer\fP 
.RE
.PP

.SS "typedef void*(* \fBMTextPropDeserializeFunc\fP)(\fBMPlist\fP *plist)"
.PP
Type of deserializer functions. 
.PP
This is the type of deserializer functions. If the key of a symbol property is \fBMtext_prop_deserializer\fP, the value must be of this type.
.PP

\fBSEE ALSO\fp
.RS 4
\fBmtext_deserialize()\fP, \fBMtext_prop_deserializer\fP 
.RE
.PP

.SS "typedef struct \fBMTextProperty\fP \fBMTextProperty\fP"
.PP
Type of text properties. 
.PP
The type \fBMTextProperty\fP is for a \fItext\fP \fIproperty\fP objects. Its internal structure is concealed from application programs. 
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBMTextPropertyControl\fP"
.PP
Flag bits to control text property. 
.PP
The \fBmtext_property()\fP function accepts logical OR of these flag bits as an argument. They control the behaviour of the created text property as described in the documentation of each flag bit. 
.PP
\fBEnumerator: \fP
.in +1c
.TP
\fB\fIMTEXTPROP_FRONT_STICKY \fP\fP
If this flag bit is on, an M\-text inserted at the start position or at the middle of the text property inherits the text property. 
.TP
\fB\fIMTEXTPROP_REAR_STICKY \fP\fP
If this flag bit is on, an M\-text inserted at the end position or at the middle of the text property inherits the text property. 
.TP
\fB\fIMTEXTPROP_VOLATILE_WEAK \fP\fP
If this flag bit is on, the text property is removed if a text in its region is modified. 
.TP
\fB\fIMTEXTPROP_VOLATILE_STRONG \fP\fP
If this flag bit is on, the text property is removed if a text or the other text property in its region is modified. 
.TP
\fB\fIMTEXTPROP_NO_MERGE \fP\fP
If this flag bit is on, the text property is not automatically merged with the others. 
.TP
\fB\fIMTEXTPROP_CONTROL_MAX \fP\fP

.SH "Variable Documentation"
.PP 
.SS "\fBMSymbol\fP \fBMtext_prop_serializer\fP"
.PP
Symbol for specifying serializer functions. 
.PP
To serialize a text property, the user must supply a serializer function for that text property. This is done by giving a symbol property whose key is \fBMtext_prop_serializer\fP and value is a pointer to an appropriate serializer function.
.PP

\fBSEE ALSO\fp
.RS 4
\fBmtext_serialize()\fP, \fBMTextPropSerializeFunc\fP 
.RE
.PP

.SS "\fBMSymbol\fP \fBMtext_prop_deserializer\fP"
.PP
Symbol for specifying deserializer functions. 
.PP
To deserialize a text property, the user must supply a deserializer function for that text property. This is done by giving a symbol property whose key is \fBMtext_prop_deserializer\fP and value is a pointer to an appropriate deserializer function.
.PP

\fBSEE ALSO\fp
.RS 4
\fBmtext_deserialize()\fP, \fBMTextPropSerializeFunc\fP 
.RE
.PP

.SH COPYRIGHT
Copyright (C) 2001 Information\-technology Promotion Agency (IPA)
.br
Copyright (C) 2001\-2009 National Institute of Advanced Industrial Science and Technology (AIST)
.br
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License 
<http://www.gnu.org/licenses/fdl.html>.
