BIND 10 trac878, updated. 54aad8af04350eb3a45a4bd6623681efa2f8d2fb Add conversion to c-style strings to let Google Test build.

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Sep 12 12:19:47 UTC 2011


The branch, trac878 has been updated
       via  54aad8af04350eb3a45a4bd6623681efa2f8d2fb (commit)
      from  3a11f2fd5bbe98fc555bfdf1cdf9019f7222e3e9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 54aad8af04350eb3a45a4bd6623681efa2f8d2fb
Author: Shane Kerr <shane at isc.org>
Date:   Mon Sep 12 14:19:17 2011 +0200

    Add conversion to c-style strings to let Google Test build.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/asiolink/io_address.h                 |    5 +++++
 src/lib/asiolink/tests/io_address_unittest.cc |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h
index 1b488fa..1a42da7 100644
--- a/src/lib/asiolink/io_address.h
+++ b/src/lib/asiolink/io_address.h
@@ -74,6 +74,11 @@ public:
     /// \return A string representation of the address.
     std::string toText() const;
 
+    /// \brief Convert the address to a C-style null-terminated string.
+    ///
+    /// \return A string representation of the address.
+    operator const char*() const { return toText().c_str(); }
+
     /// \brief Returns const reference to the underlying address object.
     ///
     /// This is useful, when access to interface offerted by
diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc
index 18b181e..b2a0dcc 100644
--- a/src/lib/asiolink/tests/io_address_unittest.cc
+++ b/src/lib/asiolink/tests/io_address_unittest.cc
@@ -18,11 +18,14 @@
 #include <asiolink/io_error.h>
 #include <asiolink/io_address.h>
 
+#include <cstring>
+
 using namespace isc::asiolink;
 
 TEST(IOAddressTest, fromText) {
     IOAddress io_address_v4("192.0.2.1");
     EXPECT_EQ("192.0.2.1", io_address_v4.toText());
+    EXPECT_EQ(0, strcmp("192.0.2.1", (const char *)io_address_v4));
 
     IOAddress io_address_v6("2001:db8::1234");
     EXPECT_EQ("2001:db8::1234", io_address_v6.toText());




More information about the bind10-changes mailing list