Package org.eclipse.cdt.core
Interface IAddress
- All Superinterfaces:
Comparable<Object>
Represents C/C++ address in CDT. All implementors of this interface should be
immutable, i.e. all methods should not modify objects, they should return
new object.
Please see Addr32 and Addr64 classes to see how this interface should
be extended
-
Method Summary
Modifier and TypeMethodDescriptionadd
(long offset) Adds offset to address and returns new address object which is the result
Note: This method has an offset limit of Long.MAX and Long.MIN, which under some addressing schemes may impose an unnecessary limitation, seeIAddress.add(BigInteger offset)
to handle larger offsets.add
(BigInteger offset) Adds offset to address and returns new address object which is the resultdistanceTo
(IAddress other) Returns distance to address.boolean
Returns whether this address equals the given object.int
Returns amount of symbols in hex representation.Returns maximal offset possible for address.int
getSize()
Returns the address size in bytes.getValue()
Returns the value of the address.boolean
isMax()
Return true if address is maximal, i.e.boolean
isZero()
Return true if address is zero, i.e.Converts address to the binary representation with '0b' prefix and with all leading zeros.Converts address to the hex representation with '0x' prefix and with all leading zeros.toString()
Identical to toString(10)toString
(int radix) Converts address to string as an unsigned number with given radixMethods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
add
Adds offset to address and returns new address object which is the result- Parameters:
offset
- to add- Returns:
- the new address
-
add
Adds offset to address and returns new address object which is the result
Note: This method has an offset limit of Long.MAX and Long.MIN, which under some addressing schemes may impose an unnecessary limitation, seeIAddress.add(BigInteger offset)
to handle larger offsets.- Parameters:
offset
- to add- Returns:
- the new address
-
getMaxOffset
BigInteger getMaxOffset()Returns maximal offset possible for address. The offset should be identical for all addresses of given class.- Returns:
- the max offset for this address class
-
distanceTo
Returns distance to address. Distance may be positive or negative- Parameters:
other
- address which distance is calculated to.- Returns:
- distance to address
-
getValue
BigInteger getValue()Returns the value of the address. -
equals
Returns whether this address equals the given object. -
isZero
boolean isZero()Return true if address is zero, i.e. minimal possible- Returns:
- true is address is zero
-
isMax
boolean isMax()Return true if address is maximal, i.e. maximal possible- Returns:
- true if address is maximal
-
toString
Converts address to string as an unsigned number with given radix- Parameters:
radix
- to use for string conversion- Returns:
- a string representation of address
-
toString
String toString()Identical to toString(10) -
toHexAddressString
String toHexAddressString()Converts address to the hex representation with '0x' prefix and with all leading zeros. The length of returned string should be the same for all addresses of given class. I.e. 10 for 32-bit addresses and 18 for 64-bit addresses -
toBinaryAddressString
String toBinaryAddressString()Converts address to the binary representation with '0b' prefix and with all leading zeros. The length of returned string should be the same for all addresses of given class. I.e. 34 for 32-bit addresses and 66 for 64-bit addresses -
getCharsNum
int getCharsNum()Returns amount of symbols in hex representation. Is identical to toHexAddressString().length(). It is present for performance purpose.- Returns:
- the number of character symbols to represent this address in hex.
-
getSize
int getSize()Returns the address size in bytes.- Returns:
- the number of bytes required to hold this address.
-