docs.unity3d.com
    Show / Hide Table of Contents

    Struct BinaryParser

    Ref struct to hide unsafe pointer logic

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.Logging
    Syntax
    public ref readonly struct BinaryParser

    Constructors

    BinaryParser(Void*, Int32)

    Creates the ref struct

    Declaration
    public BinaryParser(void *ptrContextData, int payloadBufferLength)
    Parameters
    Type Name Description
    Void* ptrContextData

    Pointer to the data

    Int32 payloadBufferLength

    Length of the data in bytes

    Fields

    LengthInBytes

    Length of the data in bytes

    Declaration
    public readonly int LengthInBytes
    Field Value
    Type Description
    Int32

    Properties

    IsValid

    True if Pointer is not null and length is bigger than 0

    Declaration
    public readonly bool IsValid { get; }
    Property Value
    Type Description
    Boolean

    Pointer

    Safe IntPtr wrapper for the internal pointer

    Declaration
    public readonly IntPtr Pointer { get; }
    Property Value
    Type Description
    IntPtr

    Methods

    AppendToUnsafeText<T>(ref UnsafeText, ref FormatterStruct, ref LogMemoryManager, ref ArgumentInfo)

    Reads the pointer as T that implements ILoggableMirrorStruct, and appends it to the UnsafeText. Checks out of bound read if debug checks are present

    Declaration
    public readonly bool AppendToUnsafeText<T>(ref UnsafeText hstring, ref FormatterStruct formatter, ref LogMemoryManager memAllocator, ref ArgumentInfo currArgSlot)
        where T : struct, ILoggableMirrorStruct
    Parameters
    Type Name Description
    UnsafeText hstring

    UnsafeText where to append

    FormatterStruct formatter

    Current formatter

    LogMemoryManager memAllocator

    Memory manager that holds binary representation of the mirror struct

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if append was successful

    Type Parameters
    Name Description
    T

    Unmanaged struct that implements ILoggableMirrorStruct

    AppendUTF8StringToUnsafeText(ref UnsafeText, ref FormatterStruct, Int32, ref ArgumentInfo)

    Reads the pointer as a UTF8 string and appends it to the UnsafeText. Checks out of bound read if debug checks are present

    Declaration
    public readonly bool AppendUTF8StringToUnsafeText(ref UnsafeText hstring, ref FormatterStruct formatter, int stringLengthInBytes, ref ArgumentInfo currArgSlot)
    Parameters
    Type Name Description
    UnsafeText hstring

    UnsafeText where to append

    FormatterStruct formatter

    Current formatter

    Int32 stringLengthInBytes

    Length of the UTF8 string in bytes

    ArgumentInfo currArgSlot

    Hole that was used to describe the struct in the log message, for instance {0} or {Number} or {Number:##.0;-##.0}

    Returns
    Type Description
    Boolean

    True if append was successful

    Peek<T>()

    Reads the pointer as T. Checks out of bound read if debug checks are present

    Declaration
    public readonly T Peek<T>()
        where T : struct
    Returns
    Type Description
    T

    T representation of binary data under Ptr

    Type Parameters
    Name Description
    T

    Unmanaged type

    Skip(Int32)

    Creates new BinaryParser that is a slice of the current one, but 'bytes' are skipped

    Declaration
    public readonly BinaryParser Skip(int bytes)
    Parameters
    Type Name Description
    Int32 bytes

    Bytes to skip

    Returns
    Type Description
    BinaryParser

    Slice of the current BinaryParser

    Skip<T>()

    Creates new BinaryParser that is a slice of the current one, but SizeOf{T} are skipped

    Declaration
    public readonly BinaryParser Skip<T>()
        where T : struct
    Returns
    Type Description
    BinaryParser

    Slice of the current BinaryParser

    Type Parameters
    Name Description
    T

    Unmanaged type, its size will be used to skip

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023