IMPORTANT NOTICE - Apr-30-2009:
This .NET implementation of Okapi is no longer actively developed.
Instead, a NEW JAVA IMPLEMENTATION IS AVAILABLE and is being actively developed.

The material on this Web site is for archive propose. Some applications of the old .NET implementation (e.g. Olifant) will be maintained to some degree until they have a replacement in the Java project.

Okapi Framework

Filter Item Interface Specification

Revision information: Version 1.1
     Latest revision: http://okapi.sourceforge.net/IFilterItem.html

- Document Status
- Overview
- Coded Text
- Defined Values
- Methods

Document Status

This document is a stable specification. Feedback about the content of this document is encouraged. Send your comments to the Okapi Framework administrator, or alternatively to post them in the Okapi Tools users group.

DISCLAIMER: Parts of the documents are generated automatically from the source code documentation of Okapi's implementation of the specification. Because the generation tool is not completely working yet, this may result in incomplete or broken text or links in this document. See the source code documentation of the interface for complete text.

Overview

The Okapi Filter Item Interface is an object model that provides a common way of accessing the different data gathered when processing an input for a localization task. A object implementing this interface is usually used along with an object that implements the Okapi Filter Interface.

The Filter Item is meant to be utilized by two different type of users: the developers of filters (i.e. the providers), and the developers of applications using the filters (i.e. the consumers). While all the methods of the Filter Item interface are accessible to both, some are designed more for or or the other class of users.

Other related specifications:

Coded Text

A text item is composed of two parts: the text itself and, in some cases, the inline codes within the text. These codes are the tags or codes of the original material that have been parsed and isolated from the rest of the text. For example, in the HTML string "Text in <b>bold</b>." there are two inline codes: "<b>" and "</b>". An important aspect of the Filter Item interface is that inline codes are abstracted and can be manipulated regardless of what they are in the original format.

A text item can be serialized into two strings: the first one is the coded text string that holds text and abstracted inline codes, and the second is the codes buffer which holds a string representation of the original inline codes and information about them. Having access to these two strings allows you, for example, to store the items in a database and reconstruct the item later on.

Use the GetText method (with its parameter set to zero) to obtain the coded text string, and use the GetCodeMapping method to obtain the string representation of all the inline codes. You can the SetText and SetCodeMapping method to reconstruct the item, as shown below:

string sText = myFilterItem.GetText(0);
string sCodes = myFilterItem.GetCodeMapping();

myFilterItem.SetText(sText);
myFilterItem.SetCodeMapping(sCodes);

Important: The SetText method resets the inline codes internal structure, so you must call those two methods in that order: SetText, then SetCodeMapping.

Most of the time you will not have to deal directly with the codes buffer, and manipulate only the coded text. To set the coded text back to an item after having made some modifications, you can use the ModifyText method, as long as you have not modified any of the inline codes inside that string (except possibly to move them around). For example:

string sText = myFilterItem.GetText(0);
sText = sText.Replace("black", "white");
myFilterItem.ModifyText(sText);

Coded Text Format

In the coded text representation each inline code is abstracted as a pair of special characters. The first one is the inline code type indicator, and the second the index of the code. Both special characters are encoded in the Unicode Private Use Area:

For example the text "Text in <b>bold</b>." will be coded as follow:

T e x t   i n   <b> b o l d </b> .
0054 0065 0078 0074 0020 0069 006E 0020 E101 E200 0062 006F 006C 0064 E102 E201 002E

The <b> tag is represented as a generic begin paired tag (U+E101) with an index of 0 (U+E200 once converted to the offset representation). You can obtain the coded text representation by making a GetText(0) call.

Using the Unicode Private Use Area for encoding the inline codes has the advantage of allowing most of the "normal" string functions. For example, you can run regular expressions on the coded text without risking to modify the inline codes while changing the text portions. The codes themselves can also be matched fairly easily by regular expressions too.

