1 /* 2 * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 // Generated by jextract 27 28 package jdk.internal.clang.libclang; 29 30 import java.lang.invoke.MethodHandle; 31 import java.lang.invoke.VarHandle; 32 import java.nio.ByteOrder; 33 import jdk.incubator.foreign.*; 34 import static jdk.incubator.foreign.ValueLayout.*; 35 public class CXUnsavedFile { 36 37 static final MemoryLayout $struct$LAYOUT = MemoryLayout.structLayout( 38 ADDRESS.withName("Filename"), 39 ADDRESS.withName("Contents"), 40 JAVA_LONG.withName("Length") 41 ).withName("CXUnsavedFile"); 42 public static MemoryLayout $LAYOUT() { 43 return CXUnsavedFile.$struct$LAYOUT; 44 } 45 static final VarHandle Filename$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("Filename")); 46 public static VarHandle Filename$VH() { 47 return CXUnsavedFile.Filename$VH; 48 } 49 public static MemoryAddress Filename$get(MemorySegment seg) { 50 return (jdk.incubator.foreign.MemoryAddress)CXUnsavedFile.Filename$VH.get(seg); 51 } 52 public static void Filename$set( MemorySegment seg, MemoryAddress x) { 53 CXUnsavedFile.Filename$VH.set(seg, x); 54 } 55 public static MemoryAddress Filename$get(MemorySegment seg, long index) { 56 return (jdk.incubator.foreign.MemoryAddress)CXUnsavedFile.Filename$VH.get(seg.asSlice(index*sizeof())); 57 } 58 public static void Filename$set(MemorySegment seg, long index, MemoryAddress x) { 59 CXUnsavedFile.Filename$VH.set(seg.asSlice(index*sizeof()), x); 60 } 61 static final VarHandle Contents$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("Contents")); 62 public static VarHandle Contents$VH() { 63 return CXUnsavedFile.Contents$VH; 64 } 65 public static MemoryAddress Contents$get(MemorySegment seg) { 66 return (jdk.incubator.foreign.MemoryAddress)CXUnsavedFile.Contents$VH.get(seg); 67 } 68 public static void Contents$set( MemorySegment seg, MemoryAddress x) { 69 CXUnsavedFile.Contents$VH.set(seg, x); 70 } 71 public static MemoryAddress Contents$get(MemorySegment seg, long index) { 72 return (jdk.incubator.foreign.MemoryAddress)CXUnsavedFile.Contents$VH.get(seg.asSlice(index*sizeof())); 73 } 74 public static void Contents$set(MemorySegment seg, long index, MemoryAddress x) { 75 CXUnsavedFile.Contents$VH.set(seg.asSlice(index*sizeof()), x); 76 } 77 static final VarHandle Length$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("Length")); 78 public static VarHandle Length$VH() { 79 return CXUnsavedFile.Length$VH; 80 } 81 public static long Length$get(MemorySegment seg) { 82 return (long)CXUnsavedFile.Length$VH.get(seg); 83 } 84 public static void Length$set( MemorySegment seg, long x) { 85 CXUnsavedFile.Length$VH.set(seg, x); 86 } 87 public static long Length$get(MemorySegment seg, long index) { 88 return (long)CXUnsavedFile.Length$VH.get(seg.asSlice(index*sizeof())); 89 } 90 public static void Length$set(MemorySegment seg, long index, long x) { 91 CXUnsavedFile.Length$VH.set(seg.asSlice(index*sizeof()), x); 92 } 93 public static long sizeof() { return $LAYOUT().byteSize(); } 94 public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } 95 public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { 96 return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); 97 } 98 public static MemorySegment allocate(ResourceScope scope) { return allocate(SegmentAllocator.nativeAllocator(scope)); } 99 public static MemorySegment allocateArray(int len, ResourceScope scope) { 100 return allocateArray(len, SegmentAllocator.nativeAllocator(scope)); 101 } 102 public static MemorySegment ofAddress(MemoryAddress addr, ResourceScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } 103 } 104 105