Added initial BinaryXMLEncoder
diff --git a/Makefile.am b/Makefile.am
index 2a5ea63..1a18a94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,6 +17,7 @@
ndn-cpp/Name.cpp ndn-cpp/Name.h ndn-cpp/Name.hpp \
ndn-cpp/encoding/BinaryXML.h \
ndn-cpp/encoding/BinaryXMLDecoder.c ndn-cpp/encoding/BinaryXMLDecoder.h \
+ ndn-cpp/encoding/BinaryXMLEncoder.c ndn-cpp/encoding/BinaryXMLEncoder.h \
ndn-cpp/encoding/BinaryXMLName.c ndn-cpp/encoding/BinaryXMLName.h \
ndn-cpp/encoding/BinaryXMLStructureDecoder.c ndn-cpp/encoding/BinaryXMLStructureDecoder.h \
ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp \
diff --git a/Makefile.in b/Makefile.in
index e1215d6..24efd9f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -136,10 +136,12 @@
am__dirstamp = $(am__leading_dot)dirstamp
am_ndn_cpp_a_OBJECTS = ndn-cpp/Name.$(OBJEXT) \
ndn-cpp/encoding/BinaryXMLDecoder.$(OBJEXT) \
+ ndn-cpp/encoding/BinaryXMLEncoder.$(OBJEXT) \
ndn-cpp/encoding/BinaryXMLName.$(OBJEXT) \
ndn-cpp/encoding/BinaryXMLStructureDecoder.$(OBJEXT) \
ndn-cpp/encoding/BinaryXMLWireFormat.$(OBJEXT) \
ndn-cpp/encoding/WireFormat.$(OBJEXT) \
+ ndn-cpp/util/DynamicUCharArray.$(OBJEXT) \
ndn-cpp/util/ndn_memory.$(OBJEXT)
ndn_cpp_a_OBJECTS = $(am_ndn_cpp_a_OBJECTS)
PROGRAMS = $(bin_PROGRAMS)
@@ -384,11 +386,13 @@
ndn-cpp/Name.cpp ndn-cpp/Name.h ndn-cpp/Name.hpp \
ndn-cpp/encoding/BinaryXML.h \
ndn-cpp/encoding/BinaryXMLDecoder.c ndn-cpp/encoding/BinaryXMLDecoder.h \
+ ndn-cpp/encoding/BinaryXMLEncoder.c ndn-cpp/encoding/BinaryXMLEncoder.h \
ndn-cpp/encoding/BinaryXMLName.c ndn-cpp/encoding/BinaryXMLName.h \
ndn-cpp/encoding/BinaryXMLStructureDecoder.c ndn-cpp/encoding/BinaryXMLStructureDecoder.h \
ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp \
ndn-cpp/encoding/BinaryXMLWireFormat.cpp ndn-cpp/encoding/BinaryXMLWireFormat.hpp \
ndn-cpp/encoding/WireFormat.cpp ndn-cpp/encoding/WireFormat.hpp \
+ ndn-cpp/util/DynamicUCharArray.c ndn-cpp/util/DynamicUCharArray.h \
ndn-cpp/util/ndn_memory.c ndn-cpp/util/ndn_memory.h
test_encode_decode_interest_SOURCES = test/test-encode-decode-interest.cpp
@@ -497,6 +501,9 @@
ndn-cpp/encoding/BinaryXMLDecoder.$(OBJEXT): \
ndn-cpp/encoding/$(am__dirstamp) \
ndn-cpp/encoding/$(DEPDIR)/$(am__dirstamp)
+ndn-cpp/encoding/BinaryXMLEncoder.$(OBJEXT): \
+ ndn-cpp/encoding/$(am__dirstamp) \
+ ndn-cpp/encoding/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/encoding/BinaryXMLName.$(OBJEXT): \
ndn-cpp/encoding/$(am__dirstamp) \
ndn-cpp/encoding/$(DEPDIR)/$(am__dirstamp)
@@ -515,6 +522,9 @@
ndn-cpp/util/$(DEPDIR)/$(am__dirstamp):
@$(MKDIR_P) ndn-cpp/util/$(DEPDIR)
@: > ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
+ndn-cpp/util/DynamicUCharArray.$(OBJEXT): \
+ ndn-cpp/util/$(am__dirstamp) \
+ ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
ndn-cpp/util/ndn_memory.$(OBJEXT): ndn-cpp/util/$(am__dirstamp) \
ndn-cpp/util/$(DEPDIR)/$(am__dirstamp)
@@ -589,10 +599,12 @@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/$(DEPDIR)/Name.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/BinaryXMLDecoder.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/BinaryXMLEncoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/BinaryXMLName.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/BinaryXMLStructureDecoder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/BinaryXMLWireFormat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/encoding/$(DEPDIR)/WireFormat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/util/$(DEPDIR)/DynamicUCharArray.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ndn-cpp/util/$(DEPDIR)/ndn_memory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/test-encode-decode-interest.Po@am__quote@
diff --git a/ndn-cpp/encoding/BinaryXMLEncoder.c b/ndn-cpp/encoding/BinaryXMLEncoder.c
new file mode 100644
index 0000000..8aa2d0f
--- /dev/null
+++ b/ndn-cpp/encoding/BinaryXMLEncoder.c
@@ -0,0 +1,7 @@
+/*
+ * Author: Jeff Thompson
+ *
+ * BSD license, See the LICENSE file for more information.
+ */
+
+#include "BinaryXMLEncoder.h"
diff --git a/ndn-cpp/encoding/BinaryXMLEncoder.h b/ndn-cpp/encoding/BinaryXMLEncoder.h
new file mode 100644
index 0000000..cb20787
--- /dev/null
+++ b/ndn-cpp/encoding/BinaryXMLEncoder.h
@@ -0,0 +1,42 @@
+/*
+ * Author: Jeff Thompson
+ *
+ * BSD license, See the LICENSE file for more information.
+ */
+
+#ifndef NDN_BINARYXMLENCODER_H
+#define NDN_BINARYXMLENCODER_H
+
+#include "../util/DynamicUCharArray.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ndn_BinaryXMLEncoder {
+ struct ndn_DynamicUCharArray output; /**< receives the encoded output */
+ unsigned int offset; /**< the offset into output.array for the next encoding */
+};
+
+/**
+ * Initialize an ndn_BinaryXMLEncoder_init struct with the arguments for initializing the ndn_DynamicUCharArray.
+ * @param self pointer to the ndn_BinaryXMLEncoder struct
+ * @param outputArray the allocated array buffer to receive the encoding
+ * @param outputArrayLength the length of outputArray
+ * @param reallocFunction the realloc function used by ndn_DynamicUCharArray_ensureLength. If outputArrayLength
+ * is large enough to receive the entire encoding, this can be 0.
+ */
+static inline void ndn_BinaryXMLEncoder_init
+ (struct ndn_BinaryXMLEncoder *self, unsigned char *outputArray, unsigned int outputArrayLength,
+ unsigned char (*reallocFunction)(unsigned char *, unsigned int))
+{
+ ndn_DynamicUCharArray_init(&self->output, outputArray, outputArrayLength, reallocFunction);
+ self->offset = 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+