pgLab/pglablib/PgKeywordList.h
eelke 97d4e2a1a4 Created IndexModel for displaying the indexes on a table. Constraints can now show the SQL to drop and create them.
The keyword list is now directly based of the official keyword list from postgresql.
2018-01-06 21:22:22 +01:00

51 lines
942 B
C++

#ifndef PGKEYWORDLIST_H
#define PGKEYWORDLIST_H
#include <QString>
#include <unordered_set>
#include <functional>
#include "util.h"
#define UNRESERVED_KEYWORD 0
#define COL_NAME_KEYWORD 1
#define TYPE_FUNC_NAME_KEYWORD 2
#define RESERVED_KEYWORD 3
using t_SymbolSet = std::unordered_set<QString>;
class Keyword {
public:
Keyword(QString kw, int16_t cat)
: m_keyword(kw), m_category(cat)
{}
const QString& getKeyword() const { return m_keyword; }
int16_t getCategory() const { return m_category; }
//bool operator<(const QString &s) const { return m_keyword < s; }
bool operator<(const Keyword &kw) const { return m_keyword < kw.m_keyword; }
private:
QString m_keyword;
int16_t m_category;
};
namespace std {
template <>
struct hash<Keyword>
{
std::size_t operator()(const Keyword& s) const
{
return qHash(s.getKeyword());
}
};
}
const Keyword* getPgsqlKeyword(QString s);
#endif // PGKEYWORDLIST_H