binary-xml-decoder.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_BINARYXMLDECODER_HPP
23 #define NDN_BINARYXMLDECODER_HPP
24 
25 #include <stdexcept>
26 #include "../c/encoding/binary-xml-decoder.h"
27 
28 using namespace std;
29 
30 namespace ndn {
31 
36 public:
40  BinaryXmlDecoder(const uint8_t *input, size_t inputLength)
41  {
42  ndn_BinaryXmlDecoder_initialize(this, input, inputLength);
43  }
44 
51  bool
52  peekDTag(unsigned int expectedTag)
53  {
54  int gotExpectedTag;
55  ndn_Error error;
56  if ((error = ndn_BinaryXmlDecoder_peekDTag(this, expectedTag, &gotExpectedTag)))
57  throw runtime_error(ndn_getErrorString(error));
58 
59  return gotExpectedTag != 0;
60  }
61 };
62 
63 }
64 
65 #endif
Copyright (C) 2013-2015 Regents of the University of California.
Definition: common.hpp:35
A BinaryXmlDecoder extends a C ndn_BinaryXmlDecoder struct and wraps related functions.
Definition: binary-xml-decoder.hpp:35
bool peekDTag(unsigned int expectedTag)
Decode the header from the input starting at offset, and if it is a DTAG where the value is the expec...
Definition: binary-xml-decoder.hpp:52
Copyright (C) 2015 Regents of the University of California.
BinaryXmlDecoder(const uint8_t *input, size_t inputLength)
Initialize the base ndn_BinaryXmlDecoder struct with the input.
Definition: binary-xml-decoder.hpp:40
Copyright (C) 2013-2015 Regents of the University of California.
Definition: binary-xml-decoder.h:33