|
#ifndef __CATALOGITEM_H__
|
|
#define __CATALOGITEM_H__
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
|
|
class CatalogItem
|
|
{
|
|
public:
|
|
|
|
static inline const uint32_t VALUE_BUFFER_SIZE{1024};
|
|
|
|
CatalogItem(const std::string& key, const std::string& value);
|
|
|
|
~CatalogItem();
|
|
|
|
inline const std::string& getKey() const
|
|
{
|
|
return m_key;
|
|
}
|
|
|
|
inline const std::string& getLcKey() const
|
|
{
|
|
return m_keyLower;
|
|
}
|
|
|
|
inline const std::string& getValue() const
|
|
{
|
|
return m_value;
|
|
}
|
|
|
|
inline char* getValueBuffer()
|
|
{
|
|
return m_valueBuffer;
|
|
}
|
|
|
|
inline uint32_t getValueBufferSize() const
|
|
{
|
|
return VALUE_BUFFER_SIZE;
|
|
}
|
|
|
|
/**
|
|
* Should this CatalogItem be visible
|
|
* @return
|
|
*/
|
|
inline bool visible() const
|
|
{
|
|
return m_visible;
|
|
}
|
|
|
|
/**
|
|
* Set CatalogItem visibility based on parameter
|
|
* @param vis
|
|
*/
|
|
inline void setVisibilty(bool vis)
|
|
{
|
|
m_visible = vis;
|
|
}
|
|
|
|
|
|
/**
|
|
* Return true if the specified criteria matches the key
|
|
* @param criteria
|
|
* @return
|
|
*/
|
|
bool match(const std::string& criteria);
|
|
bool match(const std::string_view& criteria);
|
|
|
|
private:
|
|
|
|
std::string m_key;
|
|
std::string m_keyLower;
|
|
std::string m_value;
|
|
|
|
char m_valueBuffer[VALUE_BUFFER_SIZE];
|
|
|
|
bool m_visible;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif // __CATALOGITEM_H__
|