pb: Add natives to work with 64 bit values (#943)

* Add natives to work with 64 bit Protobuf values

* Fix linux build

* FIX alignment requirements

* FIX alignment requirements V2

* Remove legacy API

* Inattention
This commit is contained in:
komashchenko
2019-03-04 09:06:43 -08:00
committed by Kyle Sanderson
parent 7f9ceaac06
commit 8031e42bda
4 changed files with 194 additions and 1 deletions
+3
View File
@@ -279,6 +279,7 @@ public void __ext_core_SetNTVOptional()
MarkNativeAsOptional("PbAddMessage");
MarkNativeAsOptional("Protobuf.ReadInt");
MarkNativeAsOptional("Protobuf.ReadInt64");
MarkNativeAsOptional("Protobuf.ReadFloat");
MarkNativeAsOptional("Protobuf.ReadBool");
MarkNativeAsOptional("Protobuf.ReadString");
@@ -288,6 +289,7 @@ public void __ext_core_SetNTVOptional()
MarkNativeAsOptional("Protobuf.ReadVector2D");
MarkNativeAsOptional("Protobuf.GetRepeatedFieldCount");
MarkNativeAsOptional("Protobuf.SetInt");
MarkNativeAsOptional("Protobuf.SetInt64");
MarkNativeAsOptional("Protobuf.SetFloat");
MarkNativeAsOptional("Protobuf.SetBool");
MarkNativeAsOptional("Protobuf.SetString");
@@ -296,6 +298,7 @@ public void __ext_core_SetNTVOptional()
MarkNativeAsOptional("Protobuf.SetVector");
MarkNativeAsOptional("Protobuf.SetVector2D");
MarkNativeAsOptional("Protobuf.AddInt");
MarkNativeAsOptional("Protobuf.AddInt64");
MarkNativeAsOptional("Protobuf.AddFloat");
MarkNativeAsOptional("Protobuf.AddBool");
MarkNativeAsOptional("Protobuf.AddString");
+24 -1
View File
@@ -46,6 +46,14 @@ methodmap Protobuf < Handle
// @return Integer value read.
// @error Non-existent field, or incorrect field type.
public native int ReadInt(const char[] field, int index = PB_FIELD_NOT_REPEATED);
// Reads an int64, uint64, sint64, fixed64, sfixed64 from a protobuf message.
//
// @param field Field name.
// @param value Array to represent the large integer (0=High bits, 1=Low bits).
// @param index Index into repeated field.
// @error Non-existent field, or incorrect field type.
public native void ReadInt64(const char[] field, int value[2], int index = PB_FIELD_NOT_REPEATED);
// Reads a float or downcasted double from a protobuf message.
//
@@ -125,7 +133,15 @@ methodmap Protobuf < Handle
// @param value Integer value to set.
// @param index Index into repeated field.
// @error Non-existent field, or incorrect field type.
public native int SetInt(const char[] field, int value, int index = PB_FIELD_NOT_REPEATED);
public native void SetInt(const char[] field, int value, int index = PB_FIELD_NOT_REPEATED);
// Sets an int64, uint64, sint64, fixed64, sfixed64 on a protobuf message.
//
// @param field Field name.
// @param value Large integer value to set (0=High bits, 1=Low bits).
// @param index Index into repeated field.
// @error Non-existent field, or incorrect field type.
public native void SetInt64(const char[] field, int value[2], int index = PB_FIELD_NOT_REPEATED);
// Sets a float or double on a protobuf message.
//
@@ -189,6 +205,13 @@ methodmap Protobuf < Handle
// @param value Integer value to add.
// @error Non-existent field, or incorrect field type.
public native void AddInt(const char[] field, int value);
// Add an int64, uint64, sint64, fixed64, sfixed64 to a protobuf message repeated field.
//
// @param field Field name.
// @param value Large integer value to add (0=High bits, 1=Low bits).
// @error Non-existent field, or incorrect field type.
public native void AddInt64(const char[] field, int value[2]);
// Add a float or double to a protobuf message repeated field.
//