[svn] commit: r328 - in /branches/jinmei-dnsmessageapi/src/lib/dns/cpp: Makefile.am buffer.h buffer_unittest.cc exceptions.h name.cc name.h
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Dec 2 09:08:09 UTC 2009
Author: jinmei
Date: Wed Dec 2 09:08:09 2009
New Revision: 328
Log:
Input/Output buffer classes with design/API documentation and unittest cases.
Added:
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/buffer.h
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/buffer_unittest.cc
Modified:
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/Makefile.am
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/exceptions.h
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc
branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.h
Modified: branches/jinmei-dnsmessageapi/src/lib/dns/cpp/Makefile.am
==============================================================================
--- branches/jinmei-dnsmessageapi/src/lib/dns/cpp/Makefile.am (original)
+++ branches/jinmei-dnsmessageapi/src/lib/dns/cpp/Makefile.am Wed Dec 2 09:08:09 2009
@@ -1,10 +1,11 @@
lib_LIBRARIES = libdns.a
-libdns_a_SOURCES = name.cc name.h exceptions.h
+libdns_a_SOURCES = buffer.h name.cc name.h exceptions.h
TESTS =
if HAVE_GTEST
TESTS += run_unittests
-run_unittests_SOURCES = exceptions_unittest.cc run_unittests.cc
+run_unittests_SOURCES = buffer_unittest.cc exceptions_unittest.cc
+run_unittests_SOURCES += run_unittests.cc
run_unittests_CPPFLAGS = $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(GTEST_LDFLAGS)
run_unittests_LDADD = ./libdns.a $(GTEST_LDADD)
Modified: branches/jinmei-dnsmessageapi/src/lib/dns/cpp/exceptions.h
==============================================================================
--- branches/jinmei-dnsmessageapi/src/lib/dns/cpp/exceptions.h (original)
+++ branches/jinmei-dnsmessageapi/src/lib/dns/cpp/exceptions.h Wed Dec 2 09:08:09 2009
@@ -41,7 +41,7 @@
/// @param file the file name where the exception was thrown.
/// @param line the line in @ref file where the exception was thrown.
/// @param what a description (type) of the exception.
- Exception(const char* const file, size_t line, const char* what) :
+ Exception(const char* file, size_t line, const char* what) :
file_(file), line_(line), what_(what) {}
/// The destructor
virtual ~Exception() {}
Modified: branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc
==============================================================================
--- branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc (original)
+++ branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.cc Wed Dec 2 09:08:09 2009
@@ -16,6 +16,7 @@
#include <stdexcept>
+#include "buffer.h"
#include "name.h"
using namespace std;
@@ -278,7 +279,7 @@
}
string
-Name::to_text(bool omit_final_dot) const
+Name::toText(bool omit_final_dot) const
{
string tdata;
unsigned int nlen;
@@ -429,6 +430,6 @@
ostream&
operator<<(ostream& os, const Name& name)
{
- os << name.to_text();
+ os << name.toText();
return (os);
}
Modified: branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.h
==============================================================================
--- branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.h (original)
+++ branches/jinmei-dnsmessageapi/src/lib/dns/cpp/name.h Wed Dec 2 09:08:09 2009
@@ -22,7 +22,8 @@
namespace ISC {
namespace DNS {
-class Buffer;
+class InputBuffer;
+class OutputBuffer;
class NameCompressor;
class NameDecompressor;
@@ -53,20 +54,20 @@
Name() : length_(0), labels_(0) {}
explicit Name(const std::string& namestr) : length_(0), labels_(0)
{ from_string(namestr); }
- explicit Name(NameDecompressor& decompressor, Buffer& buffer);
+ explicit Name(NameDecompressor& decompressor, InputBuffer& buffer);
// copy constructor (default cp-ctor should work fine)
//Name(const Name& orig);
// destructor (default dtor should work fine)
//~Name();
- std::string to_text(bool omit_final_dot = false) const;
- void to_wire(Buffer& buffer, NameCompressor& compressor) const;
- size_t get_length() const { return (length_); }
- unsigned int get_labels() const { return (labels_); }
+ std::string toText(bool omit_final_dot = false) const;
+ void toWire(OutputBuffer& buffer, NameCompressor& compressor) const;
+ size_t getLength() const { return (length_); }
+ unsigned int getLabels() const { return (labels_); }
NameComparisonResult compare(const Name& other) const;
Name split(unsigned int first, unsigned int n) const;
Name concatenate(const Name& suffix) const;
- bool is_wildcard() const;
+ bool isWildcard() const;
bool operator==(const Name& other) const;
bool equals(const Name& other) const; // alias of ==
bool operator!=(const Name& other) const { return (!(*this == other)); }
More information about the bind10-changes
mailing list