astyle
This commit is contained in:
parent
fd1e397a3e
commit
2997644d22
@ -39,28 +39,63 @@ struct EERef{
|
||||
: index(index) {}
|
||||
|
||||
//Access/read members.
|
||||
uint8_t operator*() const { return eeprom_[index]; }
|
||||
operator uint8_t() const { return **this; }
|
||||
uint8_t operator*() const {
|
||||
return eeprom_[index];
|
||||
}
|
||||
operator uint8_t() const {
|
||||
return **this;
|
||||
}
|
||||
|
||||
//Assignment/write members.
|
||||
EERef &operator=( const EERef &ref ) { return *this = *ref; }
|
||||
EERef &operator=( uint8_t in ) { eeprom_[index] = in; return *this; }
|
||||
EERef &operator +=( uint8_t in ) { return *this = **this + in; }
|
||||
EERef &operator -=( uint8_t in ) { return *this = **this - in; }
|
||||
EERef &operator *=( uint8_t in ) { return *this = **this * in; }
|
||||
EERef &operator /=( uint8_t in ) { return *this = **this / in; }
|
||||
EERef &operator ^=( uint8_t in ) { return *this = **this ^ in; }
|
||||
EERef &operator %=( uint8_t in ) { return *this = **this % in; }
|
||||
EERef &operator &=( uint8_t in ) { return *this = **this & in; }
|
||||
EERef &operator |=( uint8_t in ) { return *this = **this | in; }
|
||||
EERef &operator <<=( uint8_t in ) { return *this = **this << in; }
|
||||
EERef &operator >>=( uint8_t in ) { return *this = **this >> in; }
|
||||
EERef &operator=(const EERef &ref) {
|
||||
return *this = *ref;
|
||||
}
|
||||
EERef &operator=(uint8_t in) {
|
||||
eeprom_[index] = in;
|
||||
return *this;
|
||||
}
|
||||
EERef &operator +=(uint8_t in) {
|
||||
return *this = **this + in;
|
||||
}
|
||||
EERef &operator -=(uint8_t in) {
|
||||
return *this = **this - in;
|
||||
}
|
||||
EERef &operator *=(uint8_t in) {
|
||||
return *this = **this * in;
|
||||
}
|
||||
EERef &operator /=(uint8_t in) {
|
||||
return *this = **this / in;
|
||||
}
|
||||
EERef &operator ^=(uint8_t in) {
|
||||
return *this = **this ^ in;
|
||||
}
|
||||
EERef &operator %=(uint8_t in) {
|
||||
return *this = **this % in;
|
||||
}
|
||||
EERef &operator &=(uint8_t in) {
|
||||
return *this = **this & in;
|
||||
}
|
||||
EERef &operator |=(uint8_t in) {
|
||||
return *this = **this | in;
|
||||
}
|
||||
EERef &operator <<=(uint8_t in) {
|
||||
return *this = **this << in;
|
||||
}
|
||||
EERef &operator >>=(uint8_t in) {
|
||||
return *this = **this >> in;
|
||||
}
|
||||
|
||||
EERef &update( uint8_t in ) { return in != *this ? *this = in : *this; }
|
||||
EERef &update(uint8_t in) {
|
||||
return in != *this ? *this = in : *this;
|
||||
}
|
||||
|
||||
/** Prefix increment/decrement **/
|
||||
EERef& operator++() { return *this += 1; }
|
||||
EERef& operator--() { return *this -= 1; }
|
||||
EERef& operator++() {
|
||||
return *this += 1;
|
||||
}
|
||||
EERef& operator--() {
|
||||
return *this -= 1;
|
||||
}
|
||||
|
||||
/** Postfix increment/decrement **/
|
||||
uint8_t operator++ (int) {
|
||||
@ -134,14 +169,26 @@ struct EEPtr {
|
||||
struct EEPROMClass {
|
||||
|
||||
//Basic user access methods.
|
||||
EERef operator[]( const int idx ) { return idx; }
|
||||
uint8_t read( int idx ) { return EERef( idx ); }
|
||||
void write( int idx, uint8_t val ) { (EERef( idx )) = val; }
|
||||
void update( int idx, uint8_t val ) { EERef( idx ).update( val ); }
|
||||
EERef operator[](const int idx) {
|
||||
return idx;
|
||||
}
|
||||
uint8_t read(int idx) {
|
||||
return EERef(idx);
|
||||
}
|
||||
void write(int idx, uint8_t val) {
|
||||
(EERef(idx)) = val;
|
||||
}
|
||||
void update(int idx, uint8_t val) {
|
||||
EERef(idx).update(val);
|
||||
}
|
||||
|
||||
//STL and C++11 iteration capability.
|
||||
EEPtr begin() { return 0x00; }
|
||||
EEPtr end() { return length(); } //Standards requires this to be the item after the last valid entry. The returned pointer is invalid.
|
||||
EEPtr begin() {
|
||||
return 0x00;
|
||||
}
|
||||
EEPtr end() {
|
||||
return length(); //Standards requires this to be the item after the last valid entry. The returned pointer is invalid.
|
||||
}
|
||||
uint16_t length();
|
||||
|
||||
//Functionality to 'get' and 'put' objects to and from EEPROM.
|
||||
|
Loading…
x
Reference in New Issue
Block a user