A function to convert the code index in the string representation to the zero-based index to use with GetCode would look like this:

int ToIndex (char p_chIndex)
{
   return ((int)p_chIndex)-0xE200;
}

Codes Mapping Format

The information corresponding to the inline codes of a Filter Item can be stored in a single string representation. You can retrieve this string with the GetCodeMapping method. You can also assign the string back to a Filter Item by using the SetCodeMapping method. Note that, when using this method, the inline markers in the coded text must correspond to the codes of the string.

Line-Breaks

All line-breaks in a coded text are always represented by a single line-feed character (\n, i.e. U+000A), regardless of the original type of line-break used in the input. It is the responsibility of the filter to perform the relevant conversion as needed.

Uasge Example

Example, a very basic word count function:

int WordCount (IFilterItem p_FI)
{
   bool                  bInWord = false;
   int                   nCount = 0;
   string                sText = p_FI.GetText(0);

   for ( int i=0; i<sText.Length; i++ )
   {
      switch ( sText[i] )
      {
         case '\xE101': // Begin paired tag
         case '\xE102': // End paired tag
         case '\xE103': // place-holder
            i++; // Skip code index
            // We ignore inline codes for the count
            continue;

         default:
            if ( Char.IsWhiteSpace(sText[i]) )
            {
               if ( bInWord )
               {
                  nCount++;
                  bInWord = false;
               }
            }
            else bInWord = true;
            continue;
      }
   }

   // End string ends a word?
   if ( bInWord ) nCount++;

   return nCount;
}

Defined Values

TODO

Methods

The Filter Item Interface provides the following methods:

IFilterItem.GetInterfaceVersion

Gets the version of the IFilterItem interface the object implements.

IFilterItem.Reset

Resets most of the states and values of the item to their defaults.

IFilterItem.SetRTFOptions

Sets the options for the RTF formatting.

IFilterItem.CopyFrom

Copies all the data from a specified filter item.

IFilterItem.Extract

Extract a part of the text from the item.

IFilterItem.GetItemType

Gets the type of the filter item.

IFilterItem.SetItemType

Sets the type of the filter item.

IFilterItem.GetItemID

Gets the ID of the item.

IFilterItem.SetItemID

Sets the ID of the item.

IFilterItem.GetGroupID

Gets the ID of the group to which the item belongs.

IFilterItem.SetGroupID

Sets the ID of the group to which the item belongs.

IFilterItem.GetLevel

Gets the level of grouping.

IFilterItem.SetLevel

Sets the level of grouping.

IFilterItem.GetEncoding

Gets the name of the encoding used for the item.

IFilterItem.SetEncoding

Sets the name of the encoding used for the item.

IFilterItem.GetLineBreak

Gets the type of line-break for this item.

IFilterItem.SetLineBreak

Sets the type of line-break for this item.

IFilterItem.GetXMLStyle

Gets the indicator for XML style for this item.

IFilterItem.SetXMLStyle

Sets the indicator whether the item uses XML syntax or not.

IFilterItem.GetResType

Gets the resource type of the item.

IFilterItem.SetResType

Sets the resource type of the item.

IFilterItem.GetResName

Gets the resource name of the item.

IFilterItem.SetResName

Sets the resource name of the item.

IFilterItem.GetMimeType

Gets the mime-type value of the item.

IFilterItem.SetMimeType

Sets the mime-type value of the item.

IFilterItem.HasCoord

Indicates whether at least one of the coordinates member is different from 0.

IFilterItem.GetCoord

Gets the coordinates of the item.

IFilterItem.SetCoord

Sets the coordinates of the item.

IFilterItem.GetX

Gets the X coordinate of the item.

IFilterItem.SetX

Sets the X coordinate of the item.

IFilterItem.GetY

Gets the Y coordinate of the item.

IFilterItem.SetY

Sets the Y coordinate of the item.

IFilterItem.GetCX

Gets the CX coordinate of the item.

IFilterItem.SetCX

Sets the CX coordinate of the item.

IFilterItem.GetCY

Gets the CY coordinate of the item.

IFilterItem.SetCY

Sets the CY coodinate of the item.

IFilterItem.HasFont

Indicates whether the item has font information.

IFilterItem.GetFont

Gets the font information of the item.

IFilterItem.SetFont

Sets the font information for the item.

IFilterItem.IsTranslatable

Indicates whether the text is translatable.

IFilterItem.SetTranslatable

Sets the indicator whether the text of the item is translatable or not.

IFilterItem.IsTranslated

Indicates whether the text of the item has already a translation.

IFilterItem.SetTranslated

Sets the indicator whether the text of the item has already a translation.

IFilterItem.IsSubFlow

Indicates whether the text of the item is a sub-flow text.

IFilterItem.SetSubFlow

Sets the indicator whether the text of the item is a sub-flow text.

IFilterItem.IsPreFormatted

Indicates whether the text is pre-formatted.

IFilterItem.SetPreFormatted

Sets the indicator whether the text is pre-formatted.

IFilterItem.GetStart

Gets the start position of the text of the item in the input.

IFilterItem.SetStart

Sets the start position of the text of the item in the input.

IFilterItem.GetLength

Gets the original length of the text of the item in the input.

IFilterItem.SetLength

Sets the length of the text of the item in the input.

IFilterItem.IsEmpty

Indicates whether the item is empty.

IFilterItem.GetText

Gets the text of the item in a specified format.

IFilterItem.GetTextLength

Gets the character length of the text of the item for a specified format.

IFilterItem.SetText

Sets the text of the item.

IFilterItem.ModifyText

Modify the text of the item.

IFilterItem.AppendText

Appends a string to the text of the item.

IFilterItem.AppendChar

Appends a character to the text of the item.

IFilterItem.AppendCode

Appends an inline code to the text of the item.

IFilterItem.ChangeToCode

Change a text section of a a text item to inline code.

IFilterItem.HasCode

Indicator whether the item has at least one inline code.

IFilterItem.GetCodeCount

Gets the number of inline codes in the text of the item.

IFilterItem.GetCodeMapping

Gets the string representation of the inline codes for the item.

IFilterItem.SetCodeMapping

Sets the string representation of the inline codes for the item.

IFilterItem.GetCode

Gets the original code of a specified inline code.

IFilterItem.GetCodeID

Gets the identifier for the code at the specified index.

IFilterItem.GetCodeIndexFromID

Gets the index of a code with the given identifier and type.

IFilterItem.GetCodeLabel

Gets the label for the code at the specified index.

IFilterItem.HasText

Indicator whether the item has at least one text character.

IFilterItem.RemoveEnd

Removes a specified count of characters form the end of the text.

IFilterItem.HasNote

Indicates whether the item has a note.

IFilterItem.GetNote

Gets the note information for the item.

IFilterItem.GetNoteAttributeFrom

Gets the from attribute of the note.

IFilterItem.SetNote

Sets the nore information for the item.

IFilterItem.ListProperties

Lists the current properties of the filter item.

IFilterItem.GetProperty

Gets the property value for the given property name.

IFilterItem.SetProperty

Sets the property value for a given property name.

IFilterItem.NormalizeLineBreaks

Normalizes the type of line breaks in the current item.

IFilterItem.NormalizeWhiteSpaces

Normalizes the whitespaces in the current item.

IFilterItem.GetInterfaceVersion

Gets the version of the IFilterItem interface the object implements.

Return

The version of the IFilterItem interface.

IFilterItem.Reset

Resets most of the states and values of the item to their defaults.

Remarks

Use this method to reset most of the states and values associated with the filter item to their default values.

Encoding and line-break type are not reset by this method. Use IFilterItem.SetEncoding and IFilterItem.SetLineBreak to reset these.

IFilterItem.SetRTFOptions

