#include <CRCppEmitter.h>
Public Member Functions | |
virtual void | AddCode (wxString str) |
Add code, no-na. | |
virtual void | AddComment (wxString str) |
Add comment, no-na. | |
virtual wxString | AddContainerLookupCode (const wxString &containerName, const wxString &itemDesc=_T(""), const wxString &containerVarNameSuffix=_T("")) |
Add code for container lookup. | |
virtual void | AddVerbatimStringWithLineBreaks (wxString str) |
Add long string verbatim, i.e. keep line breaks. | |
virtual wxString | GetCaptureFilename () const |
[TEST] Get filename of current capturing target. | |
virtual wxString | GetTab () const |
Get current tabulator in the shape of a string (helper method). | |
virtual unsigned int | GetTabSize () const |
Get current tabulator size. | |
virtual wxString | MakeVarName (const wxString &name, const wxString &suffix=_T("")) |
Make unique variable name based on given name. | |
virtual void | SetTabSize (unsigned int size) |
Set new tabulator size. | |
virtual void | SetTestCaseFileContext (const wxString &filename, size_t lineNmb=-1) |
Static Public Member Functions | |
static void | Destroy () |
Threadsafe destruction of static singleton instance. | |
static CRCppEmitter * | GetInstance () |
Get single private instance (Singleton pattern). | |
Protected Member Functions | |
virtual wxString | BreakString (const wxString &str, const wxArrayString &breakStrs, unsigned int &idx, size_t minIdx=wxString::npos, bool isCode=false) const |
CRCppEmitter () | |
Constructor. | |
virtual bool | HasBrokenInString (const wxString &line) const |
Calculates, if given line has been broken in the middle of a string constant. | |
virtual bool | IsContainerVarNameDuplicate (const wxString &str) const |
Checks, if given string is a duplicate of a container variable name. | |
virtual wxString | MakeFirstCharLowerCase (const wxString &str) const |
Get given string with first character converted to lower case. | |
virtual | ~CRCppEmitter () |
Destructor. |
Definition at line 31 of file CRCppEmitter.h.
CRCppEmitter::CRCppEmitter | ( | ) | [protected] |
Constructor.
Definition at line 28 of file CRCppEmitter.cpp.
References SetTabSize().
Referenced by GetInstance().
CRCppEmitter::~CRCppEmitter | ( | ) | [protected, virtual] |
void CRCppEmitter::AddCode | ( | wxString | str | ) | [virtual] |
Add code, no-na.
str | code to add |
Definition at line 170 of file CRCppEmitter.cpp.
References BreakString(), and HasBrokenInString().
Referenced by AddContainerLookupCode(), wxTst::CRTreeSelectionChangingEvent::EmitCpp(), wxTst::CRTreeItemRightClickEvent::EmitCpp(), wxTst::CRTextUpdateEvent::EmitCpp(), wxTst::CRSpinCtrlUpdateEvent::EmitCpp(), wxTst::CRSliderUpdateEvent::EmitCpp(), wxTst::CRRadioBoxSelectionEvent::EmitCpp(), wxTst::CRNotebookPageChangeEvent::EmitCpp(), wxTst::CRMenuSelectionEvent::EmitCpp(), wxTst::CRChoiceSelectionEvent::EmitCpp(), wxTst::CRCheckBoxClickEvent::EmitCpp(), and wxTst::CRButtonClickEvent::EmitCpp().
void CRCppEmitter::AddComment | ( | wxString | str | ) | [virtual] |
Add comment, no-na.
str | comment to add |
Definition at line 139 of file CRCppEmitter.cpp.
References BreakString().
Referenced by wxTst::CRMenuSelectionEvent::EmitCpp(), and wxTst::CREventCaptureManager::FilterEvent().
wxString CRCppEmitter::AddContainerLookupCode | ( | const wxString & | containerName, | |
const wxString & | itemDesc = _T("") , |
|||
const wxString & | containerVarNameSuffix = _T("") | |||
) | [virtual] |
Add code for container lookup.
Prevents multiple outputs of the same container lookup code, thus, use returned actual container name in further code emitting.
containerName | name of container to emit lookup code | |
itemDesc | description of item initiating the container lookup; only used for emitted assertion message | |
containerVarNameSuffix | suffix for container variable name |
Definition at line 229 of file CRCppEmitter.cpp.
References AddCode(), IsContainerVarNameDuplicate(), and MakeFirstCharLowerCase().
Referenced by wxTst::CRTreeSelectionChangingEvent::EmitCpp(), wxTst::CRTreeItemRightClickEvent::EmitCpp(), wxTst::CRTextUpdateEvent::EmitCpp(), wxTst::CRSpinCtrlUpdateEvent::EmitCpp(), wxTst::CRSliderUpdateEvent::EmitCpp(), wxTst::CRRadioBoxSelectionEvent::EmitCpp(), wxTst::CRNotebookPageChangeEvent::EmitCpp(), wxTst::CRMenuSelectionEvent::EmitCpp(), wxTst::CRChoiceSelectionEvent::EmitCpp(), wxTst::CRCheckBoxClickEvent::EmitCpp(), and wxTst::CRButtonClickEvent::EmitCpp().
void CRCppEmitter::AddVerbatimStringWithLineBreaks | ( | wxString | str | ) | [virtual] |
Add long string verbatim, i.e. keep line breaks.
str | string to add |
Definition at line 221 of file CRCppEmitter.cpp.
wxString CRCppEmitter::BreakString | ( | const wxString & | str, | |
const wxArrayString & | breakStrs, | |||
unsigned int & | idx, | |||
size_t | minIdx = wxString::npos , |
|||
bool | isCode = false | |||
) | const [protected, virtual] |
Definition at line 325 of file CRCppEmitter.cpp.
References HasBrokenInString().
Referenced by AddCode(), and AddComment().
void CRCppEmitter::Destroy | ( | ) | [static] |
Threadsafe destruction of static singleton instance.
Definition at line 63 of file CRCppEmitter.cpp.
wxString CRCppEmitter::GetCaptureFilename | ( | ) | const [virtual] |
[TEST] Get filename of current capturing target.
Only required for testing!
Definition at line 135 of file CRCppEmitter.cpp.
CRCppEmitter * CRCppEmitter::GetInstance | ( | ) | [static] |
Get single private instance (Singleton pattern).
Definition at line 53 of file CRCppEmitter.cpp.
References CRCppEmitter().
Referenced by wxTst::CRCapture::Capture(), wxTst::CRTreeSelectionChangingEvent::EmitCpp(), wxTst::CRTreeItemRightClickEvent::EmitCpp(), wxTst::CRTextUpdateEvent::EmitCpp(), wxTst::CRSpinCtrlUpdateEvent::EmitCpp(), wxTst::CRSliderUpdateEvent::EmitCpp(), wxTst::CRRadioBoxSelectionEvent::EmitCpp(), wxTst::CRNotebookPageChangeEvent::EmitCpp(), wxTst::CRMenuSelectionEvent::EmitCpp(), wxTst::CRChoiceSelectionEvent::EmitCpp(), wxTst::CRCheckBoxClickEvent::EmitCpp(), wxTst::CRButtonClickEvent::EmitCpp(), and wxTst::CREventCaptureManager::FilterEvent().
wxString CRCppEmitter::GetTab | ( | ) | const [virtual] |
Get current tabulator in the shape of a string (helper method).
Definition at line 85 of file CRCppEmitter.cpp.
Referenced by wxTst::CRNotebookPageChangeEvent::EmitCpp().
unsigned int CRCppEmitter::GetTabSize | ( | ) | const [virtual] |
Get current tabulator size.
Definition at line 79 of file CRCppEmitter.cpp.
bool CRCppEmitter::HasBrokenInString | ( | const wxString & | line | ) | const [protected, virtual] |
Calculates, if given line has been broken in the middle of a string constant.
This allows to use line splicing correctly: before by means of '\' at the end of line, now using '"' at the end and beginning of the code emitting.
line | line to investigate for string constant delimiters ('"' char) |
Definition at line 423 of file CRCppEmitter.cpp.
Referenced by AddCode(), and BreakString().
bool CRCppEmitter::IsContainerVarNameDuplicate | ( | const wxString & | str | ) | const [protected, virtual] |
Checks, if given string is a duplicate of a container variable name.
str | string to check for duplication |
Definition at line 430 of file CRCppEmitter.cpp.
Referenced by AddContainerLookupCode(), and MakeVarName().
wxString CRCppEmitter::MakeFirstCharLowerCase | ( | const wxString & | str | ) | const [protected, virtual] |
Get given string with first character converted to lower case.
str | string to convert |
Definition at line 449 of file CRCppEmitter.cpp.
Referenced by AddContainerLookupCode(), and MakeVarName().
wxString CRCppEmitter::MakeVarName | ( | const wxString & | name, | |
const wxString & | suffix = _T("") | |||
) | [virtual] |
Make unique variable name based on given name.
Stores returned variable name in container for guaranteeing future variable uniqueness as well. Suffix: e.g. "&Open... Ctrl+O" + "MenuItemId" => "Open... Ctrl+O" + "MenuItemId" => "Open" + "MenuItemId" => "openMenuItemId"
name | base for unique variable name | |
suffix | optional suffix of variable name |
Definition at line 275 of file CRCppEmitter.cpp.
References IsContainerVarNameDuplicate(), and MakeFirstCharLowerCase().
Referenced by wxTst::CRTreeSelectionChangingEvent::EmitCpp(), wxTst::CRTreeItemRightClickEvent::EmitCpp(), wxTst::CRTextUpdateEvent::EmitCpp(), wxTst::CRSpinCtrlUpdateEvent::EmitCpp(), wxTst::CRSliderUpdateEvent::EmitCpp(), wxTst::CRRadioBoxSelectionEvent::EmitCpp(), wxTst::CRNotebookPageChangeEvent::EmitCpp(), wxTst::CRMenuSelectionEvent::EmitCpp(), wxTst::CRChoiceSelectionEvent::EmitCpp(), wxTst::CRCheckBoxClickEvent::EmitCpp(), and wxTst::CRButtonClickEvent::EmitCpp().
void CRCppEmitter::SetTabSize | ( | unsigned int | size | ) | [virtual] |
Set new tabulator size.
size | new tabulator size |
Definition at line 73 of file CRCppEmitter.cpp.
Referenced by CRCppEmitter().
void CRCppEmitter::SetTestCaseFileContext | ( | const wxString & | filename, | |
size_t | lineNmb = -1 | |||
) | [virtual] |