File tree 5 files changed +9
-8
lines changed
5 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ ARDUINO 1.5.6 BETA
16
16
* sam: Optimized delayMicroseconds() (Rob Tillaart) #1121
17
17
* Optimized Print::print(String&) method, now uses internal string buffer to perform block write
18
18
* Improved portability of String class (maniacbug) #695
19
+ * Make some operators in IPAddress const (Matthijs Kooijman)
19
20
20
21
ARDUINO 1.5.5-r2 BETA 2014.01.10
21
22
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ IPAddress& IPAddress::operator=(uint32_t address)
37
37
return *this ;
38
38
}
39
39
40
- bool IPAddress::operator ==(const uint8_t * addr)
40
+ bool IPAddress::operator ==(const uint8_t * addr) const
41
41
{
42
42
return memcmp (addr, _address, sizeof (_address)) == 0 ;
43
43
}
Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ class IPAddress : public Printable {
49
49
50
50
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
51
51
// to a four-byte uint8_t array is expected
52
- operator uint32_t () { return *((uint32_t *)_address); };
53
- bool operator ==(const IPAddress& addr) { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
54
- bool operator ==(const uint8_t * addr);
52
+ operator uint32_t () const { return *((uint32_t *)_address); };
53
+ bool operator ==(const IPAddress& addr) const { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
54
+ bool operator ==(const uint8_t * addr) const ;
55
55
56
56
// Overloaded index operator to allow getting and setting individual octets of the address
57
57
uint8_t operator [](int index) const { return _address[index ]; };
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ IPAddress& IPAddress::operator=(uint32_t address)
37
37
return *this ;
38
38
}
39
39
40
- bool IPAddress::operator ==(const uint8_t * addr)
40
+ bool IPAddress::operator ==(const uint8_t * addr) const
41
41
{
42
42
return memcmp (addr, _address, sizeof (_address)) == 0 ;
43
43
}
Original file line number Diff line number Diff line change @@ -48,9 +48,9 @@ class IPAddress : public Printable {
48
48
49
49
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
50
50
// to a four-byte uint8_t array is expected
51
- operator uint32_t () { return *((uint32_t *)_address); };
52
- bool operator ==(const IPAddress& addr) { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
53
- bool operator ==(const uint8_t * addr);
51
+ operator uint32_t () const { return *((uint32_t *)_address); };
52
+ bool operator ==(const IPAddress& addr) const { return (*((uint32_t *)_address)) == (*((uint32_t *)addr._address )); };
53
+ bool operator ==(const uint8_t * addr) const ;
54
54
55
55
// Overloaded index operator to allow getting and setting individual octets of the address
56
56
uint8_t operator [](int index) const { return _address[index ]; };
You can’t perform that action at this time.
0 commit comments