Class Tag
Represents a tag.
Inherited Members
Namespace: Sdl.LanguagePlatform.Core
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public class Tag : SegmentElement
Constructors
Tag()
Initializes a new instance with default values (used for XML serialization only).
Declaration
public Tag()
Tag(Tag)
Initializes a new instance of the Tag class from another instance.
Declaration
public Tag(Tag other)
Parameters
Type | Name | Description |
---|---|---|
Tag | other | The other instance. |
Tag(TagType, String, Int32)
Initializes a new instance of the Tag class with the specified type and anchor. The alignment anchor will be set to zero.
Declaration
public Tag(TagType type, string tagId, int anchor)
Parameters
Type | Name | Description |
---|---|---|
TagType | type | The tag type. |
System.String | tagId | The tag ID (user-defined) |
System.Int32 | anchor | The tag anchor. |
Tag(TagType, String, Int32, Int32, String)
Initializes a new instance of the Tag class with the specified type and anchor.
Declaration
public Tag(TagType type, string tagId, int anchor, int alignmentAnchor, string textEquivalent)
Parameters
Type | Name | Description |
---|---|---|
TagType | type | The tag type. |
System.String | tagId | The tag ID (user-defined) |
System.Int32 | anchor | The tag anchor. |
System.Int32 | alignmentAnchor | An alignment anchor (cross-segment), if available |
System.String | textEquivalent | A text equivalent string (ignored if the tag type is not TextPlaceholder or LockedContent) |
Tag(TagType, String, Int32, Int32, String, Boolean)
Initializes a new instance of the Tag class with the specified type and anchor.
Declaration
public Tag(TagType type, string tagId, int anchor, int alignmentAnchor, string textEquivalent, bool canHide)
Parameters
Type | Name | Description |
---|---|---|
TagType | type | The tag type. |
System.String | tagId | The tag ID (user-defined) |
System.Int32 | anchor | The tag anchor. |
System.Int32 | alignmentAnchor | An alignment anchor (cross-segment), if available |
System.String | textEquivalent | A text equivalent string (ignored if the tag type is not TextPlaceholder or LockedContent) |
System.Boolean | canHide | True if the tag represents inline formatting, false otherwise |
Properties
AlignmentAnchor
Gets or sets the alignment anchor, which is used to align cross-segment tags. It only needs to be set for the start tag.
Declaration
public int AlignmentAnchor { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Anchor
Gets or sets the tag anchor, which is used to bracket two tags (connect start and end tag). The anchor is only relevant for start and end tags and has no cross-segment semantics.
Declaration
public int Anchor { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
CanHide
Gets or sets the CanHide flag
Declaration
public bool CanHide { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
TagID
Gets or sets the tag ID which is a cross-format ID assigned by the filters and which may be used to represent a cross-format formatting class (such as "bold").
Declaration
public string TagID { get; set; }
Property Value
Type | Description |
---|---|
System.String |
TextEquivalent
Gets or sets the text equivalent string. This will only be valid for text placeholder tags.
Declaration
public string TextEquivalent { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Type
Gets or sets the tag type.
Declaration
public TagType Type { get; set; }
Property Value
Type | Description |
---|---|
TagType |
Methods
AcceptSegmentElementVisitor(ISegmentElementVisitor)
Visitor pattern implementation. Calls VisitTag(Tag).
Declaration
public override void AcceptSegmentElementVisitor(ISegmentElementVisitor visitor)
Parameters
Type | Name | Description |
---|---|---|
ISegmentElementVisitor | visitor | The visitor instance |
Overrides
Duplicate()
See Duplicate()
Declaration
public override SegmentElement Duplicate()
Returns
Type | Description |
---|---|
SegmentElement | A new instance that is a deep copy of this instance. |
Overrides
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this object |
Overrides
GetWeakHashCode()
Declaration
public override int GetWeakHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code independent of tag anchors. |
Overrides
SeriliazedWihoutAnchor()
Same as ToString, but doesn't includes _AlignmentAnchor
Declaration
public string SeriliazedWihoutAnchor()
Returns
Type | Description |
---|---|
System.String |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation of the object, for display purposes. |