[svn] commit: r80 - in /experiments/jinmei-messageapi: dnsmessage.hh dnsname.hh dnsresult.hh iobuffer.hh rrset.hh
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Oct 9 22:14:45 UTC 2009
Author: jinmei
Date: Fri Oct 9 22:14:45 2009
New Revision: 80
Log:
avoid 'using namespace' in .hh
Modified:
experiments/jinmei-messageapi/dnsmessage.hh
experiments/jinmei-messageapi/dnsname.hh
experiments/jinmei-messageapi/dnsresult.hh
experiments/jinmei-messageapi/iobuffer.hh
experiments/jinmei-messageapi/rrset.hh
Modified: experiments/jinmei-messageapi/dnsmessage.hh
==============================================================================
--- experiments/jinmei-messageapi/dnsmessage.hh (original)
+++ experiments/jinmei-messageapi/dnsmessage.hh Fri Oct 9 22:14:45 2009
@@ -28,8 +28,6 @@
#include "iobuffer.hh"
#include "dnsname.hh"
#include "rrset.hh"
-
-using namespace std;
namespace ISC {
namespace DNS {
@@ -85,7 +83,7 @@
void set_rcode(rcode_t rcode) { _rcode = rcode; }
opcode_t get_opcode() const { return (_opcode); }
void set_opcode(opcode_t opcode) { _opcode = opcode; }
- string to_text() const;
+ std::string to_text() const;
// we don't provide accessors to QD/AN/NS/AR counters as this information
// is included in the corresponding RRsets.
@@ -94,7 +92,7 @@
// - may want to provide an "iterator" for all RRsets/RRs
// - may want to provide a "find" method for a specified type
// of RR in the message
- const vector<RRSetPtr>& get_section(section_t section) const
+ const std::vector<RRSetPtr>& get_section(section_t section) const
{ return (_sections[section]); }
void add_rrset(section_t section, RRSetPtr rrset);
// set_question() is redundant in that it's a special case of add_rrset,
@@ -181,7 +179,7 @@
int _counts[SECTION_MAX]; // TODO: revisit this definition
// TODO: revisit the type of vector items
- vector<RRSetPtr> _sections[SECTION_MAX];
+ std::vector<RRSetPtr> _sections[SECTION_MAX];
// tsig/sig0: TODO
EDNS* _edns;
Modified: experiments/jinmei-messageapi/dnsname.hh
==============================================================================
--- experiments/jinmei-messageapi/dnsname.hh (original)
+++ experiments/jinmei-messageapi/dnsname.hh Fri Oct 9 22:14:45 2009
@@ -24,8 +24,6 @@
#include "dnsexceptions.hh"
#include "dnsresult.hh"
#include "iobuffer.hh"
-
-using namespace std;
namespace ISC {
namespace DNS {
@@ -57,7 +55,7 @@
public:
// constructors
Name();
- explicit Name(const string &namestr);
+ explicit Name(const std::string &namestr);
// need a ctor for "from-wire"? how can we differentiate it with
// "from-string" (above)?
@@ -68,7 +66,7 @@
//~Name();
// public methods
- string to_text(bool omit_final_dot) const;
+ std::string to_text(bool omit_final_dot) const;
void to_wire(IOBuffer& r, NameCompressor& c) const;
const ISC::Result* from_wire(NameDecompressor& c, IOBuffer& iobuf);
size_t get_length() const { return (_length); }
@@ -90,17 +88,17 @@
static const unsigned int NAME_MAXWIRE = 255;
private:
- string _ndata; // or vector<unsigned char>?
- vector<char> _offsets;
+ std::string _ndata; // or vector<unsigned char>?
+ std::vector<char> _offsets;
unsigned int _length;
unsigned int _labels;
bool _is_absolute;
- void from_string(const string &namestr);
+ void from_string(const std::string &namestr);
};
}
}
-ostream &operator<<(ostream &os, const ISC::DNS::Name &name);
+std::ostream &operator<<(std::ostream &os, const ISC::DNS::Name &name);
#endif // __DNSNAME_HH
Modified: experiments/jinmei-messageapi/dnsresult.hh
==============================================================================
--- experiments/jinmei-messageapi/dnsresult.hh (original)
+++ experiments/jinmei-messageapi/dnsresult.hh Fri Oct 9 22:14:45 2009
@@ -19,19 +19,17 @@
#include <string>
-using namespace std;
-
namespace ISC {
class Result { // generic result class. should be defined somewhere else.
public:
virtual ~Result() {}
- Result(const string resultmsg) : _resultmsg(resultmsg) {}
- virtual string to_text() const { return (_resultmsg); }
+ Result(const std::string resultmsg) : _resultmsg(resultmsg) {}
+ virtual std::string to_text() const { return (_resultmsg); }
public:
static const Result* Success;
static const Result* Unexpected;
protected:
- const string _resultmsg;
+ const std::string _resultmsg;
};
typedef ISC::Result const* ConstResult;
@@ -41,7 +39,7 @@
namespace DNS {
class Result : public ISC::Result {
public:
- Result(string resultmsg) : ISC::Result(resultmsg) {}
+ Result(std::string resultmsg) : ISC::Result(resultmsg) {}
public:
static const Result *MessageTooShort;
static const Result *BadLabelType;
Modified: experiments/jinmei-messageapi/iobuffer.hh
==============================================================================
--- experiments/jinmei-messageapi/iobuffer.hh (original)
+++ experiments/jinmei-messageapi/iobuffer.hh Fri Oct 9 22:14:45 2009
@@ -30,8 +30,6 @@
#include <vector>
#include "iscexceptions.hh"
-
-using namespace std;
namespace ISC {
// Abstraction of buffers for socket I/O. This is a tentative idea and should
@@ -107,7 +105,7 @@
private:
size_t _readpos;
- vector<uint8_t> _buf;
+ std::vector<uint8_t> _buf;
};
inline uint8_t
Modified: experiments/jinmei-messageapi/rrset.hh
==============================================================================
--- experiments/jinmei-messageapi/rrset.hh (original)
+++ experiments/jinmei-messageapi/rrset.hh Fri Oct 9 22:14:45 2009
@@ -30,8 +30,6 @@
#include "dnsname.hh"
-using namespace std;
-
namespace ISC {
namespace DNS {
// if we worry about data copy, we may have to use
@@ -56,8 +54,8 @@
RRClass() {}
explicit RRClass(uint16_t classval) :
_classval(classval) {}
- explicit RRClass(const string& classstr);
- const string to_text() const;
+ explicit RRClass(const std::string& classstr);
+ const std::string to_text() const;
void to_wire(IOBuffer& b) const;
uint16_t get_value() const { return (_classval); }
bool operator==(const RRClass& other) const
@@ -77,8 +75,8 @@
RRType() {}
explicit RRType(uint16_t typeval) :
_typeval(typeval) {}
- explicit RRType(const string& typestr);
- const string to_text() const;
+ explicit RRType(const std::string& typestr);
+ const std::string to_text() const;
void to_wire(IOBuffer& b) const;
uint16_t get_value() const { return (_typeval); }
bool operator==(const RRType& other) const
@@ -103,8 +101,8 @@
// of type TTL (e.g., make_rrset(..., 3600), so don't
// make the constructor explicit here.
TTL(uint32_t ttlval) : _ttlval(ttlval) {}
- string to_text() const
- { return (boost::lexical_cast<string>(_ttlval)); }
+ std::string to_text() const
+ { return (boost::lexical_cast<std::string>(_ttlval)); }
void to_wire(IOBuffer& b) const;
uint32_t get_value() { return (_ttlval); }
bool operator==(const TTL& other) const
@@ -126,7 +124,7 @@
virtual ~Rdata() {};
virtual unsigned int count() const = 0;
virtual const RRType& get_type() const = 0;
- virtual string to_text() const = 0;
+ virtual std::string to_text() const = 0;
virtual void from_wire(IOBuffer& b, NameDecompressor& c) = 0;
virtual void to_wire(IOBuffer& b, NameCompressor& c) const = 0;
// need generic method for getting n-th field? c.f. ldns
@@ -140,7 +138,7 @@
WireRdata() {}
explicit WireRdata(const RRClass& rdclass,
const RRType& rdtype,
- const string& wireData) :
+ const std::string& wireData) :
_rdclass(rdclass), _rdtype(rdtype),
_wireData(wireData) {}
// disallow to/from_wire() for this class by not defining
@@ -149,7 +147,7 @@
private:
RRClass _rdclass;
RRType _rdtype;
- string _wireData;
+ std::string _wireData;
};
// Standard DNS Rdata Subclasses
@@ -157,11 +155,11 @@
public:
ARdata() {}
// constructor from a textual IPv4 address
- explicit ARdata(const string& addrstr);
+ explicit ARdata(const std::string& addrstr);
unsigned int count() const { return (1); }
const RRType& get_type() const { return (RRType::A); }
static const RRType& get_type_static() { return (RRType::A); }
- string to_text() const;
+ std::string to_text() const;
void from_wire(IOBuffer& b, NameDecompressor& c);
void to_wire(IOBuffer& b, NameCompressor& c) const;
const struct in_addr& getAddress() const
@@ -178,15 +176,15 @@
class NSRdata : public Rdata {
public:
NSRdata() {}
- explicit NSRdata(const string& namestr) : _nsname(namestr) {}
+ explicit NSRdata(const std::string& namestr) : _nsname(namestr) {}
explicit NSRdata(const Name& nsname) : _nsname(nsname) {}
unsigned int count() const { return (1); }
const RRType& get_type() const { return (RRType::NS); }
static const RRType& get_type_static() { return (RRType::NS); }
- string to_text() const;
+ std::string to_text() const;
void from_wire(IOBuffer& b, NameDecompressor& c);
void to_wire(IOBuffer& b, NameCompressor& c) const;
- const string get_nsname() const { return (_nsname.to_text(false)); }
+ const std::string get_nsname() const { return (_nsname.to_text(false)); }
bool operator==(const NSRdata &other) const
{ return (_nsname == other._nsname); }
virtual bool operator!=(const NSRdata &other) const
@@ -199,9 +197,9 @@
public:
AAAARdata() {}
// constructor from a textual IPv6 address
- AAAARdata(const string& addrstr);
+ AAAARdata(const std::string& addrstr);
unsigned int count() const { return (1); }
- string to_text() const;
+ std::string to_text() const;
const RRType& get_type() const { return (RRType::AAAA); }
static const RRType& get_type_static()
{ return (RRType::AAAA); }
@@ -242,8 +240,8 @@
_rdclass(rdclass), _rdtype(rdtype), _ttl(ttl) {}
void add_rdata(rdataptr_t rdata);
void remove_rdata(const Rdata& rdata);
- string to_text() const;
- string to_wire() const;
+ std::string to_text() const;
+ std::string to_wire() const;
unsigned int count_rdata() const { return (_rdatalist.size()); }
const RRClass& get_class() const { return (_rdclass); }
const RRType& get_type() const { return (_rdtype); }
@@ -252,7 +250,7 @@
RRClass _rdclass;
RRType _rdtype;
TTL _ttl;
- vector<rdataptr_t> _rdatalist;
+ std::vector<rdataptr_t> _rdatalist;
};
// An RRSet. Conceptually it's a named RdataSet. A (section
@@ -260,7 +258,7 @@
class AbstractRRSet {
public:
virtual ~AbstractRRSet() {}
- virtual string to_text() const = 0;
+ virtual std::string to_text() const = 0;
virtual int to_wire(Message& message, section_t section) = 0;
virtual unsigned int count_rdata() const = 0;
virtual const Name& get_name() const = 0;
@@ -279,19 +277,19 @@
unsigned int count_rdata() const { return (_rdatalist.size()); }
void add_rdata(rdataptr_t rdata);
void remove_rdata(const Rdata& rdata);
- string to_text() const;
+ std::string to_text() const;
int to_wire(Message& message, section_t section);
const Name& get_name() const { return (_name); }
const RRClass& get_class() const { return (_rdclass); }
const RRType& get_type() const { return (_rdtype); }
const TTL& get_ttl() const { return (_ttl); }
- template <typename T> void get_rdatalist(vector<T>&) const;
+ template <typename T> void get_rdatalist(std::vector<T>&) const;
private:
Name _name;
RRClass _rdclass;
RRType _rdtype;
TTL _ttl;
- vector<rdataptr_t> _rdatalist;
+ std::vector<rdataptr_t> _rdatalist;
};
class Question : public AbstractRRSet { // generic Question section entry
@@ -299,7 +297,7 @@
explicit Question(const Name& name, const RRClass& rdclass,
const RRType& rdtype) :
_name(name), _rdclass(rdclass), _rdtype(rdtype) {}
- string to_text() const;
+ std::string to_text() const;
int to_wire(Message& message, section_t section);
unsigned int count_rdata() const { return (0); }
const Name& get_name() const { return (_name); }
@@ -315,9 +313,9 @@
// TBD: this interface should be revisited.
template <typename T>
void
-RRSet::get_rdatalist(vector<T>& v) const
+RRSet::get_rdatalist(std::vector<T>& v) const
{
- vector<rdataptr_t>::const_iterator it;
+ std::vector<rdataptr_t>::const_iterator it;
for (it = _rdatalist.begin(); it != _rdatalist.end(); ++it) {
const T& concreteRdata = static_cast<const T&>(**it); // XXX
if (T::get_type_static() != (**it).get_type()) {
@@ -335,11 +333,11 @@
class RR {
public:
RR() {}
- explicit RR(const string& rrstr);
+ explicit RR(const std::string& rrstr);
explicit RR(const Name &name, const RRClass &rdclass,
const RRType &rdtype, const TTL &ttl,
const Rdata &rdata);
- string to_text() const
+ std::string to_text() const
{ return (_rrset.to_text()); }
const Name& get_name() const
{ return (_rrset.get_name()); }
More information about the bind10-changes
mailing list