本文整理汇总了C#中IronPython.Modules.MemoryHolder.ReadIntPtr方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryHolder.ReadIntPtr方法的具体用法?C# MemoryHolder.ReadIntPtr怎么用?C# MemoryHolder.ReadIntPtr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Modules.MemoryHolder
的用法示例。
在下文中一共展示了MemoryHolder.ReadIntPtr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
object INativeType.GetValue(MemoryHolder owner, object readingFrom, int offset, bool raw) {
if (!raw) {
Pointer res = (Pointer)PythonCalls.Call(Context.SharedContext, this);
res._memHolder.WriteIntPtr(0, owner.ReadIntPtr(offset));
res._memHolder.AddObject(offset, readingFrom);
return res;
}
return owner.ReadIntPtr(offset).ToPython();
}
示例2: switch
object INativeType.GetValue(MemoryHolder/*!*/ owner, object readingFrom, int offset, bool raw) {
object res;
switch (_type) {
case SimpleTypeKind.Boolean: res = owner.ReadByte(offset) != 0 ? ScriptingRuntimeHelpers.True : ScriptingRuntimeHelpers.False; break;
case SimpleTypeKind.Char: res = new string((char)owner.ReadByte(offset), 1); break;
case SimpleTypeKind.SignedByte: res = GetIntReturn((int)(sbyte)owner.ReadByte(offset)); break;
case SimpleTypeKind.UnsignedByte: res = GetIntReturn((int)owner.ReadByte(offset)); break;
case SimpleTypeKind.SignedShort: res = GetIntReturn((int)owner.ReadInt16(offset)); break;
case SimpleTypeKind.WChar: res = new string((char)owner.ReadInt16(offset), 1); break;
case SimpleTypeKind.UnsignedShort: res = GetIntReturn((int)(ushort)owner.ReadInt16(offset)); break;
case SimpleTypeKind.VariantBool: res = owner.ReadInt16(offset) != 0 ? ScriptingRuntimeHelpers.True : ScriptingRuntimeHelpers.False; break;
case SimpleTypeKind.SignedInt: res = GetIntReturn((int)owner.ReadInt32(offset)); break;
case SimpleTypeKind.UnsignedInt: res = GetIntReturn((uint)owner.ReadInt32(offset)); break;
case SimpleTypeKind.UnsignedLong: res = GetIntReturn((uint)owner.ReadInt32(offset)); break;
case SimpleTypeKind.SignedLong: res = GetIntReturn(owner.ReadInt32(offset)); break;
case SimpleTypeKind.Single: res = GetSingleReturn(owner.ReadInt32(offset)); break;
case SimpleTypeKind.Double: res = GetDoubleReturn(owner.ReadInt64(offset)); break;
case SimpleTypeKind.UnsignedLongLong: res = GetIntReturn((ulong)owner.ReadInt64(offset)); break;
case SimpleTypeKind.SignedLongLong: res = GetIntReturn(owner.ReadInt64(offset)); break;
case SimpleTypeKind.Object: res = GetObjectReturn(owner.ReadIntPtr(offset)); break;
case SimpleTypeKind.Pointer: res = owner.ReadIntPtr(offset).ToPython(); break;
case SimpleTypeKind.CharPointer: res = owner.ReadMemoryHolder(offset).ReadAnsiString(0); break;
case SimpleTypeKind.WCharPointer: res = owner.ReadMemoryHolder(offset).ReadUnicodeString(0); break;
default:
throw new InvalidOperationException();
}
if (!raw && IsSubClass) {
res = PythonCalls.Call(this, res);
}
return res;
}
示例3: ToPython
object INativeType.GetValue(MemoryHolder owner, int offset, bool raw) {
return ToPython(owner.ReadIntPtr(offset));
}