Sets the options for the RTF formatting.

Parameters

Stringp_sRTFStartInLineRTF codes for the start of an inline code.
Stringp_sRTFStartProtectedRTF codes for the start of a protected code.

Remarks

Use this method to set the RTF codes to use before and after each inline code. These codes are used to format the text to RTF when using the IFilterItem.GetText method. The RTF sequences must start with a '}' that will be closed automatically at the end of the code.

IFilterItem.CopyFrom

Copies all the data from a specified filter item.

Parameters

Okapi.Library.Filter.IFilterItemp_FilterItemThe filter item from which to copy the data.

Remarks

Use this method to duplicate all the content of an item.

Example

            if ( Flt.ReadNextItem() == FilterItemType.TEXT )
            {
               FilterItem FI = new FilterItem();
               FI.CopyFrom(Flt.GetItem());
               // Now FI and Flt.Getitem() are independent of each other
               // can be modified separately.
            }
            

IFilterItem.Extract

Extract a part of the text from the item.

Parameters

Integerp_nStartStart position of the part to extract in the coded representation of the text.
Integerp_nLengthLength of the part to extract in the coded representation of the text.
System.Booleanp_bAddMissingCodesTrue if the missing codes creating when splitting the item are to be added as needed. False if the extra codes are simply to be changed to isolated codes.

Return

The new filter item containing a copy of the original one, with only the part of text to extract.

Remarks

Use this method to split a filter item. The inline codes in both the original item and the returned item are adjusted as needed. If the p_nStart is out of bounds, or if p_nLength is invalid the method returns null.

IFilterItem.GetItemType

Gets the type of the filter item.

Return

The type of the filter item. The value is one of the Filter.FilterItemType values.

Remarks

Depending on the filter item type, different properties are accessible in the filter item.

IFilterItem.SetItemType

Sets the type of the filter item.

Parameters

Integerp_nValueThe type of the filter item to set. The value must be one of the Filter.FilterItemType values.

Remarks

The default type of the filter item is the value 0 (ERROR).

IFilterItem.GetItemID

Gets the ID of the item.

Return

The ID of the item.

Remarks

This value is unique within the input. It can be used for the value of the id attribute in XLIFF.

IFilterItem.SetItemID

Sets the ID of the item.

Parameters

Integerp_nValueThe ID value to set.

Remarks

IFilterItem.GetGroupID

Gets the ID of the group to which the item belongs.

Return

the ID value of the group to which the item belongs.

Remarks

Group IDs are unique within the input. If the item belongs to no group, the ID is 0.

IFilterItem.SetGroupID

Sets the ID of the group to which the item belongs.

Parameters

Integerp_nValueThe new ID value to set.

Remarks

Use this method to set the ID of the group to which the item belongs.

IFilterItem.GetLevel

Gets the level of grouping.

Return

The level of grouping. The value starts at 0 (no group).

Remarks

The level indicator is incremented for each embedded group. The start group and end group items themselves are one level above the items inside the group they delimit. The first level (items not inside any group) is level 0.

IFilterItem.SetLevel

Sets the level of grouping.

Parameters

Integerp_nValueThe new level of grouping.

Remarks

The level value is zero-based (no group).

IFilterItem.GetEncoding

Gets the name of the encoding used for the item.

Return

The encoding name. The value is one of the IANA charset names.

Remarks

Some output (like RTF) require to know in which encoding the text is output. The default value is the name of the default encoding for the current user.

The encoding value is not reset when you call the IFilterItem.Reset method.

IFilterItem.SetEncoding

Sets the name of the encoding used for the item.

Parameters

Stringp_sValueThe name of the encoding to set. The value must be one of the IANA charset names.

Remarks

Use this method to set the name of the encoding the item will use for some of its output (e.g. RTF).

IFilterItem.GetLineBreak

Gets the type of line-break for this item.

Return

The line-break representation.

Remarks

This line-break value is not reset when you call the IFilterItem.Reset method.

