Project

General

Profile

Download (1.39 KB) Statistics
| Branch: | Revision:
5fa4a398 david.sorber
#ifndef __CATALOGITEM_H__
#define __CATALOGITEM_H__

#include <cstdint>
#include <string>
8a16b7a0 david.sorber
#include <string_view>
5fa4a398 david.sorber

class CatalogItem
{
public:

0a32fd63 david.sorber
static inline const uint32_t VALUE_BUFFER_SIZE{1024};

5fa4a398 david.sorber
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;
}

0a32fd63 david.sorber
inline char* getValueBuffer()
{
return m_valueBuffer;
}

inline uint32_t getValueBufferSize() const
{
return VALUE_BUFFER_SIZE;
}

5fa4a398 david.sorber
/**
* 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);
8a16b7a0 david.sorber
bool match(const std::string_view& criteria);
5fa4a398 david.sorber
private:

std::string m_key;
std::string m_keyLower;
std::string m_value;

0a32fd63 david.sorber
char m_valueBuffer[VALUE_BUFFER_SIZE];

5fa4a398 david.sorber
bool m_visible;

0a32fd63 david.sorber

5fa4a398 david.sorber
};


#endif // __CATALOGITEM_H__