CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
Functions | Variables
cccc_xml.cc File Reference
#include "cccc.h"
#include "cccc_itm.h"
#include "cccc_xml.h"
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>
#include "cccc_utl.h"
Include dependency graph for cccc_xml.cc:

Go to the source code of this file.

Functions

static string ltrim (string value)
 
CCCC_Xml_Streamoperator<< (CCCC_Xml_Stream &os, const string &stg)
 
CCCC_Xml_Streamoperator<< (CCCC_Xml_Stream &os, const CCCC_Metric &mtc)
 

Variables

static const string XML_PREAMBLE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
 
static const string XML_COMMENT_BEGIN = "<!--"
 
static const string XML_COMMENT_END = "-->"
 
static const string XML_TAG_OPEN_BEGIN = "<"
 
static const string XML_TAG_OPEN_END = ">"
 
static const string XML_TAG_CLOSE_BEGIN = "</"
 
static const string XML_TAG_CLOSE_END = ">"
 
static const string XML_TAG_INLINE_BEGIN = "<"
 
static const string XML_TAG_INLINE_END = "/>"
 
static const string XML_SPACE = " "
 
static const string XML_NEWLINE = "\n"
 
static const string XML_DQUOTE = "\""
 
static const string XML_EQUALS = "="
 
static const string PROJECT_NODE_NAME = "CCCC_Project"
 
static const string TIMESTAMP_NODE_NAME = "timestamp"
 
static const string SUMMARY_NODE_NAME = "project_summary"
 
static const string MODSUM_NODE_NAME = "module_summary"
 
static const string MODDET_NODE_NAME = "module_detail"
 
static const string PROCSUM_NODE_NAME = "procedural_summary"
 
static const string PROCDET_NODE_NAME = "procedural_detail"
 
static const string STRUCTSUM_NODE_NAME = "structural_summary"
 
static const string STRUCTDET_NODE_NAME = "structural_detail"
 
static const string OODESIGN_NODE_NAME = "oo_design"
 
static const string OTHER_NODE_NAME = "other_extents"
 
static const string REJECTED_NODE_NAME = "rejected_extent"
 
static const string NAME_NODE_NAME = "name"
 
static const string MODULE_NODE_NAME = "module"
 
static const string MEMBER_NODE_NAME = "member_function"
 
static const string EXTENT_NODE_NAME = "extent"
 
static const string SUPPLIERS_NODE_NAME = "suppliers"
 
static const string SUPMOD_NODE_NAME = "supplier_module"
 
static const string CLIENTS_NODE_NAME = "clients"
 
static const string CLIMOD_NODE_NAME = "client_module"
 
static const string DESC_NODE_NAME = "description"
 
static const string SRCREF_NODE_NAME = "source_reference"
 
static const string NOM_NODE_NAME = "number_of_modules"
 
static const string LOC_NODE_NAME = "lines_of_code"
 
static const string LOCPERMOD_NODE_NAME = "lines_of_code_per_module"
 
static const string LOCPERCOM_NODE_NAME = "lines_of_code_per_line_of_comment"
 
static const string LOCPERMEM_NODE_NAME = "lines_of_code_per_member_function"
 
static const string MVG_NODE_NAME = "McCabes_cyclomatic_complexity"
 
static const string MVGPERMOD_NODE_NAME = "McCabes_cyclomatic_complexity_per_module"
 
static const string MVGPERCOM_NODE_NAME = "McCabes_cyclomatic_complexity_per_line_of_comment"
 
static const string MVGPERMEM_NODE_NAME = "McCabes_cyclomatic_complexity_per_member_function"
 
static const string COM_NODE_NAME = "lines_of_comment"
 
static const string COMPERMOD_NODE_NAME = "lines_of_comment_per_module"
 
static const string COMPERMEM_NODE_NAME = "lines_of_comment_per_member_function"
 
static const string WMC1_NODE_NAME = "weighted_methods_per_class_unity"
 
static const string WMCV_NODE_NAME = "weighted_methods_per_class_visibility"
 
static const string DIT_NODE_NAME = "depth_of_inheritance_tree"
 
static const string NOC_NODE_NAME = "number_of_children"
 
static const string CBO_NODE_NAME = "coupling_between_objects"
 
static const string IF4_NODE_NAME = "IF4"
 
static const string IF4PERMOD_NODE_NAME = "IF4_per_module"
 
static const string IF4PERMEM_NODE_NAME = "IF4_per_member_function"
 
static const string IF4VIS_NODE_NAME = "IF4_visible"
 
static const string IF4VISPERMOD_NODE_NAME = "IF4_visible_per_module"
 
static const string IF4VISPERMEM_NODE_NAME = "IF4_visible_per_member_function"
 
static const string IF4CON_NODE_NAME = "IF4_concrete"
 
static const string IF4CONPERMOD_NODE_NAME = "IF4_concrete"
 
static const string IF4CONPERMEM_NODE_NAME = "IF4_concrete_per_member_function"
 
static const string FO_NODE_NAME = "fan_out"
 
static const string FOV_NODE_NAME = "fan_out_visible"
 
static const string FOC_NODE_NAME = "fan_out_concrete"
 
static const string FI_NODE_NAME = "fan_in"
 
static const string FIV_NODE_NAME = "fan_in_visible"
 
static const string FIC_NODE_NAME = "fan_in_concrete"
 
static const string REJ_LOC_NODE_NAME = "rejected_lines_of_code"
 
static const string VALUE_ATTR = "value"
 
static const string LEVEL_ATTR = "level"
 
static const string FILE_ATTR = "file"
 
static const string LINE_ATTR = "line"
 
static const string VISIBLE_ATTR = "visible"
 
static const string CONCRETE_ATTR = "concrete"
 
static const string LEVEL_NORMAL = "0"
 
static const string LEVEL_MEDIUM = "1"
 
static const string LEVEL_HIGH = "2"
 
static const string BOOL_FALSE = "false"
 
static const string BOOL_TRUE = "true"
 

Function Documentation

static string ltrim ( string  value)
static

Definition at line 136 of file cccc_xml.cc.

137 {
138  const int MAX_LENGTH = 1000;
139  int i = 0;
140  while(i<value.size() && value[i]==' ')
141  {
142  ++i;
143  }
144  return value.substr(i,MAX_LENGTH);
145 }

Here is the caller graph for this function:

CCCC_Xml_Stream& operator<< ( CCCC_Xml_Stream os,
const string &  stg 
)

Definition at line 615 of file cccc_xml.cc.

616 {
617  // initialise a character pointer to the start of the string's buffer
618  const char *cptr=stg.c_str();
619  while(*cptr!='\000') {
620  char c=*cptr;
621 
622  // the purpose of this is to filter out the characters which
623  // must be escaped in HTML
624  switch(c) {
625  case '>': os.fstr << "&gt;" ; break;
626  case '<': os.fstr << "&lt;" ; break;
627  case '&': os.fstr << "&amp;"; break;
628  default : os.fstr << c;
629  }
630  cptr++;
631  }
632  return os;
633 }
ofstream fstr
Definition: cccc_xml.h:47
CCCC_Xml_Stream& operator<< ( CCCC_Xml_Stream os,
const CCCC_Metric mtc 
)

Definition at line 635 of file cccc_xml.cc.

636 {
637  // by writing to the underlying ostream object, we avoid the escape
638  // functionality
639  os.fstr << ltrim(mtc.value_string()) ;
640  return os;
641 }
static string ltrim(string value)
Definition: cccc_xml.cc:136
string value_string() const
Definition: cccc_met.cc:116
ofstream fstr
Definition: cccc_xml.h:47

Here is the call graph for this function:

Variable Documentation

const string BOOL_FALSE = "false"
static

Definition at line 133 of file cccc_xml.cc.

const string BOOL_TRUE = "true"
static

Definition at line 134 of file cccc_xml.cc.

const string CBO_NODE_NAME = "coupling_between_objects"
static

Definition at line 105 of file cccc_xml.cc.

const string CLIENTS_NODE_NAME = "clients"
static

Definition at line 84 of file cccc_xml.cc.

const string CLIMOD_NODE_NAME = "client_module"
static

Definition at line 85 of file cccc_xml.cc.

const string COM_NODE_NAME = "lines_of_comment"
static

Definition at line 98 of file cccc_xml.cc.

const string COMPERMEM_NODE_NAME = "lines_of_comment_per_member_function"
static

Definition at line 100 of file cccc_xml.cc.

