[]
Represents a PDF enumeration type.
public struct PdfEnum<TEnum> : IEquatable<PdfEnum<TEnum>> where TEnum : struct
TEnum
The PDF Specification defines many properties with values represented by a limited set of predefined values. Such values are stored as PDF name objects, which is very similar to enumerations in C#.
But there are many PDF documents in which some of such properties have arbitrary custom values that are not defined in the PDF specification.
GcPdf uses this struct when processing such values.
Where possible, the value is converted to the underlying enumeration type TEnum
,
otherwise the original string value is preserved.
Initializes a new instance of the PdfEnum<TEnum> struct
using a PdfName object.
The passed PdfName is converted to TEnum
if possible.
public PdfEnum(PdfName value)
value
PdfNameThe string representing a TEnum
value.
Initializes a new instance of the PdfEnum<TEnum> struct
using a string.
The passed string is converted to TEnum
if possible.
public PdfEnum(string value)
value
stringThe string representing a TEnum
value.
Initializes a new instance of the PdfEnum<TEnum> struct
using a TEnum
value.
public PdfEnum(TEnum value)
value
TEnumThe TEnum
value.
Gets the TEnum
value defined by this PdfEnum<TEnum>.
Throws an exception if this PdfEnum<TEnum> is represented by an unparsed PDF value.
public TEnum EnumValue { get; }
Gets a value indicating whether this PdfEnum<TEnum> struct contains a PDF value which cannot be converted to PdfEnum<TEnum>.
public bool IsPdfValue { get; }
Gets a value indicating whether this PdfEnum<TEnum> struct contains a string value which cannot be converted to PdfEnum<TEnum>.
[Obsolete("Use IsPdfValue")]
public bool IsString { get; }
Gets the PDF value defined by this PdfEnum<TEnum>.
Throws an exception if this PdfEnum<TEnum> is represented by a parsed TEnum
value.
public PdfName PdfValue { get; }
Checks whether this PdfEnum<TEnum> is equal to another PdfEnum<TEnum>.
public bool Equals(PdfEnum<TEnum> other)
other
PdfEnum<TEnum>The PdfEnum<TEnum> value to compare to.
True if the values are equal, false otherwise.
Returns true if nullable PdfEnum<TEnum> equals to nullable TEnum
value.
public static bool Equals(PdfEnum<TEnum>? v1, TEnum? v2)
v1
PdfEnum<TEnum>?v2
TEnum?public override bool Equals(object obj)
obj
objectChecks whether this PdfEnum<TEnum> is equal to TEnum value.
public bool Equals(TEnum other)
other
TEnumThe TEnum value to compare to.
True if the values are equal, false otherwise.
public TEnum GetEnumValue(TEnum defValue)
defValue
TEnumThe default value if this PdfEnum<TEnum> has no enumeration value.
public override int GetHashCode()
public override string ToString()
Equality operator.
public static bool operator ==(PdfEnum<TEnum> v1, PdfEnum<TEnum> v2)
Converts a PdfEnum<TEnum> value to TEnum
.
public static implicit operator TEnum(PdfEnum<TEnum> value)
value
PdfEnum<TEnum>The value to convert.
Converts a TEnum
value to PdfEnum<TEnum>.
public static implicit operator PdfEnum<TEnum>(TEnum value)
value
TEnumThe value to convert.
Inequality operator.
public static bool operator !=(PdfEnum<TEnum> v1, PdfEnum<TEnum> v2)