IFilterItem.SetLineBreak

Sets the type of line-break for this item.

Parameters

Stringp_sValueThe new line-break representation to use.

Remarks

Use this method to set the type of line-break to use with the item.

IFilterItem.GetXMLStyle

Gets the indicator for XML style for this item.

Return

True if the item is XML text, false otherwise.

Remarks

This indicator value is not reset when you call the IFilterItem.Reset method.

IFilterItem.SetXMLStyle

Sets the indicator whether the item uses XML syntax or not.

Parameters

System.Booleanp_bValueThe new value for the indicator.

Remarks

Use this method to set whether or the text will be treatted for XML escapes in output.

IFilterItem.GetResType

Gets the resource type of the item.

Return

The resource type of the item.

Remarks

This value is the equivalent to the value of the restype attribute in XLIFF.

IFilterItem.SetResType

Sets the resource type of the item.

Parameters

Stringp_sValueThe new resource type to set.

Remarks

Use this method to set the resource type of the item.

IFilterItem.GetResName

Gets the resource name of the item.

Return

The resource name of the item.

Remarks

This value is the equivalent to the value of the resname attribute in XLIFF.

IFilterItem.SetResName

Sets the resource name of the item.

Parameters

Stringp_sValueThe new resource name to set.

Remarks

Use this method to set the resource name of the item.

IFilterItem.GetMimeType

Gets the mime-type value of the item.

Return

The mime-type value of the item.

Remarks

This value is used for BINARY items.

IFilterItem.SetMimeType

Sets the mime-type value of the item.

Parameters

Stringp_svalueThe new mime-type value to be set.

Remarks

Use this method to associate a mime-type value with a BINARY item.

IFilterItem.HasCoord

Indicates whether at least one of the coordinates member is different from 0.

Return

True if one or more of the coordinates member is different from 0, false if they are all set to 0.

IFilterItem.GetCoord

Gets the coordinates of the item.

Return

The string representation of the coordinates.

Remarks

This value is equivalent to the coord attribute in XLIFF. You can use the IFilterItem.HasCoord property to see whether the item has any member of the coordinates different from 0. You can access each coordinates member individually using the IFilterItem.GetX, IFilterItem.GetY, IFilterItem.GetCX, and IFilterItem.GetCY methods.

IFilterItem.SetCoord

Sets the coordinates of the item.

Parameters

Stringp_sValueThe string representation of the coordinates.

Remarks

Use this method to set the coordinates of the item. You can also set each coordinate members individually using the IFilterItem.SetX, IFilterItem.SetY, IFilterItem.SetCX, and IFilterItem.SetCY methods.

IFilterItem.GetX

Gets the X coordinate of the item.

Return

The X coordinate of the item.

IFilterItem.SetX

Sets the X coordinate of the item.

Parameters

System.Singlep_fValueThe new X coordinate to set.

IFilterItem.GetY

Gets the Y coordinate of the item.

Return

The Y coordinate of the item.

IFilterItem.SetY

Sets the Y coordinate of the item.

Parameters

System.Singlep_fValueThe new Y coordinate to set.

IFilterItem.GetCX

Gets the CX coordinate of the item.

Remarks

The CX coordinate of the item.

IFilterItem.SetCX

Sets the CX coordinate of the item.

Parameters

System.Singlep_fValueThe new CX coordinate to set.

IFilterItem.GetCY

Gets the CY coordinate of the item.

Return

The CY coordinate of the item.

IFilterItem.SetCY

Sets the CY coodinate of the item.

Parameters

System.Singlep_fValueThe new CY coordinate to set.

IFilterItem.HasFont

Indicates whether the item has font information.

Return

True if the item has font information, false if not.

IFilterItem.GetFont

Gets the font information of the item.

Return

The font information for the item.

Remarks

This value is equivalent to the font attribute in XLIFF. You can use the IFilterItem.HasFont property to query whether the item has font information.

