1:
2:
3: /*********************
4: * *
5: * PROJECT INCLUDES *
6: * *
7: *********************/
8:
9:
10: #include "dnsutil.h"
11: #include "wwwi/string.h"
12:
13:
14: using WWWI::MemCaseCmp;
15: using std::memcpy;
16:
17:
18: /***************
19: * *
20: * OPERATOR < *
21: * *
22: ***************/
23:
24:
25: inline bool Label::operator<(const Label &ci_lbr) const {
26: if (m_usLength<ci_lbr.m_usLength) return true;
27: if (m_usLength>ci_lbr.m_usLength) return false;
28: if (MemCaseCmp(m_str, ci_lbr.m_str, m_usLength)<0) return true;
29: return false;
30: }
31:
32:
33: /***************
34: * *
35: * OPERATOR = *
36: * *
37: ***************/
38:
39:
40: inline Label &Label::operator=(const Label &ci_lbr) {
41: this->Set(ci_lbr.m_usLength,ci_lbr.m_str);
42: return *this;
43: }
44:
45:
46: /****************
47: * *
48: * OPERATOR == *
49: * *
50: ****************/
51:
52:
53: inline bool Label::operator==(const Label &ci_lbr) const {
54: if (m_usLength != ci_lbr.m_usLength) return false;
55: if (MemCaseCmp(m_str, ci_lbr.m_str, m_usLength)!=0) return false;
56: return true;
57: }
58:
59:
60: /****************
61: * *
62: * OPERATOR != *
63: * *
64: ****************/
65:
66:
67: inline bool Label::operator!=(const Label &ci_lbr) const {
68: return (this->operator==(ci_lbr)==false);
69: }
70:
71:
72: /****************
73: * *
74: * GET METHODS *
75: * *
76: ****************/
77:
78:
79: inline unsigned short Label::GetLength() const { return m_usLength; }
80: inline const char *Label::GetString() const { return m_str; }
81:
82:
83: /***************
84: * *
85: * SET METHOD *
86: * *
87: ***************/
88:
89:
90: inline void Label::Set(unsigned short i_usLength, const char *ci_str) {
91: assert(i_usLength<64);
92: SoftDeleteArray(m_str);
93: m_usLength = i_usLength;
94: m_str = new char[i_usLength+1];
95: memcpy(m_str,ci_str,i_usLength);
96: m_str[i_usLength] = 0;
97: }
98:
99:
100: /****************
101: * *
102: * OPERATOR << *
103: * *
104: ****************/
105:
106:
107: template <class SM> SM& operator<<(SM &io_smr, const Label &ci_lbr) {
108: io_smr << &ci_lbr;
109: return io_smr;
110: }
111:
112:
113: template <class SM> SM& operator<<(SM &io_smr, const Label *ci_lbp) {
114: io_smr << ci_lbp->GetString();
115: return io_smr;
116: }
117:
118:
119: