source upload

This commit is contained in:
Razor12911
2022-01-17 22:16:47 +02:00
parent 12936d065b
commit 098e8c48de
1778 changed files with 1206749 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,64 @@
{ Unit pbTestImport1Messages.pas }
{ Generated from TestImport1.proto }
{ Package TestImport1 }
unit pbTestImport1Messages;
interface
uses
flcUtils,
flcStrings,
flcProtoBufUtils;
{ TEnumGlobal }
type
TEnumGlobal = (
enumglobalGVal1 = 1,
enumglobalGVal2 = 2
);
function pbEncodeValueEnumGlobal(var Buf; const BufSize: Integer; const Value: TEnumGlobal): Integer;
function pbEncodeFieldEnumGlobal(var Buf; const BufSize: Integer; const FieldNum: Integer; const Value: TEnumGlobal): Integer;
function pbDecodeValueEnumGlobal(const Buf; const BufSize: Integer; var Value: TEnumGlobal): Integer;
procedure pbDecodeFieldEnumGlobal(const Field: TpbProtoBufDecodeField; var Value: TEnumGlobal);
implementation
{ TEnumGlobal }
function pbEncodeValueEnumGlobal(var Buf; const BufSize: Integer; const Value: TEnumGlobal): Integer;
begin
Result := pbEncodeValueInt32(Buf, BufSize, Ord(Value));
end;
function pbEncodeFieldEnumGlobal(var Buf; const BufSize: Integer; const FieldNum: Integer; const Value: TEnumGlobal): Integer;
begin
Result := pbEncodeFieldInt32(Buf, BufSize, FieldNum, Ord(Value));
end;
function pbDecodeValueEnumGlobal(const Buf; const BufSize: Integer; var Value: TEnumGlobal): Integer;
var I : LongInt;
begin
Result := pbDecodeValueInt32(Buf, BufSize, I);
Value := TEnumGlobal(I);
end;
procedure pbDecodeFieldEnumGlobal(const Field: TpbProtoBufDecodeField; var Value: TEnumGlobal);
var I : LongInt;
begin
pbDecodeFieldInt32(Field, I);
Value := TEnumGlobal(I);
end;
end.

View File

@@ -0,0 +1,86 @@
//
// Test proto file for ProtoCodeGen
//
// TODO
// * CodeGen: optional fields in records: indicate which fields have been populated
// * CodeGen: unknown fields in records
// * services
// * options
// * extensions
// * CodeGen: generate objects
// * Dots (.) in package identifier, e.g. package abc.def;
// * Comments from proto file in generated file
// * Bytes type e.g. optional bytes DefField10 = 10 [default = "123"];
package test1;
import "TestImport1.proto";
// enumeration
enum EnumG0 {
g1 = 1;
g2 = 2;
}
// simple message
message TestMsg0 {
required int32 Field1 = 1;
required int64 Field2 = 2;
}
message TestMsg1 {
// fields with defaults
optional int32 DefField1 = 1 [default = 2];
optional int64 DefField2 = 2 [default = -1];
optional string DefField3 = 3 [default = "yes"];
optional double DefField4 = 4 [default = 1.1];
optional bool DefField5 = 5 [default = true];
optional EnumG0 DefField6 = 6 [default = g2];
optional sint64 DefField7 = 7 [default = 100];
optional fixed32 DefField8 = 8 [default = 1];
optional float DefField9 = 9 [default = 1.23e1];
// field of message type
optional TestMsg0 FieldMsg1 = 20;
// nested enumeration
enum Enum1 {
Val1 = 1;
Val2 = 2;
}
// fields of nested enumeration type
optional Enum1 FieldE1 = 21;
optional TestMsg1.Enum1 FieldE2 = 22 [default = Val2, packed = true];
// nested message
message TestNested1 {
optional int32 Field1 = 1;
}
// fields of nested message type
optional TestNested1 FieldNested1 = 30;
optional TestMsg1.TestNested1 FieldNested2 = 31;
// repeated fields
repeated int32 FieldArr1 = 40;
repeated int32 FieldArr2 = 41 [packed = true];
repeated string FieldArr3 = 42;
repeated Enum1 FieldArrE1 = 43;
repeated TestMsg0 FieldMArr2 = 44;
// fields of imported types
optional TestImport1.EnumGlobal FieldImp1 = 50;
optional EnumGlobal FieldImp2 = 51;
// extensions 1000 to 1999;
}
// test proto identifier name conversion
message test_iden1 {
optional int32 field_name_test_1 = 1;
optional int32 field_Name_test_2 = 2;
}

View File

@@ -0,0 +1,6 @@
package TestImport1;
enum EnumGlobal {
gVal1 = 1;
gVal2 = 2;
}