Back to top OpenSVG (c) Veridict AB, www.veridict.com
Edit this page

Class Attr<T>

Represents an attribute of type T.

Inheritance
object
Attr<T>
AbsoluteOrRatioAttr
ColorAttr
FloatAttr
PathAttr
PolygonAttr
PolylineAttr
PreserveAspectRatioAttr
StringAttr
TransformAttr
ViewBoxAttr
Implements
IAttr
IEquatable<IAttr>
IEquatable<Attr<T>>
Inherited Members
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: OpenSvg.Attributes
Assembly: OpenSvg.dll
Syntax
public abstract class Attr<T> : IAttr, IEquatable<IAttr>, IEquatable<Attr<T>> where T : notnull, IEquatable<T>
Type Parameters
Name Description
T

The type of the attribute.

Constructors

| Edit this page View Source

Attr(string, T, bool)

Initializes a new instance of the Attr<T> class.

Declaration
protected Attr(string name, T defaultValue, bool isConstant)
Parameters
Type Name Description
string name

The name of the attribute.

T defaultValue

The default value of the attribute.

bool isConstant

Whether the attribute is constant.

Fields

| Edit this page View Source

DefaultValue

The default value of the attribute.

Declaration
public readonly T DefaultValue
Field Value
Type Description
T

Properties

| Edit this page View Source

IsConstant

Whether the attribute is constant.

Declaration
public bool IsConstant { get; }
Property Value
Type Description
bool
| Edit this page View Source

Name

The name of the attribute.

Declaration
public string Name { get; }
Property Value
Type Description
string
| Edit this page View Source

ShouldBeSerialized

Gets a value indicating whether the attribute should be serialized.

Declaration
public bool ShouldBeSerialized { get; }
Property Value
Type Description
bool
Remarks

This property determines whether the attribute should be included in the serialization process.

Methods

| Edit this page View Source

DefaultEquals(T)

Whether the default value of the attribute equals the specified value.

Declaration
protected virtual bool DefaultEquals(T value)
Parameters
Type Name Description
T value

The value to compare to the default value.

Returns
Type Description
bool

Whether the default value of the attribute equals the specified value.

| Edit this page View Source

Deserialize(string)

Deserializes an XML string to the value of the attribute.

Declaration
protected abstract T Deserialize(string xmlString)
Parameters
Type Name Description
string xmlString

The XML string to deserialize.

Returns
Type Description
T

The deserialized value.

| Edit this page View Source

Equals(Attr<T>?)

Whether the attribute equals another attribute.

Declaration
public bool Equals(Attr<T>? other)
Parameters
Type Name Description
Attr<T> other

The attribute to compare to.

Returns
Type Description
bool

Whether the attribute equals another attribute.

| Edit this page View Source

Equals(IAttr?)

Whether the attribute equals another attribute.

Declaration
public bool Equals(IAttr? other)
Parameters
Type Name Description
IAttr other

The attribute to compare to.

Returns
Type Description
bool

Whether the attribute equals another attribute.

| Edit this page View Source

Equals(object?)

Determines whether the specified object is equal to the current object.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj

The object to compare with the current object.

Returns
Type Description
bool

true if the specified object is equal to the current object; otherwise, false.

Overrides
object.Equals(object)
| Edit this page View Source

Get()

Gets the value of the attribute.

Declaration
public T Get()
Returns
Type Description
T

The value of the attribute.

| Edit this page View Source

GetHashCode()

Returns the hash code of the attribute.

Declaration
public override int GetHashCode()
Returns
Type Description
int

The hash code of the attribute.

Overrides
object.GetHashCode()
| Edit this page View Source

Serialize(T)

Serializes the value of the attribute to an XML string.

Declaration
protected abstract string Serialize(T value)
Parameters
Type Name Description
T value

The value to serialize.

Returns
Type Description
string

The XML string representation of the value.

| Edit this page View Source

Set(T)

Sets the value of the attribute.

Declaration
public void Set(T value)
Parameters
Type Name Description
T value

The value to set.

| Edit this page View Source

SetBySerializer(string)

Sets the value of the attribute from an XML string.

Declaration
public void SetBySerializer(string xmlString)
Parameters
Type Name Description
string xmlString

The XML string.

| Edit this page View Source

ToString()

Returns the XML string representation of the attribute.

Declaration
public override string ToString()
Returns
Type Description
string

The XML string representation of the attribute.

Overrides
object.ToString()
| Edit this page View Source

ToXmlString()

Returns the XML string representation of the attribute.

Declaration
public string ToXmlString()
Returns
Type Description
string

The XML string representation of the attribute.

| Edit this page View Source

ValueEquals(T)

Whether the value of the attribute equals the specified value.

Declaration
protected virtual bool ValueEquals(T value)
Parameters
Type Name Description
T value

The value to compare to the value of the attribute.

Returns
Type Description
bool

Whether the value of the attribute equals the specified value.

Operators

| Edit this page View Source

operator ==(Attr<T>, Attr<T>)

Whether two attributes are equal.

Declaration
public static bool operator ==(Attr<T> left, Attr<T> right)
Parameters
Type Name Description
Attr<T> left

The first attribute.

Attr<T> right

The second attribute.

Returns
Type Description
bool

Whether the two attributes are equal.

| Edit this page View Source

operator !=(Attr<T>, Attr<T>)

Whether two attributes are not equal.

Declaration
public static bool operator !=(Attr<T> left, Attr<T> right)
Parameters
Type Name Description
Attr<T> left

The first attribute.

Attr<T> right

The second attribute.

Returns
Type Description
bool

Whether the two attributes are not equal.

Implements

IAttr
IEquatable<T>
IEquatable<T>