Include VS solution
And refactor code: tab, code style. and end of lines. Update the libcpuid lib.
This commit is contained in:
parent
98c151b190
commit
86f0d9d944
106 changed files with 12665 additions and 6894 deletions
|
@ -31,53 +31,50 @@
|
|||
class JobId
|
||||
{
|
||||
public:
|
||||
inline JobId()
|
||||
{
|
||||
memset(m_data, 0, sizeof(m_data));
|
||||
}
|
||||
inline JobId()
|
||||
{
|
||||
}
|
||||
|
||||
inline JobId(const std::string & id, size_t sizeFix = 0)
|
||||
{
|
||||
setId(id, sizeFix);
|
||||
}
|
||||
|
||||
inline JobId(const char *id, size_t sizeFix = 0)
|
||||
{
|
||||
setId(id, sizeFix);
|
||||
}
|
||||
inline bool operator==(const JobId & other) const
|
||||
{
|
||||
return m_data == other.m_data;
|
||||
}
|
||||
|
||||
inline bool operator!=(const JobId & other) const
|
||||
{
|
||||
return !operator!=(other);
|
||||
}
|
||||
|
||||
inline bool operator==(const JobId &other) const
|
||||
{
|
||||
return memcmp(m_data, other.m_data, sizeof(m_data)) == 0;
|
||||
}
|
||||
inline bool setId(const std::string & id, size_t sizeFix = 0)
|
||||
{
|
||||
m_data.clear();
|
||||
|
||||
if(id.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool operator!=(const JobId &other) const
|
||||
{
|
||||
return memcmp(m_data, other.m_data, sizeof(m_data)) != 0;
|
||||
}
|
||||
|
||||
|
||||
inline bool setId(const char *id, size_t sizeFix = 0)
|
||||
{
|
||||
memset(m_data, 0, sizeof(m_data));
|
||||
if (!id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t size = strlen(id);
|
||||
if (size >= sizeof(m_data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(m_data, id, size - sizeFix);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline const char *data() const { return m_data; }
|
||||
inline bool isValid() const { return *m_data != '\0'; }
|
||||
const size_t size = id.size();
|
||||
m_data = id.substr(0, size - sizeFix);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline const std::string & data() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
inline bool isValid() const
|
||||
{
|
||||
return 0 < m_data.size() && m_data[0] != '\0';
|
||||
}
|
||||
|
||||
private:
|
||||
char m_data[64];
|
||||
std::string m_data;
|
||||
};
|
||||
|
||||
#endif /* __JOBID_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue