I have been using MACAddress with a 3rd party API today. This API loves to feed/recieve addresses in ASCII : / so I made some changes to the class that other people may be interested in.
in juce_MACAddress.cpp
MACAddress::MACAddress (const StringRef addressStr)
{
MemoryBlock hexRepresentation;
hexRepresentation.loadFromHexString(addressStr);
memcpy (address, hexRepresentation.getData(), sizeof (address));
}
...
String MACAddress::toString (const StringRef separator) const
{
String s;
for (size_t i = 0; i < sizeof (address); ++i)
{
s << String::toHexString ((int) address[i]).paddedLeft ('0', 2);
if (i < sizeof (address) - 1)
s << separator;
}
return s;
}
in juce_MACAddress.h
/** Creates an address from a string representation. */
MACAddress (const StringRef address);
...
/** Returns a in the form "11-22-33-44-55-66" (dashes are the default separator) */
String toString (const StringRef separator = "-") const;
I hope it's up to snuff/useful.
