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
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
ProBlock::ProBlock()
|
ProBlock::ProBlock()
|
||||||
|
: ProItem(BlockKind)
|
||||||
{
|
{
|
||||||
m_blockKind = 0;
|
m_blockKind = 0;
|
||||||
m_refCount = 1;
|
m_refCount = 1;
|
||||||
@@ -48,32 +49,6 @@ ProBlock::~ProBlock()
|
|||||||
delete itm;
|
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)
|
ProFile::ProFile(const QString &fileName)
|
||||||
: ProBlock()
|
: ProBlock()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,15 +56,15 @@ public:
|
|||||||
ReturnReturn
|
ReturnReturn
|
||||||
};
|
};
|
||||||
|
|
||||||
ProItem() : m_lineNumber(0) {}
|
ProItem(ProItemKind kind) : m_kind(kind), m_lineNumber(0) {}
|
||||||
virtual ~ProItem() {}
|
|
||||||
|
|
||||||
virtual ProItemKind kind() const = 0;
|
ProItemKind kind() const { return m_kind; }
|
||||||
|
|
||||||
int lineNumber() const { return m_lineNumber; }
|
int lineNumber() const { return m_lineNumber; }
|
||||||
void setLineNumber(int lineNumber) { m_lineNumber = lineNumber; }
|
void setLineNumber(int lineNumber) { m_lineNumber = lineNumber; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ProItemKind m_kind;
|
||||||
int m_lineNumber;
|
int m_lineNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,8 +91,6 @@ public:
|
|||||||
void ref() { ++m_refCount; }
|
void ref() { ++m_refCount; }
|
||||||
void deref() { if (!--m_refCount) delete this; }
|
void deref() { if (!--m_refCount) delete this; }
|
||||||
|
|
||||||
ProItem::ProItemKind kind() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<ProItem *> m_proitems;
|
QList<ProItem *> m_proitems;
|
||||||
int m_blockKind;
|
int m_blockKind;
|
||||||
@@ -110,7 +108,7 @@ public:
|
|||||||
UniqueAddOperator = 4
|
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; }
|
void setVariableOperator(VariableOperator variableKind) { m_variableKind = variableKind; }
|
||||||
VariableOperator variableOperator() const { return m_variableKind; }
|
VariableOperator variableOperator() const { return m_variableKind; }
|
||||||
void setVariable(const QString &name) { m_variable = name; }
|
void setVariable(const QString &name) { m_variable = name; }
|
||||||
@@ -118,8 +116,6 @@ public:
|
|||||||
void setValue(const QString &value) { m_value = value; }
|
void setValue(const QString &value) { m_value = value; }
|
||||||
QString value() const { return m_value; }
|
QString value() const { return m_value; }
|
||||||
|
|
||||||
ProItem::ProItemKind kind() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VariableOperator m_variableKind;
|
VariableOperator m_variableKind;
|
||||||
QString m_variable;
|
QString m_variable;
|
||||||
@@ -129,12 +125,10 @@ private:
|
|||||||
class ProFunction : public ProItem
|
class ProFunction : public ProItem
|
||||||
{
|
{
|
||||||
public:
|
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; }
|
void setText(const QString &text) { m_text = text; }
|
||||||
QString text() const { return m_text; }
|
QString text() const { return m_text; }
|
||||||
|
|
||||||
ProItem::ProItemKind kind() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_text;
|
QString m_text;
|
||||||
};
|
};
|
||||||
@@ -142,12 +136,10 @@ private:
|
|||||||
class ProCondition : public ProItem
|
class ProCondition : public ProItem
|
||||||
{
|
{
|
||||||
public:
|
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; }
|
void setText(const QString &text) { m_text = text; }
|
||||||
QString text() const { return m_text; }
|
QString text() const { return m_text; }
|
||||||
|
|
||||||
ProItem::ProItemKind kind() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_text;
|
QString m_text;
|
||||||
};
|
};
|
||||||
@@ -160,12 +152,10 @@ public:
|
|||||||
NotOperator = 2
|
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; }
|
void setOperatorKind(OperatorKind operatorKind) { m_operatorKind = operatorKind; }
|
||||||
OperatorKind operatorKind() const { return m_operatorKind; }
|
OperatorKind operatorKind() const { return m_operatorKind; }
|
||||||
|
|
||||||
ProItem::ProItemKind kind() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OperatorKind m_operatorKind;
|
OperatorKind m_operatorKind;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user