internal T WithRaw <T>(Func <RawOutputTarget, T> action) { byte[] type = Encoding.UTF8.GetBytes(Type.ToTypeString()); byte[] name = Name != null?Encoding.UTF8.GetBytes(Name) : null; byte[] path = Path != null?Encoding.UTF8.GetBytes(Path) : null; unsafe { fixed(byte *typePtr = type) { fixed(byte *namePtr = name) { fixed(byte *pathPtr = path) { var rawtarget = new RawOutputTarget { Handle = this.Handle ?? UIntPtr.Zero, Type = new Utf8String(new IntPtr(typePtr), type.Length), Name = new Utf8String(new IntPtr(namePtr), name != null ? name.Length : 0), Path = new Utf8String(new IntPtr(pathPtr), path != null ? path.Length : 0), Test = this.Test.ToTrilean(), Doctest = this.Doctest.ToTrilean(), Bench = this.Bench.ToTrilean(), Doc = this.Doc.ToTrilean(), Plugin = this.Plugin.ToTrilean(), Harness = this.Harness.ToTrilean(), }; return(action(rawtarget)); } } } } }
internal OutputTarget(RawOutputTarget t) { Type = OutputTargetTypeExtensions.FromString(t.Type.ToString()); Handle = t.Handle; Name = t.Name.ToString(); Path = t.Path.ToString(); Test = t.Test.ToBool(); Doctest = t.Doctest.ToBool(); Bench = t.Bench.ToBool(); Doc = t.Doc.ToBool(); Plugin = t.Plugin.ToBool(); Harness = t.Harness.ToBool(); }
internal static extern UIntPtr set_output_target(IntPtr manifest, RawOutputTarget target);