Finish phonebook command and add to install targets.

This commit is contained in:
2023-10-10 14:01:09 -07:00
parent 30c586d37d
commit e3c95964b3
10 changed files with 297 additions and 41 deletions

View File

@@ -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;