Click or drag to resize
IAbstractMarkupDataContainer Interface
Abstract interface implemented by containers that hold data items representing localizable content. For example, the IParagraph, ISegment, ITagPair, and IOtherMarker interfaces are derived from this interface.

Namespace: Sdl.FileTypeSupport.Framework.BilingualApi
Assembly: Sdl.FileTypeSupport.Framework.Core (in Sdl.FileTypeSupport.Framework.Core.dll) Version: 1.0.0.0 (1.0.2551.0)
Syntax
public interface IAbstractMarkupDataContainer : IList<IAbstractMarkupData>, 
	ICollection<IAbstractMarkupData>, IEnumerable<IAbstractMarkupData>, IEnumerable

The IAbstractMarkupDataContainer type exposes the following members.

Properties
  NameDescription
Public propertyAllSubItems
An iterator that can be used to iterate over all child items - including sub-items - in the container.
Public propertyCanBeSplit
Indicates whether it is possible to split this container into different parts by calling the Split(Int32) method.
Public propertyCode exampleLocations
Iterator for all possible locations in the collection and its sub-collections
Top
Methods
  NameDescription
Public methodCode exampleFind(PredicateIAbstractMarkupData)
Returns the first item that matches the specified predecate.

The iteration is performed over all items and sub-items in this collection and all sub-collections until the item is located.

Public methodCode exampleFind(PredicateLocation)
Returns the first location that matches the specified predecate. The iteration is performed over all locations in this collection and all sub-collections until the element is located.
Public methodFind(Location, PredicateLocation)
Returns the first location that matches the specified predecate, starting at a specific location.
Public methodForEachSubItem
Execute the specified action on each item and (recursively) each sub-item in this container.
Public methodGetLocationsFrom
Enumerator for locations starting from a specific location
Public methodMoveAllItemsTo(IAbstractMarkupDataContainer)
Moves all items from this container into another one.
Public methodMoveAllItemsTo(IAbstractMarkupDataContainer, Int32)
Moves all items from this container to a specific location in another container.
Public methodMoveItemsTo(IAbstractMarkupDataContainer, Int32, Int32)
Moves a number of items from this container into another one.
Public methodMoveItemsTo(IAbstractMarkupDataContainer, Int32, Int32, Int32)
Moves a number of items from this container into a specific location in another one.
Public methodSplit
Splits this container in two. After the split, this object will hold all items with index lower than the splitBeforeItemIndex parameter. The returned object is a clone of this object, which contains all other items.
Top
Remarks

Adding or inserting an item into the container automatically sets the Parent property of the item. Removing an item from a container automatically sets the parent property to null.

An item can never appear in more than one container at the same time. Attempting to add an item to a container if it is already in another container causes an exception.

If you want an equivalent item to appear in two containers, you can clone it, and insert the clone into the second container. The cloned item will then reference the same properties object(s).

Implementations of this interface may or may not be IAbstractMarkupData. ITagPair is an example of a container that is also a markup data item, and can therefore appear inside other containers. IParagraph is an example of a container that is NOT a markup data item.

Examples

The following example demonstrates how to retrieve the parent container for a container node if it is a markup data item.

IAbstractMarkupData GetParent(IAbstractMarkupDataContainer container)
{
    IAbstractMarkupData item = container as IAbstractMarkupData;
    if (item != null)
    {
        return item.Parent;
    }
    // container is not a markup data item
    return null;
}

During content manipulation it is sometimes necessary to split a container into two parts, with the first part containing some of the items, the second containing others, and both containers referencing the same properties objects. The easiest way to accomplish this is to call Split(Int32).

Note that not all containers can be split (for example, IParagraph cannot be split). Before calling Split(Int32) you should therefore check the CanBeSplit property.

Another common operation is to move items into a different container. The easiest way to do that is to use one of the overloads of MoveAllItemsTo() or MoveItemsTo().

It is sometimes necessary to reference locations inside a container. This can be done using the Location class. You can iterate over all possible locations in a container (including locations in nested containers) using the Locations iterator.

See Also
Community
Edit

Be the first to Edit the community content of this topic.
Comments