/**
 * @author: Jeff Thompson
 * See COPYING for copyright and distribution information.
 */

#ifndef NDN_BINARYXMLSTRUCTUREDECODER_HPP
#define	NDN_BINARYXMLSTRUCTUREDECODER_HPP

#include <stdexcept>
#include "../c/encoding/BinaryXMLStructureDecoder.h"

namespace ndn {
  
/**
 * A BinaryXMLStructureDecoder wraps a C ndn_BinaryXMLStructureDecoder struct and related functions.
 */
class BinaryXMLStructureDecoder {
public:
  BinaryXMLStructureDecoder() 
  {
    ndn_BinaryXMLStructureDecoder_init(&base_);
  }
  
  /**
   * Continue scanning input starting from getOffset() to find the element end.  
   * If the end of the element which started at offset 0 is found, then return true and getOffset() is the length of 
   *   the element.  Otherwise return false, which means you should read more into input and call again.
   * @param input the input buffer. You have to pass in input each time because the buffer could be reallocated.
   * @param inputLength the number of bytes in input.
   * @return true if found the element end, false if need to read more. (This is the same as returning gotElementEnd().)
   */
  bool findElementEnd(unsigned char *input, unsigned int inputLength) 
  {
    ndn_Error error;
    if (error = ndn_BinaryXMLStructureDecoder_findElementEnd(&base_, input, inputLength))
      throw std::runtime_error(ndn_getErrorString(error));
    return gotElementEnd();
  }
  
  unsigned int getOffset() const { return base_.offset; }
  bool gotElementEnd() const { return base_.gotElementEnd != 0; }
  
private:
  struct ndn_BinaryXMLStructureDecoder base_;
};

}

#endif
