root/src/CatalogItem.cc @ c393c256
| 0a32fd63 | david.sorber | #include <cstring>
|
||
| 5fa4a398 | david.sorber | #include "CatalogItem.h"
|
||
| c393c256 | david.sorber | // Initialize static member
|
||
int CatalogItem::NEXT_ID(-1);
|
||||
| 5fa4a398 | david.sorber | CatalogItem::CatalogItem(const std::string& key, const std::string& value)
|
||
| c393c256 | david.sorber | : m_id(NEXT_ID++),
|
||
m_key(key),
|
||||
| 5fa4a398 | david.sorber | m_keyLower(key),
|
||
m_value(value),
|
||||
m_visible(true)
|
||||
{
|
||||
// Create lowercase version of the key's value
|
||||
for (uint32_t idx = 0; idx < m_keyLower.size(); ++idx)
|
||||
{
|
||||
if ((m_keyLower.at(idx) >= 'A') && (m_keyLower.at(idx) <= 'Z'))
|
||||
{
|
||||
m_keyLower.at(idx) = (m_keyLower.at(idx) | 32);
|
||||
}
|
||||
}
|
||||
| 0a32fd63 | david.sorber | |||
// Zero out value buffer and then copy the value into the buffer
|
||||
std::memset(m_valueBuffer, 0, VALUE_BUFFER_SIZE);
|
||||
std::memcpy(m_valueBuffer, m_value.data(), m_value.size());
|
||||
| 5fa4a398 | david.sorber | }
|
||
CatalogItem::~CatalogItem()
|
||||
{
|
||||
}
|
||||
bool CatalogItem::match(const std::string& criteria)
|
||||
| 8a16b7a0 | david.sorber | {
|
||
return m_keyLower.find(criteria) != std::string::npos;
|
||||
}
|
||||
bool CatalogItem::match(const std::string_view& criteria)
|
||||
| 5fa4a398 | david.sorber | {
|
||
return m_keyLower.find(criteria) != std::string::npos;
|
||||
}
|