const string COMPERMOD_NODE_NAME = "lines_of_comment_per_module"
static

Definition at line 99 of file cccc_xml.cc.

const string CONCRETE_ATTR = "concrete"
static

Definition at line 128 of file cccc_xml.cc.

const string DESC_NODE_NAME = "description"
static

Definition at line 86 of file cccc_xml.cc.

const string DIT_NODE_NAME = "depth_of_inheritance_tree"
static

Definition at line 103 of file cccc_xml.cc.

const string EXTENT_NODE_NAME = "extent"
static

Definition at line 81 of file cccc_xml.cc.

const string FI_NODE_NAME = "fan_in"
static

Definition at line 118 of file cccc_xml.cc.

const string FIC_NODE_NAME = "fan_in_concrete"
static

Definition at line 120 of file cccc_xml.cc.

const string FILE_ATTR = "file"
static

Definition at line 125 of file cccc_xml.cc.

const string FIV_NODE_NAME = "fan_in_visible"
static

Definition at line 119 of file cccc_xml.cc.

const string FO_NODE_NAME = "fan_out"
static

Definition at line 115 of file cccc_xml.cc.

const string FOC_NODE_NAME = "fan_out_concrete"
static

Definition at line 117 of file cccc_xml.cc.

const string FOV_NODE_NAME = "fan_out_visible"
static

Definition at line 116 of file cccc_xml.cc.

const string IF4_NODE_NAME = "IF4"
static

Definition at line 106 of file cccc_xml.cc.

const string IF4CON_NODE_NAME = "IF4_concrete"
static

Definition at line 112 of file cccc_xml.cc.

const string IF4CONPERMEM_NODE_NAME = "IF4_concrete_per_member_function"
static

Definition at line 114 of file cccc_xml.cc.

const string IF4CONPERMOD_NODE_NAME = "IF4_concrete"
static

Definition at line 113 of file cccc_xml.cc.

const string IF4PERMEM_NODE_NAME = "IF4_per_member_function"
static

Definition at line 108 of file cccc_xml.cc.

const string IF4PERMOD_NODE_NAME = "IF4_per_module"
static

Definition at line 107 of file cccc_xml.cc.

const string IF4VIS_NODE_NAME = "IF4_visible"
static

Definition at line 109 of file cccc_xml.cc.

const string IF4VISPERMEM_NODE_NAME = "IF4_visible_per_member_function"
static

Definition at line 111 of file cccc_xml.cc.

const string IF4VISPERMOD_NODE_NAME = "IF4_visible_per_module"
static

Definition at line 110 of file cccc_xml.cc.

const string LEVEL_ATTR = "level"
static

Definition at line 124 of file cccc_xml.cc.

const string LEVEL_HIGH = "2"
static

Definition at line 132 of file cccc_xml.cc.

const string LEVEL_MEDIUM = "1"
static

Definition at line 131 of file cccc_xml.cc.

const string LEVEL_NORMAL = "0"
static

Definition at line 130 of file cccc_xml.cc.

const string LINE_ATTR = "line"
static

Definition at line 126 of file cccc_xml.cc.

const string LOC_NODE_NAME = "lines_of_code"
static

Definition at line 90 of file cccc_xml.cc.

const string LOCPERCOM_NODE_NAME = "lines_of_code_per_line_of_comment"
static

Definition at line 92 of file cccc_xml.cc.

const string LOCPERMEM_NODE_NAME = "lines_of_code_per_member_function"
static

Definition at line 93 of file cccc_xml.cc.

const string LOCPERMOD_NODE_NAME = "lines_of_code_per_module"
static

Definition at line 91 of file cccc_xml.cc.

const string MEMBER_NODE_NAME = "member_function"
static

Definition at line 80 of file cccc_xml.cc.

const string MODDET_NODE_NAME = "module_detail"
static

Definition at line 70 of file cccc_xml.cc.

const string MODSUM_NODE_NAME = "module_summary"
static

Definition at line 69 of file cccc_xml.cc.

const string MODULE_NODE_NAME = "module"
static

Definition at line 79 of file cccc_xml.cc.

const string MVG_NODE_NAME = "McCabes_cyclomatic_complexity"
static

Definition at line 94 of file cccc_xml.cc.

const string MVGPERCOM_NODE_NAME = "McCabes_cyclomatic_complexity_per_line_of_comment"
static

