forked from qt-creator/qt-creator
de-virtualize ProItem::kind(); use variable instead
now items have no vtable any more
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
ProBlock::ProBlock()
|
||||
: ProItem(BlockKind)
|
||||
{
|
||||
m_blockKind = 0;
|
||||
m_refCount = 1;
|
||||
@@ -48,32 +49,6 @@ ProBlock::~ProBlock()
|
||||
delete itm;
|
||||
}
|
||||
|
||||
ProItem::ProItemKind ProBlock::kind() const
|
||||
{
|
||||
return ProItem::BlockKind;
|
||||
}
|
||||
|
||||
ProItem::ProItemKind ProVariable::kind() const
|
||||
{
|
||||
return ProItem::VariableKind;
|
||||
}
|
||||
|
||||
ProItem::ProItemKind ProFunction::kind() const
|
||||
{
|
||||
return ProItem::FunctionKind;
|
||||
}
|
||||
|
||||
ProItem::ProItemKind ProCondition::kind() const
|
||||
{
|
||||
return ProItem::ConditionKind;
|
||||
}
|
||||
|
||||
ProItem::ProItemKind ProOperator::kind() const
|
||||
{
|
||||
return ProItem::OperatorKind;
|
||||
}
|
||||
|
||||
// --------------- ProFile ----------------
|
||||
ProFile::ProFile(const QString &fileName)
|
||||
: ProBlock()
|
||||
{
|
||||
|
||||
@@ -56,15 +56,15 @@ public:
|
||||
ReturnReturn
|
||||
};
|
||||
|
||||
ProItem() : m_lineNumber(0) {}
|
||||
virtual ~ProItem() {}
|
||||
ProItem(ProItemKind kind) : m_kind(kind), m_lineNumber(0) {}
|
||||
|
||||
virtual ProItemKind kind() const = 0;
|
||||
ProItemKind kind() const { return m_kind; }
|
||||
|
||||
int lineNumber() const { return m_lineNumber; }
|
||||
void setLineNumber(int lineNumber) { m_lineNumber = lineNumber; }
|
||||
|
||||
private:
|
||||
ProItemKind m_kind;
|
||||
int m_lineNumber;
|
||||
};
|
||||
|
||||
@@ -91,8 +91,6 @@ public:
|
||||
void ref() { ++m_refCount; }
|
||||
void deref() { if (!--m_refCount) delete this; }
|
||||
|
||||
ProItem::ProItemKind kind() const;
|
||||
|
||||
private:
|
||||
QList<ProItem *> m_proitems;
|
||||
int m_blockKind;
|
||||
@@ -110,7 +108,7 @@ public:
|
||||
UniqueAddOperator = 4
|
||||
};
|
||||
|
||||
ProVariable(const QString &name) : m_variableKind(SetOperator), m_variable(name) {}
|
||||
ProVariable(const QString &name) : ProItem(VariableKind), m_variableKind(SetOperator), m_variable(name) {}
|
||||
void setVariableOperator(VariableOperator variableKind) { m_variableKind = variableKind; }
|
||||
VariableOperator variableOperator() const { return m_variableKind; }
|
||||
void setVariable(const QString &name) { m_variable = name; }
|
||||
@@ -118,8 +116,6 @@ public:
|
||||
void setValue(const QString &value) { m_value = value; }
|
||||
QString value() const { return m_value; }
|
||||
|
||||
ProItem::ProItemKind kind() const;
|
||||
|
||||
private:
|
||||
VariableOperator m_variableKind;
|
||||
QString m_variable;
|
||||
@@ -129,12 +125,10 @@ private:
|
||||
class ProFunction : public ProItem
|
||||
{
|
||||
public:
|
||||
explicit ProFunction(const QString &text) : m_text(text) {}
|
||||
explicit ProFunction(const QString &text) : ProItem(FunctionKind), m_text(text) {}
|
||||
void setText(const QString &text) { m_text = text; }
|
||||
QString text() const { return m_text; }
|
||||
|
||||
ProItem::ProItemKind kind() const;
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
};
|
||||
@@ -142,12 +136,10 @@ private:
|
||||
class ProCondition : public ProItem
|
||||
{
|
||||
public:
|
||||
explicit ProCondition(const QString &text) : m_text(text) {}
|
||||
explicit ProCondition(const QString &text) : ProItem(ConditionKind), m_text(text) {}
|
||||
void setText(const QString &text) { m_text = text; }
|
||||
QString text() const { return m_text; }
|
||||
|
||||
ProItem::ProItemKind kind() const;
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
};
|
||||
@@ -160,12 +152,10 @@ public:
|
||||
NotOperator = 2
|
||||
};
|
||||
|
||||
explicit ProOperator(OperatorKind operatorKind) : m_operatorKind(operatorKind) {}
|
||||
explicit ProOperator(OperatorKind operatorKind) : ProItem(ProItem::OperatorKind), m_operatorKind(operatorKind) {}
|
||||
void setOperatorKind(OperatorKind operatorKind) { m_operatorKind = operatorKind; }
|
||||
OperatorKind operatorKind() const { return m_operatorKind; }
|
||||
|
||||
ProItem::ProItemKind kind() const;
|
||||
|
||||
private:
|
||||
OperatorKind m_operatorKind;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user