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