Debian Codegraph @

src/h/ST_textspan_t.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * Project Info: http://plantuml.com
6 *
7 * If you like this project or if you find it useful, you can support us at:
8 *
9 * http://plantuml.com/patreon (only 1$ per month!)
10 * http://plantuml.com/paypal
11 *
12 * This file is part of Smetana.
13 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
14 *
15 * (C) Copyright 2009-2020, Arnaud Roques
16 *
17 * This translation is distributed under the same Licence as the original C program:
18 *
19 *************************************************************************
20 * Copyright (c) 2011 AT&T Intellectual Property
21 * All rights reserved. This program and the accompanying materials
22 * are made available under the terms of the Eclipse Public License v1.0
23 * which accompanies this distribution, and is available at
24 * http://www.eclipse.org/legal/epl-v10.html
25 *
26 * Contributors: See CVS logs. Details at http://www.graphviz.org/
27 *************************************************************************
28 *
29 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
30 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
31 *
32 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
33 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
34 *
35 * You may obtain a copy of the License at
36 *
37 * http://www.eclipse.org/legal/epl-v10.html
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
44 *
45 */
46 package h;
47
48 import java.util.ArrayList;
49 import java.util.List;
50
51 import smetana.core.CString;
52 import smetana.core.UnsupportedArrayOfStruct2;
53 import smetana.core.UnsupportedStructAndPtr;
54 import smetana.core.__array_of_ptr__;
55 import smetana.core.__ptr__;
56 import smetana.core.__struct__;
57 import smetana.core.size_t;
58 import smetana.core.amiga.StarStruct;
59
60 // UNUSED ?
61 public class ST_textspan_t extends UnsupportedStructAndPtr {
62
63 private final StarStruct parent;
64
65 public ST_textspan_t() {
66 this(null);
67 }
68
69 public ST_textspan_t(StarStruct parent) {
70 this.parent = parent;
71 }
72
73 public CString str;
74
75 // "textfont_t *font",
76 // "void *layout",
77 // "void (*free_layout) (void *layout)",
78 // "double yoffset_layout, yoffset_centerline",
79 public final ST_pointf size = new ST_pointf(this);
80 public int just;
81
82 public static class Array extends UnsupportedArrayOfStruct2 implements __ptr__, __array_of_ptr__{
83
84 private final List<ST_textspan_t> data;
85 private final int pos;
86
87 @Override
88 public __ptr__ setPtr(String fieldName, __ptr__ data) {
89 return getStruct().setPtr(fieldName, data);
90 }
91
92 @Override
93 public void setInt(String fieldName, int data) {
94 getStruct().setInt(fieldName, data);
95 }
96
97 @Override
98 public void setStruct(String fieldName, __struct__ data) {
99 getStruct().setStruct(fieldName, data);
100 }
101
102 @Override
103 public Array asPtr() {
104 return this;
105 }
106
107 @Override
108 public ST_textspan_t getStruct() {
109 return data.get(pos);
110 }
111
112 public Array(int size) {
113 this.data = new ArrayList<ST_textspan_t>();
114 this.pos = 0;
115 for (int i = 0; i < size; i++) {
116 data.add(new ST_textspan_t());
117 }
118 }
119
120 public Array reallocJ(int newsize) {
121 while (data.size() < newsize) {
122 data.add(new ST_textspan_t());
123 }
124 return this;
125 }
126
127 public Array plus(int delta) {
128 return plusJ(delta);
129 }
130
131 private Array(List<ST_textspan_t> data, int pos) {
132 this.data = data;
133 this.pos = pos;
134 }
135
136 public ST_textspan_t get(int i) {
137 return this.data.get(pos + i);
138 }
139
140 public Array plusJ(int i) {
141 return new Array(data, pos + i);
142 }
143
144 public int minus(Array other) {
145 if (this.data != other.data) {
146 throw new IllegalArgumentException();
147 }
148 return this.pos - other.pos;
149 }
150
151 public Array move(int delta) {
152 throw new UnsupportedOperationException(getClass().toString());
153 }
154
155 public void realloc(size_t nb) {
156 throw new UnsupportedOperationException(getClass().toString());
157 }
158
159 public int comparePointerInternal(__array_of_ptr__ other) {
160 throw new UnsupportedOperationException(getClass().toString());
161 }
162
163
164 }
165
166
167 @Override
168 public void setInt(String fieldName, int data) {
169 if (fieldName.equals("just")) {
170 this.just = data;
171 return;
172 }
173 super.setInt(fieldName, data);
174 }
175
176 @Override
177 public __ptr__ setPtr(String fieldName, __ptr__ newData) {
178 if (fieldName.equals("str")) {
179 this.str = (CString) newData;
180 return str;
181 }
182 return super.setPtr(fieldName, newData);
183 }
184
185 }
186
187 // typedef struct {
188 // char *str; /* stored in utf-8 */
189 // textfont_t *font;
190 // void *layout;
191 // void (*free_layout) (void *layout); /* FIXME - this is ugly */
192 // double yoffset_layout, yoffset_centerline;
193 // pointf size;
194 // char just; /* 'l' 'n' 'r' */ /* FIXME */
195 // } textspan_t;