CCCC - C and C++ Code Counter  9999-git
CCCC Development version (post-3.1.4)
Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CCCC_Extent Class Reference

#include <cccc_ext.h>

Collaboration diagram for CCCC_Extent:
[legend]

Public Member Functions

 CCCC_Extent ()
 
 CCCC_Extent (CCCC_Item &is)
 
string name (int index) const
 
string key () const
 
int GetFromItem (CCCC_Item &item)
 
int AddToItem (CCCC_Item &item)
 
Visibility get_visibility () const
 
int get_count (const char *count_tag)
 
UseType get_usetype () const
 
const char * get_description () const
 

Private Attributes

string filename
 
string linenumber
 
string description
 
string flags
 
string count_buffer
 
UseType ut
 
Visibility v
 
unsigned int extkey
 

Static Private Attributes

static unsigned int nextkey =0
 

Friends

class CCCC_Record
 
class CCCC_Project
 

Detailed Description

Definition at line 33 of file cccc_ext.h.

Constructor & Destructor Documentation

CCCC_Extent::CCCC_Extent ( )

Definition at line 30 of file cccc_ext.cc.

31 {
32  v=vINVALID;
33  ut=utINVALID;
34  extkey=++nextkey;
35 }
static unsigned int nextkey
Definition: cccc_ext.h:45
unsigned int extkey
Definition: cccc_ext.h:46
Visibility v
Definition: cccc_ext.h:44
UseType ut
Definition: cccc_ext.h:43
CCCC_Extent::CCCC_Extent ( CCCC_Item is)

Definition at line 37 of file cccc_ext.cc.

38 {
39  char v_as_char='!', ut_as_char='!';
40 
41  if(
42  is.Extract(filename) &&
43  is.Extract(linenumber) &&
44  is.Extract(description) &&
45  is.Extract(flags) &&
46  is.Extract(count_buffer) &&
47  is.Extract(v_as_char) &&
48  is.Extract(ut_as_char)
49  )
50  {
51  v=(Visibility) v_as_char;
52  ut=(UseType) ut_as_char;
53  }
54  else
55  {
56  // we can trust the string constructor to give us empty strings,
57  // but we need to initialise these
58  v=vDONTKNOW;
59  ut=utDONTKNOW;
60  }
61  extkey=++nextkey;
62 }
string description
Definition: cccc_ext.h:40
static unsigned int nextkey
Definition: cccc_ext.h:45
string filename
Definition: cccc_ext.h:38
unsigned int extkey
Definition: cccc_ext.h:46
string flags
Definition: cccc_ext.h:41
bool Extract(string &s)
Definition: cccc_itm.cc:47
Visibility
Definition: cccc_utl.h:52
UseType
Definition: cccc_utl.h:65
string linenumber
Definition: cccc_ext.h:39
Visibility v
Definition: cccc_ext.h:44
string count_buffer
Definition: cccc_ext.h:42
UseType ut
Definition: cccc_ext.h:43

Here is the call graph for this function:

Member Function Documentation

int CCCC_Extent::AddToItem ( CCCC_Item item)

Definition at line 64 of file cccc_ext.cc.

65 {
66  int retval=FALSE;
67 
68  if(
69  item.Insert(filename) &&
70  item.Insert(linenumber) &&
71  item.Insert(description) &&
72  item.Insert(flags) &&
73  item.Insert(count_buffer) &&
74  item.Insert((char) v) &&
75  item.Insert((char) ut)
76  )
77  {
78  retval=TRUE;
79  }
80 
81  return retval;
82 }
string description
Definition: cccc_ext.h:40
string filename
Definition: cccc_ext.h:38
bool Insert(const string &s)
Definition: cccc_itm.cc:31
string flags
Definition: cccc_ext.h:41
string linenumber
Definition: cccc_ext.h:39
Visibility v
Definition: cccc_ext.h:44
string count_buffer
Definition: cccc_ext.h:42
UseType ut
Definition: cccc_ext.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

int CCCC_Extent::get_count ( const char *  count_tag)

Definition at line 147 of file cccc_ext.cc.

147  {
148  int retval=0;
149  char local_count_buffer[100], *count_tag_ptr, *count_value_ptr;
150  strcpy(local_count_buffer,count_buffer.c_str());
151  count_tag_ptr=strtok(local_count_buffer,":");
152  while(count_tag_ptr!=NULL)
153  {
154  count_value_ptr=strtok(NULL," ");
155  if(strcmp(count_tag_ptr, count_tag) ==0)
156  {
157  retval+=atoi(count_value_ptr);
158  }
159  count_tag_ptr=strtok(NULL,":");
160  }
161  return retval;
162 }
string count_buffer
Definition: cccc_ext.h:42

