AddTraceString Class Reference
The context class for the
State Design Pattern.
More...
#include <addTraceString.h>
Collaboration diagram for AddTraceString:
[legend]List of all members.
Detailed Description
The context class for the
State Design Pattern.
- Description
- This provides the context needed for the State pattern. The job of this class is to implement a finite-state machine where the states change based on the type of token delivered by the scanner object.
It holds counter for the number of braces and parentheses. Most importantly it has the state pointer, mp_state, which holds a pointer to the next state.
There are also some tokens which do not change the state but must delt with independent of the state. When a c-preprocessor directive, class and enum definitions or trace strings are found, they must be grabbed from input and sent directly to the output file. Namespaces must also be detected and remembered.
Constructor & Destructor Documentation
AddTraceString::AddTraceString |
( |
|
) |
|
|
|
Set the default context for the state pattern.
- Description
- This ctor is simple, It just has to zero the paren and brace counters and zero the state pointer.
{doxyBlock |
Member Function Documentation
void AddTraceString::addTraceString |
( |
const char * |
fileName |
) |
|
|
|
Add traceString to a single file.
- Description
- Takes a absolute path name (or ``-'' to be standard in) and adds the traceString to that file. A token is read in and some action happens to the token: either it is like a macro definition and it is copied directly to the output or the token is handed off to the execute function for the current state.
- Design Considerations
-
It prints most of the token it reads so functions from here must just print any new tokens read in.
|
Tbl & AddTraceString::buildTbl |
( |
|
) |
|
|
|
Take the already found names in member variables and place in m_tbl. |
void AddTraceString::changeState |
( |
State * |
s |
) |
|
|
|
Change current state to s. Print change of state if requested by user. |
|
Read in the macro definition. |
|
Read in the enum definition. |
std::string& AddTraceString::funcArgs |
( |
|
) |
[inline] |
|
|
Return the argument list. |
void AddTraceString::funcArgsAppend |
( |
const char * |
s |
) |
[inline] |
|
|
Append new argument to the current functions argument list. |
std::string& AddTraceString::funcName |
( |
|
) |
[inline] |
|
|
return the function name. |
|
Handle any class tokens read in. It can be a class definition or a forward declaration. |
int AddTraceString::lb |
( |
|
) |
[inline] |
|
void AddTraceString::lbAdd |
( |
int |
i |
) |
[inline] |
|
|
Add i to the curly brace count. |
void AddTraceString::lbSet |
( |
int |
i |
) |
[inline] |
|
|
Set the curly brace count to i (usually 0) |
int AddTraceString::lp |
( |
|
) |
[inline] |
|
|
Return the current paren count. |
void AddTraceString::lpAdd |
( |
int |
i |
) |
[inline] |
|
|
Add i to the paren counter |
void AddTraceString::lpSet |
( |
int |
i |
) |
[inline] |
|
|
Set the paren counter to i |
|
Find the namespace or handle ``using namespace foo''. |
void AddTraceString::namespaceAppend |
( |
const char * |
s |
) |
|
|
|
Add to the namespace array. |
void AddTraceString::namespacePop |
( |
|
) |
|
|
|
Pop the namespace array if there is any left. |
void AddTraceString::setFuncArgs |
( |
const char * |
s |
) |
[inline] |
|
|
Set the function's argument string |
void AddTraceString::setFuncName |
( |
const char * |
fdec |
) |
[inline] |
|
|
Handle any structs. It can be a struct definition, a declaration or a return value for a function. |
|
Handle any class or struct tokens read in. It can be a class definition or in a template definition or a forward declaration. |
|
Handle any traceString pairs found in a routine. |
Member Data Documentation
|
The class name plus any namespaces |
|
The function name that includes the class name if any. |
|
The fully qualified name. |
|
This is the dictionary that hold the FQNAME and others. The different names are found during the parsing of the source code and then placed in the table so that the replacement object can complete the generation of the traceString with the dynamic substitutions of the routine names. |
|
The trick that makes the state pattern work. |
The documentation for this class was generated from the following files: