mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 07:06:26 +00:00
Namerdart (#7187)
* Apply Namer to Dart. - Also refactor idl_gen_dart a bit - to use more const and references - out parameters should be the last argument * Add keyword test * minor fixes * fix merge * extra 's' * move dart keyord into dart dir * Address comments * Use $ for escaping keywords * Outparameters for namespace_map * Escape dollar in toString * Escape dollar in toString2 * Use UpperCamelCase for types and variants * try to fix ToString * namer Type fixes * Remove path prefixing in imports * gen code Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -25,22 +25,27 @@ public struct KeywordsInTable : IFlatbufferObject
|
||||
public bool MutatePrivate(KeywordTest.@public @private) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, (int)@private); return true; } else { return false; } }
|
||||
public int Type { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||
public bool MutateType(int type) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, type); return true; } else { return false; } }
|
||||
public bool Default { get { int o = __p.__offset(10); return o != 0 ? 0!=__p.bb.Get(o + __p.bb_pos) : (bool)false; } }
|
||||
public bool MutateDefault(bool @default) { int o = __p.__offset(10); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)(@default ? 1 : 0)); return true; } else { return false; } }
|
||||
|
||||
public static Offset<KeywordTest.KeywordsInTable> CreateKeywordsInTable(FlatBufferBuilder builder,
|
||||
KeywordTest.ABC @is = KeywordTest.ABC.@void,
|
||||
KeywordTest.@public @private = KeywordTest.@public.NONE,
|
||||
int type = 0) {
|
||||
builder.StartTable(3);
|
||||
int type = 0,
|
||||
bool @default = false) {
|
||||
builder.StartTable(4);
|
||||
KeywordsInTable.AddType(builder, type);
|
||||
KeywordsInTable.AddPrivate(builder, @private);
|
||||
KeywordsInTable.AddIs(builder, @is);
|
||||
KeywordsInTable.AddDefault(builder, @default);
|
||||
return KeywordsInTable.EndKeywordsInTable(builder);
|
||||
}
|
||||
|
||||
public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(3); }
|
||||
public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(4); }
|
||||
public static void AddIs(FlatBufferBuilder builder, KeywordTest.ABC @is) { builder.AddInt(0, (int)@is, 0); }
|
||||
public static void AddPrivate(FlatBufferBuilder builder, KeywordTest.@public @private) { builder.AddInt(1, (int)@private, 0); }
|
||||
public static void AddType(FlatBufferBuilder builder, int type) { builder.AddInt(2, type, 0); }
|
||||
public static void AddDefault(FlatBufferBuilder builder, bool @default) { builder.AddBool(3, @default, false); }
|
||||
public static Offset<KeywordTest.KeywordsInTable> EndKeywordsInTable(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<KeywordTest.KeywordsInTable>(o);
|
||||
@@ -54,6 +59,7 @@ public struct KeywordsInTable : IFlatbufferObject
|
||||
_o.Is = this.Is;
|
||||
_o.Private = this.Private;
|
||||
_o.Type = this.Type;
|
||||
_o.Default = this.Default;
|
||||
}
|
||||
public static Offset<KeywordTest.KeywordsInTable> Pack(FlatBufferBuilder builder, KeywordsInTableT _o) {
|
||||
if (_o == null) return default(Offset<KeywordTest.KeywordsInTable>);
|
||||
@@ -61,7 +67,8 @@ public struct KeywordsInTable : IFlatbufferObject
|
||||
builder,
|
||||
_o.Is,
|
||||
_o.Private,
|
||||
_o.Type);
|
||||
_o.Type,
|
||||
_o.Default);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,11 +80,14 @@ public class KeywordsInTableT
|
||||
public KeywordTest.@public Private { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
public int Type { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("default")]
|
||||
public bool Default { get; set; }
|
||||
|
||||
public KeywordsInTableT() {
|
||||
this.Is = KeywordTest.ABC.@void;
|
||||
this.Private = KeywordTest.@public.NONE;
|
||||
this.Type = 0;
|
||||
this.Default = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user