.\" Copyright (C) 2001 Information-technology Promotion Agency (IPA) .\" Copyright (C) 2001-2003 .\" National Institute of Advanced Industrial Science and Technology (AIST) .\" This file si aprt 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, Front-Cover Texts "The m17n library documentation", .\" and no Back-Cover Texts. A copy of the license is included in the .\" appendix entitled "GNU Free Documentation License". .TH "Text Property" 3m17n "14 Jul 2007" "" "Version 1.4.0" "" "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 \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 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 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 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 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 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 .TP \fB\fIMTEXTPROP_REAR_STICKY \fP\fP .TP \fB\fIMTEXTPROP_VOLATILE_WEAK \fP\fP .TP \fB\fIMTEXTPROP_VOLATILE_STRONG \fP\fP .TP \fB\fIMTEXTPROP_NO_MERGE \fP\fP .TP \fB\fIMTEXTPROP_CONTROL_MAX \fP\fP .SH "Variable Documentation" .PP .SS "\fBMSymbol\fP \fBMtext_prop_serializer\fP" .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 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