txt_16.cc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <stdint.h>
  15. #include <string.h>
  16. #include <string>
  17. #include <vector>
  18. #include <util/buffer.h>
  19. #include <dns/exceptions.h>
  20. #include <dns/messagerenderer.h>
  21. #include <dns/rdata.h>
  22. #include <dns/rdataclass.h>
  23. #include <dns/rdata/generic/detail/txt_like.h>
  24. using namespace std;
  25. using namespace isc::util;
  26. // BEGIN_ISC_NAMESPACE
  27. // BEGIN_RDATA_NAMESPACE
  28. TXT&
  29. TXT::operator=(const TXT& source) {
  30. if (impl_ == source.impl_) {
  31. return (*this);
  32. }
  33. TXTImpl* newimpl = new TXTImpl(*source.impl_);
  34. delete impl_;
  35. impl_ = newimpl;
  36. return (*this);
  37. }
  38. TXT::~TXT() {
  39. delete impl_;
  40. }
  41. TXT::TXT(InputBuffer& buffer, size_t rdata_len) :
  42. impl_(new TXTImpl(buffer, rdata_len))
  43. {}
  44. TXT::TXT(MasterLexer& lexer, const Name* origin,
  45. MasterLoader::Options options, MasterLoaderCallbacks& callbacks) :
  46. impl_(new TXTImpl(lexer, origin, options, callbacks))
  47. {}
  48. TXT::TXT(const std::string& txtstr) :
  49. impl_(new TXTImpl(txtstr))
  50. {}
  51. TXT::TXT(const TXT& other) :
  52. Rdata(), impl_(new TXTImpl(*other.impl_))
  53. {}
  54. void
  55. TXT::toWire(OutputBuffer& buffer) const {
  56. impl_->toWire(buffer);
  57. }
  58. void
  59. TXT::toWire(AbstractMessageRenderer& renderer) const {
  60. impl_->toWire(renderer);
  61. }
  62. string
  63. TXT::toText() const {
  64. return (impl_->toText());
  65. }
  66. int
  67. TXT::compare(const Rdata& other) const {
  68. const TXT& other_txt = dynamic_cast<const TXT&>(other);
  69. return (impl_->compare(*other_txt.impl_));
  70. }
  71. // END_RDATA_NAMESPACE
  72. // END_ISC_NAMESPACE