diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-12-22 11:37:01 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-12-22 11:37:01 -0800 |
commit | 1bcab1377de6afe8c0f9c895cdba04baacf3e4a5 (patch) | |
tree | 4d478ccff5da0dee3c217c01f815ee1764965501 /bindings/cpp/upb/bytestream.cc | |
parent | b5f5ee867e6c91b77490dc8894236f17a47bde00 (diff) |
Sync with internal Google development.
This breaks the open-source build, will
follow up with a change to fix it.
Diffstat (limited to 'bindings/cpp/upb/bytestream.cc')
-rw-r--r-- | bindings/cpp/upb/bytestream.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bindings/cpp/upb/bytestream.cc b/bindings/cpp/upb/bytestream.cc new file mode 100644 index 0000000..df0797e --- /dev/null +++ b/bindings/cpp/upb/bytestream.cc @@ -0,0 +1,39 @@ +// +// upb - a minimalist implementation of protocol buffers. +// +// Copyright (c) 2011 Google Inc. See LICENSE for details. +// Author: Josh Haberman <jhaberman@gmail.com> + +#include "bytestream.hpp" + +namespace upb { + +upb_bytesrc_vtbl* ByteSourceBase::vtable() { + static upb_bytesrc_vtbl vtbl = { + &ByteSourceBase::VFetch, + &ByteSourceBase::VDiscard, + &ByteSourceBase::VCopy, + &ByteSourceBase::VGetPtr, + }; + return &vtbl; +} + +upb_bytesuccess_t ByteSourceBase::VFetch(void *src, uint64_t ofs, size_t *len) { + return static_cast<ByteSourceBase*>(src)->Fetch(ofs, len); +} + +void ByteSourceBase::VCopy( + const void *src, uint64_t ofs, size_t len, char* dest) { + static_cast<const ByteSourceBase*>(src)->Copy(ofs, len, dest); +} + +void ByteSourceBase::VDiscard(void *src, uint64_t ofs) { + static_cast<ByteSourceBase*>(src)->Discard(ofs); +} + +const char * ByteSourceBase::VGetPtr( + const void *src, uint64_t ofs, size_t* len) { + return static_cast<const ByteSourceBase*>(src)->GetPtr(ofs, len); +} + +} // namespace upb |