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 CXString {
36 
37     static final MemoryLayout $struct$LAYOUT = MemoryLayout.structLayout(
38         ADDRESS.withName("data"),
39         JAVA_INT.withName("private_flags"),
40         MemoryLayout.paddingLayout(32)
41     );
42     public static MemoryLayout $LAYOUT() {
43         return CXString.$struct$LAYOUT;
44     }
45     static final VarHandle data$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("data"));
46     public static VarHandle data$VH() {
47         return CXString.data$VH;
48     }
49     public static MemoryAddress data$get(MemorySegment seg) {
50         return (jdk.incubator.foreign.MemoryAddress)CXString.data$VH.get(seg);
51     }
52     public static void data$set( MemorySegment seg, MemoryAddress x) {
53         CXString.data$VH.set(seg, x);
54     }
55     public static MemoryAddress data$get(MemorySegment seg, long index) {
56         return (jdk.incubator.foreign.MemoryAddress)CXString.data$VH.get(seg.asSlice(index*sizeof()));
57     }
58     public static void data$set(MemorySegment seg, long index, MemoryAddress x) {
59         CXString.data$VH.set(seg.asSlice(index*sizeof()), x);
60     }
61     static final VarHandle private_flags$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("private_flags"));
62     public static VarHandle private_flags$VH() {
63         return CXString.private_flags$VH;
64     }
65     public static int private_flags$get(MemorySegment seg) {
66         return (int)CXString.private_flags$VH.get(seg);
67     }
68     public static void private_flags$set( MemorySegment seg, int x) {
69         CXString.private_flags$VH.set(seg, x);
70     }
71     public static int private_flags$get(MemorySegment seg, long index) {
72         return (int)CXString.private_flags$VH.get(seg.asSlice(index*sizeof()));
73     }
74     public static void private_flags$set(MemorySegment seg, long index, int x) {
75         CXString.private_flags$VH.set(seg.asSlice(index*sizeof()), x);
76     }
77     public static long sizeof() { return $LAYOUT().byteSize(); }
78     public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
79     public static MemorySegment allocateArray(int len, SegmentAllocator allocator) {
80         return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
81     }
82     public static MemorySegment allocate(ResourceScope scope) { return allocate(SegmentAllocator.nativeAllocator(scope)); }
83     public static MemorySegment allocateArray(int len, ResourceScope scope) {
84         return allocateArray(len, SegmentAllocator.nativeAllocator(scope));
85     }
86     public static MemorySegment ofAddress(MemoryAddress addr, ResourceScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
87 }
88 
89