Definition at line 96 of file cccc_xml.cc.

const string MVGPERMEM_NODE_NAME = "McCabes_cyclomatic_complexity_per_member_function"
static

Definition at line 97 of file cccc_xml.cc.

const string MVGPERMOD_NODE_NAME = "McCabes_cyclomatic_complexity_per_module"
static

Definition at line 95 of file cccc_xml.cc.

const string NAME_NODE_NAME = "name"
static

Definition at line 78 of file cccc_xml.cc.

const string NOC_NODE_NAME = "number_of_children"
static

Definition at line 104 of file cccc_xml.cc.

const string NOM_NODE_NAME = "number_of_modules"
static

Definition at line 89 of file cccc_xml.cc.

const string OODESIGN_NODE_NAME = "oo_design"
static

Definition at line 75 of file cccc_xml.cc.

const string OTHER_NODE_NAME = "other_extents"
static

Definition at line 76 of file cccc_xml.cc.

const string PROCDET_NODE_NAME = "procedural_detail"
static

Definition at line 72 of file cccc_xml.cc.

const string PROCSUM_NODE_NAME = "procedural_summary"
static

Definition at line 71 of file cccc_xml.cc.

const string PROJECT_NODE_NAME = "CCCC_Project"
static

Definition at line 66 of file cccc_xml.cc.

const string REJ_LOC_NODE_NAME = "rejected_lines_of_code"
static

Definition at line 121 of file cccc_xml.cc.

const string REJECTED_NODE_NAME = "rejected_extent"
static

Definition at line 77 of file cccc_xml.cc.

const string SRCREF_NODE_NAME = "source_reference"
static

Definition at line 87 of file cccc_xml.cc.

const string STRUCTDET_NODE_NAME = "structural_detail"
static

Definition at line 74 of file cccc_xml.cc.

const string STRUCTSUM_NODE_NAME = "structural_summary"
static

Definition at line 73 of file cccc_xml.cc.

const string SUMMARY_NODE_NAME = "project_summary"
static

Definition at line 68 of file cccc_xml.cc.

const string SUPMOD_NODE_NAME = "supplier_module"
static

Definition at line 83 of file cccc_xml.cc.

const string SUPPLIERS_NODE_NAME = "suppliers"
static

Definition at line 82 of file cccc_xml.cc.

const string TIMESTAMP_NODE_NAME = "timestamp"
static

Definition at line 67 of file cccc_xml.cc.

const string VALUE_ATTR = "value"
static

Definition at line 123 of file cccc_xml.cc.

const string VISIBLE_ATTR = "visible"
static

Definition at line 127 of file cccc_xml.cc.

const string WMC1_NODE_NAME = "weighted_methods_per_class_unity"
static

Definition at line 101 of file cccc_xml.cc.

const string WMCV_NODE_NAME = "weighted_methods_per_class_visibility"
static

Definition at line 102 of file cccc_xml.cc.

const string XML_COMMENT_BEGIN = "<!--"
static

Definition at line 53 of file cccc_xml.cc.

const string XML_COMMENT_END = "-->"
static

Definition at line 54 of file cccc_xml.cc.

const string XML_DQUOTE = "\""
static

Definition at line 63 of file cccc_xml.cc.

const string XML_EQUALS = "="
static

Definition at line 64 of file cccc_xml.cc.

const string XML_NEWLINE = "\n"
static

Definition at line 62 of file cccc_xml.cc.

const string XML_PREAMBLE = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
static

Definition at line 52 of file cccc_xml.cc.

const string XML_SPACE = " "
static

Definition at line 61 of file cccc_xml.cc.

const string XML_TAG_CLOSE_BEGIN = "</"
static

Definition at line 57 of file cccc_xml.cc.

const string XML_TAG_CLOSE_END = ">"
static

Definition at line 58 of file cccc_xml.cc.

const string XML_TAG_INLINE_BEGIN = "<"
static

Definition at line 59 of file cccc_xml.cc.

const string XML_TAG_INLINE_END = "/>"
static

Definition at line 60 of file cccc_xml.cc.

const string XML_TAG_OPEN_BEGIN = "<"
static

Definition at line 55 of file cccc_xml.cc.

const string XML_TAG_OPEN_END = ">"
static

Definition at line 56 of file cccc_xml.cc.