IFilterItem.SetFont

Sets the font information for the item.

Parameters

Stringp_sValueThe new font information to set.

Remarks

Use this method to set the font information for the item. The string representation of the font information is the same as for the font attribute in XLIFF.

IFilterItem.IsTranslatable

Indicates whether the text is translatable.

Return

True if the text of the item is translatable, false if not.

Remarks

Use this method to query whether the item is translatable or not.

IFilterItem.SetTranslatable

Sets the indicator whether the text of the item is translatable or not.

Parameters

System.Booleanp_bValueTrue if the text is translatable, false if not.

Remarks

Use this method to flag the item as translatable or not.

IFilterItem.IsTranslated

Indicates whether the text of the item has already a translation.

Return

True if the text of the item has a translation, false if not.

Remarks

Some file formats have bilingual content and may have both a source text and its translation. Such items are normally considered having an existing translation if the part where the translation text should be is 1) not empty or 2) has a text different from the source text. Use the IFilter.GetTranslatedItem method of the filter to retrieve the translated text item.

IFilterItem.SetTranslated

Sets the indicator whether the text of the item has already a translation.

Parameters

System.Booleanp_bValueTrue if the text has an existing translation, false if not.

Remarks

Use this method to set the status of the target text in bilingual files.

IFilterItem.IsSubFlow

Indicates whether the text of the item is a sub-flow text.

Return

True if the item is a sub-flow item, false if not.

IFilterItem.SetSubFlow

Sets the indicator whether the text of the item is a sub-flow text.

Parameters

System.Booleanp_bValueTrue if the item is a sub-flow item, false if not.

IFilterItem.IsPreFormatted

Indicates whether the text is pre-formatted.

Return

True if the text is pre-formatted, false if not.

IFilterItem.SetPreFormatted

Sets the indicator whether the text is pre-formatted.

Parameters

System.Booleanp_bValueTrue if the text is pre-formatted, false if not.

IFilterItem.GetStart

Gets the start position of the text of the item in the input.

Return

The start position of the text of the item in the input.

Remarks

The position returned is an offset from the beginning of the input. The value is -1 if the start position is not known.

If the input is a string, the position is relative to the IFilter.p_lOffsetInFile parameter of the IFilter.OpenInputString method.

IFilterItem.SetStart

Sets the start position of the text of the item in the input.

Parameters

Integer64p_lValueNew start position to set.

Remarks

Use this method to set the start position of the text of the item (the position of the first character) in the input. The value must be set to -1 if the start position is not known.

If the input is a string, the position should be offset with the IFilter.p_lOffsetInFile parameter of the IFilter.OpenInputString method.

IFilterItem.GetLength

Gets the original length of the text of the item in the input.

Return

The original length of the text of the item in the input.

Remarks

The value returned by this method is not always the same as the value returned by a call to IFilterItem.GetTextLength for the original format. The parsed text may have been transformed, for example to un-wrap a paragraph. The value returned by this method is the length of the text as it is in the input.

IFilterItem.SetLength

Sets the length of the text of the item in the input.

Parameters

Integerp_nValueThe new length to set.

IFilterItem.IsEmpty

Indicates whether the item is empty.

Return

True if the item has no text and no inline codes, false if it has text or inline code(s).

IFilterItem.GetText

Gets the text of the item in a specified format.

Parameters

Integerp_nFormatFormat in which to get the text. the value must be one of the Filter.FilterItemText values.

Return

The text of the item in the specified format.

IFilterItem.GetTextLength

Gets the character length of the text of the item for a specified format.

Parameters

Integerp_nFormatFormat in which to get the text. the value must be one of the Filter.FilterItemText values.

Return

The length of the text of the item in the specified format.

IFilterItem.SetText

Sets the text of the item.

Parameters

Stringp_sValueText to set.

Remarks

This method sets the text for the item, and reset any inline codes. The p_sValue paramter must not contain inline codes. To set inline codes to an item use the IFilterItem.AppendCode method.

Any existing inline code in the original text is lost when calling IFilterItem.SetText. This may leads to error when writing out the output. To change the text of an item and preserve its inline codes, use the IFilterItem.ModifyText method. Also if you call both IFilterItem.SetCodeMapping and IFilterItem.SetText to build an item, make sure to call IFilterItem.SetCodeMapping after IFilterItem.SetText or the inline information you just set will be erased.

IFilterItem.ModifyText

Modify the text of the item.

Parameters

Stringp_sValueText to set. The string must be in coded text format.

IFilterItem.AppendText

Appends a string to the text of the item.

Parameters

Stringp_sValueString to append.

Remarks

Use this method to add text at the end of the current text. To add an inline code use the IFilterItem.AppendCode method. To add a character use the IFilterItem.AppendChar method.

IFilterItem.AppendChar

Appends a character to the text of the item.

Parameters

System.Charp_chValueCharacter to append.

Remarks

Use this method to add a character at the end of the current text. To add an inline code use the IFilterItem.AppendCode method. To add a run of text use the IFilterItem.AppendText method.

IFilterItem.AppendCode

Appends an inline code to the text of the item.

Parameters

Integerp_nTypeType of the inline code. The value must be one of the Filter.InlineCode values.
Stringp_sLabelLabel of the inline code.
Stringp_sDataActual oode of the inline code.

Remarks

Use this method to add an inline code at the end of the current text. To add a character use the IFilterItem.AppendChar method. To add a run of text use the IFilterItem.AppendText method.

The p_sLabel parameter value is used to specified the type/name of the code (similar to the ctype attribute in XLIFF). For paired codes, you must specify the same label when appending the opening code and the closing code. The label must be the same for codes of the same kind (e.g. all <b>/<b> tags should be set to the same label). It must also be distinct for each kind of code (i.e. the <b> and <i> tags must have different labels. It is OK to use null if all the inline codes in the item are of the same kind.

IFilterItem.ChangeToCode

Change a text section of a a text item to inline code.

Parameters

Integerp_nStartAdjusted start position of the code in the coded text. This is the same value as p_nCodeIndex if no adjustment is needed.
Integerp_nCodeIndexStart of the code in the original coded text.
Integerp_nCodeLengthLength of the code.
Integerp_nTextIndexStart of the text embedded in the code, or -1 if there is no embedded text.
Integerp_nTextLengthLength of the text embedded in the code, or 0 if there is no embedded text.

Return

The length difference of the coded text between before and after the insertion.

Remarks

Use this method to insert a code within a text item.

The code may include a run of text. In that case you must set p_nTextIndex to the starting position of the text, and p_nTextLength to the length of the text. If there is no text in the code p_nTextIndex must be set to -1 and/or p_nTextLength to 0.

IFilterItem.HasCode

Indicator whether the item has at least one inline code.

Return

True if the item has at least one inline code.

Remarks

Use this method to query whether the text item contains at least one inline code. You can obtain the number of inline codes in the item with the IFilterItem.GetCodeCount method.

IFilterItem.GetCodeCount

Gets the number of inline codes in the text of the item.

Return

The number of inline codes in the text of the item.

Remarks

Use this method to get the number of inline codes in the text item. You can also query whether there is at least one inline code by using the IFilterItem.HasCode method.

IFilterItem.GetCodeMapping

Gets the string representation of the inline codes for the item.

Return

The string representation of the inline codes for the item.

Remarks

You can use this string for storing the inline codes and the coded text string in separate location (e.g. in a database).

IFilterItem.SetCodeMapping

Sets the string representation of the inline codes for the item.

Parameters

Stringp_sValueThe new string representation to set.

Remarks

Use this method to set the string representation of all the inline codes in the text of the item.

IFilterItem.GetCode

Gets the original code of a specified inline code.

Parameters

Integerp_nIndexIndex of the inline code to access. The value must be between 0 and IFilterItem.GetCodeCount-1.
System.Booleanp_bStandardLineBreaksIndicator on whether to output standard line-breaks. The original line-breaks are used if this flag is set to false.

Return

String that contains the code for the specified inline code.

Remarks

Use this method to retrieve the data associated with a given inline code. The value returned is the one that was set when calling the IFilterItem.AppendCode method.

IFilterItem.GetCodeID

Gets the identifier for the code at the specified index.

Parameters

Integerp_nIndexIndex of the code to query. The value must be between 0 and IFilterItem.GetCodeCount-1.

Return

The identifier of the specified inline code.

Remarks

Use this method to retrieve the identifier of a given inline code.

IFilterItem.GetCodeIndexFromID

Gets the index of a code with the given identifier and type.

Parameters

Integerp_nIDIdentifier of the code to lookup.
Integerp_nTypeType of the code to lookup

Return

Index of the code in the code map, or -1 if no match was found.

Remarks

Use this method to retrieve the mapping index of a given code. Be aware that the result of this function may be incorrect if you use it on an item that is currently being built because the index values may change when adding codes to the item.

IFilterItem.GetCodeLabel

Gets the label for the code at the specified index.

Parameters

Integerp_nIndexIndex of the code to query. The value must be between 0 and IFilterItem.GetCodeCount-1.

Return

The label of the specified inline code.

Remarks

Use this method to retrieve the label of a given inline code.

IFilterItem.HasText

Indicator whether the item has at least one text character.

Parameters

System.Booleanp_bWhiteSpaceIsTextTrue if white-spaces should be treated as text.

Return

True if the item has at least one character (including spaces).

Remarks

Use this method to query whether the text item contains text.

IFilterItem.RemoveEnd

Removes a specified count of characters form the end of the text.

Parameters

Integerp_nCountNumber of characters to remove.

Remarks

This method removed p_nCount characters or less from the end of the text. It stops when the count is reached, or when an inline code is reached, or when the start of the text is reached, whichever comes first.

IFilterItem.HasNote

Indicates whether the item has a note.

Return

True if the item has a note, false if not.

IFilterItem.GetNote

Gets the note information for the item.

Return

The text of the note.

IFilterItem.GetNoteAttributeFrom

Gets the from attribute of the note.

Return

The value of the from attribute.

Remarks

Use this method to get the from attribute value of the note. This attribute is similar to the from attribute in XLIFF.

IFilterItem.SetNote

Sets the nore information for the item.

Parameters

Stringp_sNoteText of the note.
Stringp_sFromIndicator of who set the note. The value is similar to the from attribute in XLIFF.

IFilterItem.ListProperties

Lists the current properties of the filter item.

Return

A string containing the name of each property separated by a semi-colon (e.g. "date;time;user"). If there are no properties, this method should return and empty string (not null).

IFilterItem.GetProperty

Gets the property value for the given property name.

Parameters

Stringp_sNameName of the property to retrieve.

Return

Value of the property, or null if the property is not set.

Remarks

Use this method to retrieve a non-standard property associated to the extracted item. The name of the property is case-sensitive.

IFilterItem.SetProperty

Sets the property value for a given property name.

Parameters

Stringp_sNameName of the property to set.
Stringp_sValueNew value of the property.

Remarks

This method, along with IFilterItem.GetProperty and IFilterItem.ListProperties, allows manage non-standard properties with the extracted item.

Use this method to set a non-standard property for the item. The name of the property is case-sensitive.

To remove a property from the propery list, set the given property to null.

IFilterItem.NormalizeLineBreaks

Normalizes the type of line breaks in the current item.

Remarks

This method convert Unix, Windows, and Mac linebreaks into a simple LF character.

IFilterItem.NormalizeWhiteSpaces

Normalizes the whitespaces in the current item.

Remarks

This method reduces sequencial whitespaces into a single space.