Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
27823d55
Commit
27823d55
authored
Dec 09, 2014
by
Wouter van Oortmerssen
Committed by
Android (Google) Code Review
Dec 09, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Fixed Java ByteBuffer accessors generated for non-scalar vectors." into ub-games-master
parents
19361a58
95666692
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
idl_gen_general.cpp
src/idl_gen_general.cpp
+3
-1
Monster.java
tests/MyGame/Example/Monster.java
+0
-3
No files found.
src/idl_gen_general.cpp
View file @
27823d55
...
...
@@ -422,7 +422,9 @@ static void GenStruct(const LanguageParameters &lang, const Parser &parser,
code
+=
"Length("
+
offset_prefix
;
code
+=
"__vector_len(o) : 0; }
\n
"
;
}
if
((
field
.
value
.
type
.
base_type
==
BASE_TYPE_VECTOR
||
// Generate a ByteBuffer accessor for strings & vectors of scalars.
if
(((
field
.
value
.
type
.
base_type
==
BASE_TYPE_VECTOR
&&
IsScalar
(
field
.
value
.
type
.
VectorType
().
base_type
))
||
field
.
value
.
type
.
base_type
==
BASE_TYPE_STRING
)
&&
lang
.
language
==
GeneratorOptions
::
kJava
)
{
code
+=
" public ByteBuffer "
;
...
...
tests/MyGame/Example/Monster.java
View file @
27823d55
...
...
@@ -27,16 +27,13 @@ public class Monster extends Table {
public
Test
test4
(
int
j
)
{
return
test4
(
new
Test
(),
j
);
}
public
Test
test4
(
Test
obj
,
int
j
)
{
int
o
=
__offset
(
22
);
return
o
!=
0
?
obj
.
__init
(
__vector
(
o
)
+
j
*
4
,
bb
)
:
null
;
}
public
int
test4Length
()
{
int
o
=
__offset
(
22
);
return
o
!=
0
?
__vector_len
(
o
)
:
0
;
}
public
ByteBuffer
test4AsByteBuffer
()
{
return
__vector_as_bytebuffer
(
22
,
4
);
}
public
String
testarrayofstring
(
int
j
)
{
int
o
=
__offset
(
24
);
return
o
!=
0
?
__string
(
__vector
(
o
)
+
j
*
4
)
:
null
;
}
public
int
testarrayofstringLength
()
{
int
o
=
__offset
(
24
);
return
o
!=
0
?
__vector_len
(
o
)
:
0
;
}
public
ByteBuffer
testarrayofstringAsByteBuffer
()
{
return
__vector_as_bytebuffer
(
24
,
4
);
}
/// an example documentation comment: this will end up in the generated code
/// multiline too
public
Monster
testarrayoftables
(
int
j
)
{
return
testarrayoftables
(
new
Monster
(),
j
);
}
public
Monster
testarrayoftables
(
Monster
obj
,
int
j
)
{
int
o
=
__offset
(
26
);
return
o
!=
0
?
obj
.
__init
(
__indirect
(
__vector
(
o
)
+
j
*
4
),
bb
)
:
null
;
}
public
int
testarrayoftablesLength
()
{
int
o
=
__offset
(
26
);
return
o
!=
0
?
__vector_len
(
o
)
:
0
;
}
public
ByteBuffer
testarrayoftablesAsByteBuffer
()
{
return
__vector_as_bytebuffer
(
26
,
4
);
}
public
Monster
enemy
()
{
return
enemy
(
new
Monster
());
}
public
Monster
enemy
(
Monster
obj
)
{
int
o
=
__offset
(
28
);
return
o
!=
0
?
obj
.
__init
(
__indirect
(
o
+
bb_pos
),
bb
)
:
null
;
}
public
byte
testnestedflatbuffer
(
int
j
)
{
int
o
=
__offset
(
30
);
return
o
!=
0
?
bb
.
get
(
__vector
(
o
)
+
j
*
1
)
:
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment