Wes xx mediapipe integration
This commit is contained in:
32
Packages/com.github.homuler.mediapipe/Runtime/Scripts/External/StdString.cs
vendored
Normal file
32
Packages/com.github.homuler.mediapipe/Runtime/Scripts/External/StdString.cs
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class StdString : MpResourceHandle
|
||||
{
|
||||
public StdString(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public StdString(byte[] bytes) : base()
|
||||
{
|
||||
UnsafeNativeMethods.std_string__PKc_i(bytes, bytes.Length, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
protected override void DeleteMpPtr()
|
||||
{
|
||||
UnsafeNativeMethods.std_string__delete(ptr);
|
||||
}
|
||||
|
||||
public void Swap(StdString str)
|
||||
{
|
||||
UnsafeNativeMethods.std_string__swap__Rstr(mpPtr, str.mpPtr);
|
||||
GC.KeepAlive(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user