SandroGrzicic/ScalaBuff — pull request #75 by orElse (2013-11-18 09:14:12+00:00)
Title: Support for reading packed list

with this change the scalabuff compiler will generate additional cases for reading packed lists
this doesn't add support for writing packed lists

the message:

message SimpleMessage
{
required string sessionGuid = 1 ;
repeated uint32 integers = 2 ;
repeated string strings = 3 ;
repeated double doubles = 4 ;
repeated bool booleans = 5 ;
}

will translate to:

while (true) in.readTag match {
case 0 => return __newMerged
case 10 => __sessionGuid = in.readString()
case 16 => __integers += in.readUInt32()
case 18 =>
val length = in.readRawVarint32()
val limit = in.pushLimit(length)
while (in.getBytesUntilLimit() > 0) {
__integers += in.readUInt32()
}
in.popLimit(limit)
case 26 => __strings += in.readString()
case 33 => __doubles += in.readDouble()
case 34 =>
val length = in.readRawVarint32()
val limit = in.pushLimit(length)
while (in.getBytesUntilLimit() > 0) {
__doubles += in.readDouble()
}
in.popLimit(limit)
case 40 => __booleans += in.readBool()
case 42 =>
val length = in.readRawVarint32()
val limit = in.pushLimit(length)
while (in.getBytesUntilLimit() > 0) {
__booleans += in.readBool()
}
in.popLimit(limit)
case default => if (!in.skipField(default)) return __newMerged
}