kiwi-schema
Advanced tools
Comparing version 0.4.5 to 0.4.6
16
cpp.js
@@ -69,3 +69,3 @@ "use strict"; | ||
cpp.push('public:'); | ||
cpp.push(' bool parse(kiwi::ByteBuffer &bb);'); | ||
cpp.push(' template <typename InputByteBuffer> bool parse(InputByteBuffer &bb);'); | ||
cpp.push(' const kiwi::BinarySchema &underlyingSchema() const { return _schema; }'); | ||
@@ -75,3 +75,3 @@ for (let i = 0; i < schema.definitions.length; i++) { | ||
if (definition.kind === 'MESSAGE') { | ||
cpp.push(' bool skip' + definition.name + 'Field(kiwi::ByteBuffer &bb, uint32_t id) const;'); | ||
cpp.push(' template <typename InputByteBuffer> bool skip' + definition.name + 'Field(InputByteBuffer &bb, uint32_t id) const;'); | ||
} | ||
@@ -113,3 +113,3 @@ } | ||
cpp.push(''); | ||
cpp.push('bool BinarySchema::parse(kiwi::ByteBuffer &bb) {'); | ||
cpp.push('template <typename InputByteBuffer> bool BinarySchema::parse(InputByteBuffer &bb) {'); | ||
cpp.push(' if (!_schema.parse(bb)) return false;'); | ||
@@ -128,3 +128,3 @@ for (let i = 0; i < schema.definitions.length; i++) { | ||
if (definition.kind === 'MESSAGE') { | ||
cpp.push('bool BinarySchema::skip' + definition.name + 'Field(kiwi::ByteBuffer &bb, uint32_t id) const {'); | ||
cpp.push('template <typename InputByteBuffer> bool BinarySchema::skip' + definition.name + 'Field(InputByteBuffer &bb, uint32_t id) const {'); | ||
cpp.push(' return _schema.skipField(bb, _index' + definition.name + ', id);'); | ||
@@ -178,4 +178,4 @@ cpp.push('}'); | ||
} | ||
cpp.push(' bool encode(kiwi::ByteBuffer &bb);'); | ||
cpp.push(' bool decode(kiwi::ByteBuffer &bb, kiwi::MemoryPool &pool, const BinarySchema *schema = nullptr);'); | ||
cpp.push(' template <typename OutputByteBuffer> bool encode(OutputByteBuffer &bb);'); | ||
cpp.push(' template <typename InputByteBuffer> bool decode(InputByteBuffer &bb, kiwi::MemoryPool &pool, const BinarySchema *schema = nullptr);'); | ||
cpp.push(''); | ||
@@ -263,3 +263,3 @@ cpp.push('private:'); | ||
} | ||
cpp.push('bool ' + definition.name + '::encode(kiwi::ByteBuffer &_bb) {'); | ||
cpp.push('template <typename OutputByteBuffer> bool ' + definition.name + '::encode(OutputByteBuffer &_bb) {'); | ||
for (let j = 0; j < fields.length; j++) { | ||
@@ -341,3 +341,3 @@ let field = fields[j]; | ||
cpp.push(''); | ||
cpp.push('bool ' + definition.name + '::decode(kiwi::ByteBuffer &_bb, kiwi::MemoryPool &_pool, const BinarySchema *_schema) {'); | ||
cpp.push('template <typename InputByteBuffer> bool ' + definition.name + '::decode(InputByteBuffer &_bb, kiwi::MemoryPool &_pool, const BinarySchema *_schema) {'); | ||
for (let j = 0; j < fields.length; j++) { | ||
@@ -344,0 +344,0 @@ if (fields[j].isArray) { |
{ | ||
"name": "kiwi-schema", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"description": "A schema-based binary format for efficiently encoding trees of data", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
109234