Finish phonebook command and add to install targets.
This commit is contained in:
@@ -64,7 +64,7 @@ Dictionary::Set(const char *key, uint8_t klen, const char *val, uint8_t vlen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// seek searches the Dictionary for the key.
|
||||
uint8_t *
|
||||
Dictionary::seek(const char *key, uint8_t klen)
|
||||
{
|
||||
@@ -94,6 +94,21 @@ Dictionary::Contains(const char *key, uint8_t klen)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Dictionary::Delete(const char *key, uint8_t klen)
|
||||
{
|
||||
auto *cursor = this->seek(key, klen);
|
||||
|
||||
if (cursor == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TLV::DeleteRecord(this->arena, cursor);
|
||||
TLV::DeleteRecord(this->arena, cursor);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Dictionary::spaceAvailable(uint8_t klen, uint8_t vlen)
|
||||
{
|
||||
@@ -123,7 +138,6 @@ operator<<(std::ostream &os, const Dictionary &dictionary)
|
||||
TLV::Record rec;
|
||||
|
||||
TLV::ReadFromMemory(rec, cursor);
|
||||
os << "Dictionary KV pairs" << std::endl;
|
||||
if (rec.Tag == TLV::TAG_EMPTY) {
|
||||
os << "\t(NONE)" << std::endl;
|
||||
return os;
|
||||
|
||||
Reference in New Issue
Block a user