examples: CodeMetric fixed for C++11

git-svn-id: svn://ultimatepp.org/upp/trunk@7213 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-04-10 09:57:48 +00:00
parent 1745522f2e
commit 83bac957ff
3 changed files with 12 additions and 7 deletions

View file

@ -81,22 +81,22 @@ void CodeMetric::StoreError(int line, const String &msg)
int CodeMetric::LogicalLinesOfCode(const LexSymbolStat &symbolStat) int CodeMetric::LogicalLinesOfCode(const LexSymbolStat &symbolStat)
{ {
static Vector<int> oneLiners( static Vector<int> oneLiners(pick(
Vector<int>() << tk_if << tk_else << tk_switch << tk_case Vector<int>() << tk_if << tk_else << tk_switch << tk_case
<< tk_for << tk_do << tk_while << tk_try << tk_catch << tk_for << tk_do << tk_while << tk_try << tk_catch
<< tk_struct << tk_class << tk_namespace << tk_struct << tk_class << tk_namespace
<< tk_public << tk_private << tk_protected << tk_public << tk_private << tk_protected
<< ';'); << ';'));
return symbolStat.SumStat( oneLiners ); return symbolStat.SumStat( oneLiners );
} }
void CodeMetric::StoreMetric(const Parser::FunctionStat & functionStat) void CodeMetric::StoreMetric(const Parser::FunctionStat & functionStat)
{ {
static Vector<int> cc1_symbols( static Vector<int> cc1_symbols(pick(
Vector<int>() << tk_if << tk_case << tk_for << tk_while << tk_catch); Vector<int>() << tk_if << tk_case << tk_for << tk_while << tk_catch));
static Vector<int> cc2_symbols( static Vector<int> cc2_symbols(pick(
Vector<int>() << t_and << t_or << '?'); Vector<int>() << t_and << t_or << '?'));
if(!functionStat.cppItem.impl) if(!functionStat.cppItem.impl)
return; return;

View file

@ -1,4 +1,4 @@
description "Investigating C++ cyclometric complexity"; description "Investigating C++ cyclometric complexity\377";
uses uses
CtrlLib, CtrlLib,

5
examples/CodeMetric/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _CodeMetric_icpp_init_stub
#define _CodeMetric_icpp_init_stub
#include "CtrlLib/init"
#include "CppBase/init"
#endif