ui: show signature in function & method tooltip
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "data/graph/token_component/TokenComponentConst.h"
|
||||
#include "data/graph/token_component/TokenComponentStatic.h"
|
||||
#include "data/graph/token_component/TokenComponentFilePath.h"
|
||||
#include "data/graph/token_component/TokenComponentSignature.h"
|
||||
|
||||
const Node::NodeTypeMask Node::NODE_NOT_VISIBLE = Node::NODE_UNDEFINED | Node::NODE_NAMESPACE;
|
||||
|
||||
@@ -395,6 +396,23 @@ void Node::addComponentFilePath(std::shared_ptr<TokenComponentFilePath> componen
|
||||
}
|
||||
}
|
||||
|
||||
void Node::addComponentSignature(std::shared_ptr<TokenComponentSignature> component)
|
||||
{
|
||||
if (getComponent<TokenComponentSignature>())
|
||||
{
|
||||
LOG_ERROR("TokenComponentSignature has been set before!");
|
||||
return;
|
||||
}
|
||||
else if (!isType(NODE_FUNCTION | NODE_METHOD))
|
||||
{
|
||||
LOG_ERROR("TokenComponentFilePath can't be set on node of type: " + getTypeString());
|
||||
}
|
||||
else
|
||||
{
|
||||
addComponent(component);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Node::getTypeString() const
|
||||
{
|
||||
return getTypeString(m_type);
|
||||
|
||||
@@ -14,6 +14,7 @@ class TokenComponentAbstraction;
|
||||
class TokenComponentConst;
|
||||
class TokenComponentStatic;
|
||||
class TokenComponentFilePath;
|
||||
class TokenComponentSignature;
|
||||
|
||||
class Node
|
||||
: public Token
|
||||
@@ -91,6 +92,7 @@ public:
|
||||
void addComponentConst(std::shared_ptr<TokenComponentConst> component);
|
||||
void addComponentStatic(std::shared_ptr<TokenComponentStatic> component);
|
||||
void addComponentFilePath(std::shared_ptr<TokenComponentFilePath> component);
|
||||
void addComponentSignature(std::shared_ptr<TokenComponentSignature> component);
|
||||
|
||||
// Logging.
|
||||
virtual std::string getTypeString() const;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "data/graph/token_component/TokenComponentSignature.h"
|
||||
|
||||
TokenComponentSignature::TokenComponentSignature(const std::string& signature)
|
||||
: m_signature(signature)
|
||||
{
|
||||
}
|
||||
|
||||
TokenComponentSignature::~TokenComponentSignature()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<TokenComponent> TokenComponentSignature::copy() const
|
||||
{
|
||||
return std::make_shared<TokenComponentSignature>(*this);
|
||||
}
|
||||
|
||||
const std::string& TokenComponentSignature::getSignature() const
|
||||
{
|
||||
return m_signature;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef TOKEN_COMPONENT_SIGNATURE_H
|
||||
#define TOKEN_COMPONENT_SIGNATURE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "data/graph/token_component/TokenComponent.h"
|
||||
|
||||
class TokenComponentSignature
|
||||
: public TokenComponent
|
||||
{
|
||||
public:
|
||||
TokenComponentSignature(const std::string& signature);
|
||||
virtual ~TokenComponentSignature();
|
||||
|
||||
virtual std::shared_ptr<TokenComponent> copy() const;
|
||||
|
||||
const std::string& getSignature() const;
|
||||
|
||||
private:
|
||||
const std::string m_signature;
|
||||
};
|
||||
|
||||
#endif // TOKEN_COMPONENT_SIGNATURE_H
|
||||
Reference in New Issue
Block a user