impl_(new HINFOImpl(lexer))
{}
+HINFO&
+HINFO::operator=(const HINFO& source)
+{
+ impl_.reset(new HINFOImpl(*source.impl_));
+ return (*this);
+}
+
HINFO::~HINFO() {
- delete impl_;
}
std::string
outputer.writeData(&impl_->os[0], impl_->os.size());
}
+void HINFO::ptr() const {
+ std::cout << "[XX] PTR: " << impl_.get() << std::endl;
+}
+
// END_RDATA_NAMESPACE
// END_ISC_NAMESPACE
#include <string>
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
#include <dns/name.h>
#include <dns/rdata.h>
#include <util/buffer.h>
// HINFO specific methods
~HINFO();
+ HINFO& operator=(const HINFO&);
+
const std::string getCPU() const;
const std::string getOS() const;
+ void ptr() const;
private:
/// Helper template function for toWire()
///
template <typename T>
void toWireHelper(T& outputer) const;
- HINFOImpl* impl_;
+ boost::scoped_ptr<HINFOImpl> impl_;
};
impl_(new NAPTRImpl(*naptr.impl_))
{}
+NAPTR&
+NAPTR::operator=(const NAPTR& source)
+{
+ impl_.reset(new NAPTRImpl(*source.impl_));
+ return (*this);
+}
+
NAPTR::~NAPTR() {
- delete impl_;
}
void
#include <string>
+#include <boost/scoped_ptr.hpp>
+
#include <dns/name.h>
#include <dns/rdata.h>
#include <util/buffer.h>
// NAPTR specific methods
~NAPTR();
+ NAPTR& operator=(const NAPTR& source);
+
uint16_t getOrder() const;
uint16_t getPreference() const;
const std::string getFlags() const;
template <typename T>
void toWireHelper(T& outputer) const;
- NAPTRImpl* impl_;
+ boost::scoped_ptr<NAPTRImpl> impl_;
};
// END_RDATA_NAMESPACE
EXPECT_EQ(-1, hinfo.compare(HINFO(hinfo_str_large2)));
}
+// Copy/assign test
+TEST_F(Rdata_HINFO_Test, copy) {
+ HINFO hinfo(hinfo_str);
+ HINFO hinfo2(hinfo);
+ HINFO hinfo3 = hinfo;
+
+ EXPECT_EQ(0, hinfo.compare(hinfo2));
+ EXPECT_EQ(0, hinfo.compare(hinfo3));
+
+ hinfo3 = hinfo;
+ EXPECT_EQ(0, hinfo.compare(hinfo3));
+}
+
}
EXPECT_EQ(1, naptr_large3.compare(naptr));
EXPECT_EQ(1, naptr_large4.compare(naptr));
EXPECT_EQ(1, naptr_large5.compare(naptr));
+}
+
+TEST_F(Rdata_NAPTR_Test, copy) {
+ NAPTR naptr(naptr_str);
+ NAPTR naptr2(naptr);
+ NAPTR naptr3 = naptr;
+
+ EXPECT_EQ(0, naptr.compare(naptr2));
+ EXPECT_EQ(0, naptr.compare(naptr3));
+ naptr3 = naptr;
+ EXPECT_EQ(0, naptr.compare(naptr3));
}
}