Here is the caller graph for this function:

const char* CCCC_Extent::get_description ( ) const
inline

Definition at line 58 of file cccc_ext.h.

58 { return description.c_str(); }
string description
Definition: cccc_ext.h:40
UseType CCCC_Extent::get_usetype ( ) const
inline

Definition at line 57 of file cccc_ext.h.

57 { return ut; }
UseType ut
Definition: cccc_ext.h:43

Here is the caller graph for this function:

Visibility CCCC_Extent::get_visibility ( ) const
inline

Definition at line 55 of file cccc_ext.h.

55 { return v; }
Visibility v
Definition: cccc_ext.h:44

Here is the caller graph for this function:

int CCCC_Extent::GetFromItem ( CCCC_Item item)

Definition at line 84 of file cccc_ext.cc.

85 {
86  int retval=FALSE;
87  char v_as_char, ut_as_char;
88  if(
89  item.Extract(filename) &&
90  item.Extract(linenumber) &&
91  item.Extract(description) &&
92  item.Extract(flags) &&
93  item.Extract(count_buffer) &&
94  item.Extract(v_as_char) &&
95  item.Extract(ut_as_char)
96  )
97  {
98  v = (Visibility) v_as_char;
99  ut = (UseType) ut_as_char;
100  retval=TRUE;
101  }
102 
103  return retval;
104 }
string description
Definition: cccc_ext.h:40
string filename
Definition: cccc_ext.h:38
string flags
Definition: cccc_ext.h:41
bool Extract(string &s)
Definition: cccc_itm.cc:47
Visibility
Definition: cccc_utl.h:52
UseType
Definition: cccc_utl.h:65
string linenumber
Definition: cccc_ext.h:39
Visibility v
Definition: cccc_ext.h:44
string count_buffer
Definition: cccc_ext.h:42
UseType ut
Definition: cccc_ext.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

string CCCC_Extent::key ( ) const

Definition at line 145 of file cccc_ext.cc.

145 { return name(nlRANK); }
string name(int index) const
Definition: cccc_ext.cc:107

Here is the call graph for this function:

string CCCC_Extent::name ( int  index) const

Definition at line 107 of file cccc_ext.cc.

108 {
109  string rtnbuf;
110 
111  rtnbuf="";
112 
113  switch(level)
114  {
115  case nlFILENAME:
116  rtnbuf=filename;
117  break;
118  case nlLINENUMBER:
119  rtnbuf=linenumber;
120  break;
121  case nlDESCRIPTION:
122  rtnbuf=description;
123  break;
124  case nlSEARCH:
125  case nlRANK:
126  // Extents have no meaningful internal primary key.
127  // We never want two extents to have the same
128  // key, so we use the running number extkey
129  // which is initialized in both constructors.
130  // This should cause extents to sort in order of
131  // their creation, which is fine.
132  char buf[16];
133  sprintf(buf,"%015d",extkey);
134  rtnbuf=buf;
135  break;
136 
137  default:
138  rtnbuf+=filename;
139  rtnbuf+=":";
140  rtnbuf+=linenumber;
141  }
142  return rtnbuf.c_str();
143 }
string description
Definition: cccc_ext.h:40
string filename
Definition: cccc_ext.h:38
unsigned int extkey
Definition: cccc_ext.h:46
string linenumber
Definition: cccc_ext.h:39

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class CCCC_Project
friend

Definition at line 36 of file cccc_ext.h.

friend class CCCC_Record
friend

Definition at line 35 of file cccc_ext.h.

Member Data Documentation

string CCCC_Extent::count_buffer
private

Definition at line 42 of file cccc_ext.h.

string CCCC_Extent::description
private

Definition at line 40 of file cccc_ext.h.

unsigned int CCCC_Extent::extkey
private

Definition at line 46 of file cccc_ext.h.

string CCCC_Extent::filename
private

Definition at line 38 of file cccc_ext.h.

string CCCC_Extent::flags
private

Definition at line 41 of file cccc_ext.h.

string CCCC_Extent::linenumber
private

Definition at line 39 of file cccc_ext.h.

unsigned int CCCC_Extent::nextkey =0
staticprivate

Definition at line 45 of file cccc_ext.h.

UseType CCCC_Extent::ut
private

Definition at line 43 of file cccc_ext.h.

Visibility CCCC_Extent::v
private

Definition at line 44 of file cccc_ext.h.


The documentation for this class was generated from the following files: