Skip to content

Commit

Permalink
Adding filename and line number to the endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
intjftw committed Jun 30, 2024
1 parent 06b6618 commit 49045bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
21 changes: 15 additions & 6 deletions plugins/cpp_metrics/model/include/model/cppastnodemetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <model/cppastnode.h>
#include <model/cppentity.h>
#include <model/cpprecord.h>
#include <model/position.h>

namespace cc
{
Expand Down Expand Up @@ -84,22 +85,30 @@ struct CppAstNodeMetricsForPathView
object(File = LocFile : CppAstNode::location.file)
struct CppAstNodeMetricsAndDataForPathView
{
#pragma db column(CppAstNodeMetrics::astNodeId)
typedef cc::model::Position::PosType PosType;

#pragma db column(CppAstNodeMetrics::astNodeId)
CppAstNodeId astNodeId;

#pragma db column(LocFile::path)
#pragma db column(LocFile::path)
std::string path;

#pragma db column(CppAstNode::symbolType)
#pragma db column(CppAstNode::location.range.start.line)
PosType startLine;

#pragma db column(CppAstNode::location.range.end.line)
PosType endLine;

#pragma db column(CppAstNode::symbolType)
CppAstNode::SymbolType symbolType;

#pragma db column(CppAstNode::astType)
#pragma db column(CppAstNode::astType)
CppAstNode::AstType astType;

#pragma db column(CppAstNodeMetrics::type)
#pragma db column(CppAstNodeMetrics::type)
CppAstNodeMetrics::Type type;

#pragma db column(CppAstNodeMetrics::value)
#pragma db column(CppAstNodeMetrics::value)
double value;
};

Expand Down
5 changes: 3 additions & 2 deletions plugins/cpp_metrics/service/cxxmetrics.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ struct CppMetricsAstNodeAllData
3:string symbolType,
4:string astType,
// valami kurva item mező
// kibaszott sorszám
5:map<CppAstNodeMetricsType, double> metrics
5:i32 startLine,
6:i32 endLine,
7:map<CppAstNodeMetricsType, double> metrics
}

struct CppMetricsModuleSingle
Expand Down
7 changes: 6 additions & 1 deletion plugins/cpp_metrics/service/src/cppmetricsservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@ void CppMetricsServiceHandler::getCppAstNodeMetricsAndDataForPath(
else
{
CppMetricsAstNodeAllData metric;
metric.path = node.path;
std::size_t pos = node.path.find_last_of('/');
metric.path = node.path.substr(0, pos + 1);
metric.file = node.path.substr(pos + 1);
metric.startLine = node.startLine;
metric.endLine = node.endLine;
// TODO: what additional info do we need about the AST
metric.symbolType = cc::model::symbolTypeToString(node.symbolType);
metric.astType = cc::model::astTypeToString(node.astType);

Expand Down

0 comments on commit 49045bd

Please sign in to comment.