1 /* 2 * hunt-proton: AMQP Protocol library for D programming language. 3 * 4 * Copyright (C) 2018-2019 HuntLabs 5 * 6 * Website: https://www.huntlabs.net/ 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 12 module hunt.proton.codec.Encoder; 13 14 import hunt.proton.codec.AMQPType; 15 import hunt.proton.amqp.Binary; 16 import hunt.proton.amqp.Decimal128; 17 import hunt.proton.amqp.Decimal32; 18 import hunt.proton.amqp.Decimal64; 19 import hunt.proton.amqp.DescribedType; 20 import hunt.proton.amqp.Symbol; 21 import hunt.proton.amqp.UnsignedByte; 22 import hunt.proton.amqp.UnsignedInteger; 23 import hunt.proton.amqp.UnsignedLong; 24 import hunt.proton.amqp.UnsignedShort; 25 26 import hunt.collection.List; 27 import hunt.collection.Map; 28 29 import hunt.time.LocalDateTime; 30 import hunt.collection.List; 31 import hunt.collection.Map; 32 import hunt.Boolean; 33 import hunt.Byte; 34 import hunt.Short; 35 import hunt.Integer; 36 import hunt.Long; 37 import hunt.Char; 38 import hunt.Double; 39 import hunt.Float; 40 import hunt.String; 41 import std.uuid; 42 43 44 alias Date = hunt.time.LocalDateTime.LocalDateTime; 45 46 interface Encoder 47 { 48 void writeNull(); 49 50 void writeBoolean(bool b); 51 52 void writeBoolean(Boolean b); 53 54 void writeUnsignedByte(UnsignedByte ub); 55 56 void writeUnsignedShort(UnsignedShort us); 57 58 void writeUnsignedInteger(UnsignedInteger us); 59 60 void writeUnsignedLong(UnsignedLong ul); 61 62 void writeByte(byte b); 63 64 void writeByte(Byte b); 65 66 void writeShort(short s); 67 68 void writeShort(Short s); 69 70 void writeInteger(int i); 71 72 void writeInteger(Integer i); 73 74 void writeLong(long l); 75 76 void writeLong(Long l); 77 78 void writeFloat(float f); 79 80 void writeFloat(Float f); 81 82 void writeDouble(double d); 83 84 void writeDouble(Double d); 85 86 void writeDecimal32(Decimal32 d); 87 88 void writeDecimal64(Decimal64 d); 89 90 void writeDecimal128(Decimal128 d); 91 92 void writeCharacter(char c); 93 94 void writeCharacter(Char c); 95 96 void writeTimestamp(long d); 97 98 void writeTimestamp(Date d); 99 100 void writeUUID(UUID uuid); 101 102 void writeBinary(Binary b); 103 104 void writeString(String s); 105 106 void writeSymbol(Symbol s); 107 108 void writeList(Object l); 109 110 void writeMap(Object m); 111 112 void writeDescribedType(DescribedType d); 113 114 //void writeArray(bool[] a); 115 //void writeArray(byte[] a); 116 //void writeArray(short[] a); 117 void writeArray(int[] a); 118 void writeArray(long[] a); 119 void writeArray(float[] a); 120 void writeArray(double[] a); 121 void writeArray(char[] a); 122 void writeArray(Object[] a); 123 124 void writeObject(Object o); 125 126 // void register(V)(AMQPType!(V) type); 127 128 // AMQPType getType(Object element); 129 }