umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
CPPCodeGenerationPolicy Class Reference

#include <cppcodegenerationpolicy.h>

Inheritance diagram for CPPCodeGenerationPolicy:
Collaboration diagram for CPPCodeGenerationPolicy:

Public Member Functions

 CPPCodeGenerationPolicy ()
 
virtual ~CPPCodeGenerationPolicy ()
 
void setAccessorsAreInline (bool var)
 
bool getAccessorsAreInline ()
 
void setOperationsAreInline (bool var)
 
bool getOperationsAreInline ()
 
void setDestructorsAreVirtual (bool var)
 
bool getDestructorsAreVirtual ()
 
void setPackageIsNamespace (bool var)
 
bool getPackageIsNamespace ()
 
void setAutoGenerateAccessors (bool var)
 
bool getAutoGenerateAccessors ()
 
void setAccessorsArePublic (bool var)
 
bool getAccessorsArePublic ()
 
void setGetterWithGetPrefix (bool var)
 
bool getGetterWithGetPrefix ()
 
void setRemovePrefixFromAccessorMethods (bool var)
 
bool getRemovePrefixFromAccessorMethods ()
 
bool getAccessorMethodsStartWithUpperCase ()
 
void setAccessorMethodsStartWithUpperCase (bool var)
 
void setStringClassName (const QString &value)
 
QString getStringClassName ()
 
void setStringClassNameInclude (const QString &value)
 
QString getStringClassNameInclude ()
 
void setVectorClassName (const QString &value)
 
QString getVectorClassName ()
 
void setVectorClassNameInclude (const QString &value)
 
QString getVectorClassNameInclude ()
 
void setClassMemberPrefix (const QString &value)
 
QString getClassMemberPrefix ()
 
void setDocToolTag (const QString &value)
 
QString getDocToolTag ()
 
void setStringIncludeIsGlobal (bool value)
 
bool stringIncludeIsGlobal ()
 
void setVectorIncludeIsGlobal (bool value)
 
bool vectorIncludeIsGlobal ()
 
QString getVectorMethodAppend (const QString &variableName=QString(), const QString &itemClassName=QString())
 
QString getVectorMethodRemove (const QString &variableName=QString(), const QString &itemClassName=QString())
 
QString getVectorMethodInit (const QString &variableName=QString(), const QString &itemClassName=QString())
 
QString getObjectMethodInit (const QString &variableName=QString(), const QString &itemClassName=QString())
 
virtual void setDefaults (CPPCodeGenerationPolicy *cppclone, bool emitUpdateSignal=true)
 
virtual void setDefaults (bool emitUpdateSignal=true)
 
CodeGenerationPolicyPagecreatePage (QWidget *parent=0, const char *name=0)
 
- Public Member Functions inherited from CodeGenPolicyExt
 CodeGenPolicyExt ()
 
virtual ~CodeGenPolicyExt ()
 

Static Public Attributes

static const char * DEFAULT_VECTOR_METHOD_APPEND = "%VARNAME%.push_back(value);"
 
static const char * DEFAULT_VECTOR_METHOD_REMOVE = "int size = %VARNAME%.size();\nfor (int i = 0; i < size; ++i) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == value) {\n\t\tvector<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }"
 
static const char * DEFAULT_VECTOR_METHOD_INIT = " "
 
static const char * DEFAULT_OBJECT_METHOD_INIT = "%VARNAME% = new %ITEMCLASS%();"
 

Protected Member Functions

void init ()
 

Private Attributes

QString m_vectorMethodAppendBase
 
QString m_vectorMethodRemoveBase
 
QString m_vectorMethodInitBase
 
QString m_objectMethodInitBase
 

Constructor & Destructor Documentation

◆ CPPCodeGenerationPolicy()

CPPCodeGenerationPolicy::CPPCodeGenerationPolicy ( )

Constructor.

Here is the call graph for this function:

◆ ~CPPCodeGenerationPolicy()

CPPCodeGenerationPolicy::~CPPCodeGenerationPolicy ( )
virtual

Destructor.

Member Function Documentation

◆ createPage()

CodeGenerationPolicyPage * CPPCodeGenerationPolicy::createPage ( QWidget *  parent = 0,
const char *  name = 0 
)
virtual

Create a new dialog interface for this object.

Parameters
parentthe parent widget
namethe name of the page
Returns
dialog object

Implements CodeGenPolicyExt.

◆ getAccessorMethodsStartWithUpperCase()

bool CPPCodeGenerationPolicy::getAccessorMethodsStartWithUpperCase ( )
Here is the call graph for this function:

◆ getAccessorsAreInline()

bool CPPCodeGenerationPolicy::getAccessorsAreInline ( )

Get the value of m_inlineAccessors.

Returns
the boolean value of m_inlineAccessors
Here is the call graph for this function:

◆ getAccessorsArePublic()

bool CPPCodeGenerationPolicy::getAccessorsArePublic ( )

Get the value of m_publicAccessors

Returns
the boolean value of m_publicAccessors
Here is the call graph for this function:

◆ getAutoGenerateAccessors()

bool CPPCodeGenerationPolicy::getAutoGenerateAccessors ( )

Get the value of m_autoGenerateAccessors.

Returns
the boolean value of m_autoGenerateAccessors
Here is the call graph for this function:

◆ getClassMemberPrefix()

QString CPPCodeGenerationPolicy::getClassMemberPrefix ( )
Here is the call graph for this function:

◆ getDestructorsAreVirtual()

bool CPPCodeGenerationPolicy::getDestructorsAreVirtual ( )

Get the value of m_virtualDestructors.

Returns
the boolean value of m_virtualDestructors
Here is the call graph for this function:

◆ getDocToolTag()

QString CPPCodeGenerationPolicy::getDocToolTag ( )
Here is the call graph for this function:

◆ getGetterWithGetPrefix()

bool CPPCodeGenerationPolicy::getGetterWithGetPrefix ( )
Here is the call graph for this function:

◆ getObjectMethodInit()

QString CPPCodeGenerationPolicy::getObjectMethodInit ( const QString &  variableName = QString(),
const QString &  itemClassName = QString() 
)

Be somewhat flexible about how new object classes are initialized. Not sure if this should be user configureable. For now, it is not.

Parameters
variableNamevariable name
itemClassNameitem class name
Returns
object method init string
Here is the call graph for this function:

◆ getOperationsAreInline()

bool CPPCodeGenerationPolicy::getOperationsAreInline ( )

Get the value of m_inlineOperations.

Returns
the boolean value of m_inlineOperations
Here is the call graph for this function:

◆ getPackageIsNamespace()

bool CPPCodeGenerationPolicy::getPackageIsNamespace ( )

Get the value of m_packageIsNamespace.

Returns
the boolean value of m_packageIsNamespace
Here is the call graph for this function:

◆ getRemovePrefixFromAccessorMethods()

bool CPPCodeGenerationPolicy::getRemovePrefixFromAccessorMethods ( )
Here is the call graph for this function:

◆ getStringClassName()

QString CPPCodeGenerationPolicy::getStringClassName ( )
Here is the call graph for this function:

◆ getStringClassNameInclude()

QString CPPCodeGenerationPolicy::getStringClassNameInclude ( )
Here is the call graph for this function:

◆ getVectorClassName()

QString CPPCodeGenerationPolicy::getVectorClassName ( )
Here is the call graph for this function:

◆ getVectorClassNameInclude()

QString CPPCodeGenerationPolicy::getVectorClassNameInclude ( )
Here is the call graph for this function:

◆ getVectorMethodAppend()

QString CPPCodeGenerationPolicy::getVectorMethodAppend ( const QString &  variableName = QString(),
const QString &  itemClassName = QString() 
)

More flexible generation. We want to allow the user to specify how the bodies of the vector methods should be auto-generated.

Here is the call graph for this function:

◆ getVectorMethodInit()

QString CPPCodeGenerationPolicy::getVectorMethodInit ( const QString &  variableName = QString(),
const QString &  itemClassName = QString() 
)
Here is the call graph for this function:

◆ getVectorMethodRemove()

QString CPPCodeGenerationPolicy::getVectorMethodRemove ( const QString &  variableName = QString(),
const QString &  itemClassName = QString() 
)
Here is the call graph for this function:

◆ init()

void CPPCodeGenerationPolicy::init ( )
protected

Initialisation routine.

Here is the call graph for this function:

◆ setAccessorMethodsStartWithUpperCase()

void CPPCodeGenerationPolicy::setAccessorMethodsStartWithUpperCase ( bool  var)
Here is the call graph for this function:

◆ setAccessorsAreInline()

void CPPCodeGenerationPolicy::setAccessorsAreInline ( bool  var)

Set the value of m_inlineAccessors

Parameters
varthe new value
Here is the call graph for this function:

◆ setAccessorsArePublic()

void CPPCodeGenerationPolicy::setAccessorsArePublic ( bool  var)

Set the value of publicAccessors

Parameters
varthe new value
Here is the call graph for this function:

◆ setAutoGenerateAccessors()

void CPPCodeGenerationPolicy::setAutoGenerateAccessors ( bool  var)

Set the value of m_autoGenerateAccessors.

Parameters
varthe new value
Here is the call graph for this function:

◆ setClassMemberPrefix()

void CPPCodeGenerationPolicy::setClassMemberPrefix ( const QString &  value)
Here is the call graph for this function:

◆ setDefaults() [1/2]

void CPPCodeGenerationPolicy::setDefaults ( bool  emitUpdateSignal = true)
virtual

Set the defaults from a config file for this code generator from the passed KConfig pointer.

Parameters
emitUpdateSignalflag whether to emit update signal

Implements CodeGenPolicyExt.

Here is the call graph for this function:

◆ setDefaults() [2/2]

void CPPCodeGenerationPolicy::setDefaults ( CPPCodeGenerationPolicy cppclone,
bool  emitUpdateSignal = true 
)
virtual

Set the defaults for this code generator from the passed generator.

Parameters
cppclonecode generation policy object for cloning
emitUpdateSignalflag whether to emit update signal
Here is the call graph for this function:

◆ setDestructorsAreVirtual()

void CPPCodeGenerationPolicy::setDestructorsAreVirtual ( bool  var)

Set the value of m_virtualDestructors.

Parameters
varthe new value
Here is the call graph for this function:

◆ setDocToolTag()

void CPPCodeGenerationPolicy::setDocToolTag ( const QString &  value)
Here is the call graph for this function:

◆ setGetterWithGetPrefix()

void CPPCodeGenerationPolicy::setGetterWithGetPrefix ( bool  var)
Here is the call graph for this function:

◆ setOperationsAreInline()

void CPPCodeGenerationPolicy::setOperationsAreInline ( bool  var)

Set the value of m_inlineOperations.

Parameters
varthe new value
Here is the call graph for this function:

◆ setPackageIsNamespace()

void CPPCodeGenerationPolicy::setPackageIsNamespace ( bool  var)

Set the value of m_packageIsNamespace.

Parameters
varthe new value
Here is the call graph for this function:

◆ setRemovePrefixFromAccessorMethods()

void CPPCodeGenerationPolicy::setRemovePrefixFromAccessorMethods ( bool  var)
Here is the call graph for this function:

◆ setStringClassName()

void CPPCodeGenerationPolicy::setStringClassName ( const QString &  value)

We want to be flexible about which classes are allowed for generation of the CPP code. In the next 4 method pairs, we give accessors that allow setting and getting the names of the classes, and their include files for string and vectors.

Here is the call graph for this function:

◆ setStringClassNameInclude()

void CPPCodeGenerationPolicy::setStringClassNameInclude ( const QString &  value)
Here is the call graph for this function:

◆ setStringIncludeIsGlobal()

void CPPCodeGenerationPolicy::setStringIncludeIsGlobal ( bool  value)

Set flag whether string include is global.

Parameters
valuethe value of the flag
Here is the call graph for this function:

◆ setVectorClassName()

void CPPCodeGenerationPolicy::setVectorClassName ( const QString &  value)
Here is the call graph for this function:

◆ setVectorClassNameInclude()

void CPPCodeGenerationPolicy::setVectorClassNameInclude ( const QString &  value)
Here is the call graph for this function:

◆ setVectorIncludeIsGlobal()

void CPPCodeGenerationPolicy::setVectorIncludeIsGlobal ( bool  value)

Set flag whether vector include is global.

Parameters
valuethe value of the flag
Here is the call graph for this function:

◆ stringIncludeIsGlobal()

bool CPPCodeGenerationPolicy::stringIncludeIsGlobal ( )

Determine if the string include is global.

Returns
value of flag
Here is the call graph for this function:

◆ vectorIncludeIsGlobal()

bool CPPCodeGenerationPolicy::vectorIncludeIsGlobal ( )

Determine if the vector include is global.

Returns
value of flag
Here is the call graph for this function:

Member Data Documentation

◆ DEFAULT_OBJECT_METHOD_INIT

const char * CPPCodeGenerationPolicy::DEFAULT_OBJECT_METHOD_INIT = "%VARNAME% = new %ITEMCLASS%();"
static

◆ DEFAULT_VECTOR_METHOD_APPEND

const char * CPPCodeGenerationPolicy::DEFAULT_VECTOR_METHOD_APPEND = "%VARNAME%.push_back(value);"
static

◆ DEFAULT_VECTOR_METHOD_INIT

const char * CPPCodeGenerationPolicy::DEFAULT_VECTOR_METHOD_INIT = " "
static

◆ DEFAULT_VECTOR_METHOD_REMOVE

const char * CPPCodeGenerationPolicy::DEFAULT_VECTOR_METHOD_REMOVE = "int size = %VARNAME%.size();\nfor (int i = 0; i < size; ++i) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == value) {\n\t\tvector<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }"
static

◆ m_objectMethodInitBase

QString CPPCodeGenerationPolicy::m_objectMethodInitBase
private

◆ m_vectorMethodAppendBase

QString CPPCodeGenerationPolicy::m_vectorMethodAppendBase
private

◆ m_vectorMethodInitBase

QString CPPCodeGenerationPolicy::m_vectorMethodInitBase
private

◆ m_vectorMethodRemoveBase

QString CPPCodeGenerationPolicy::m_vectorMethodRemoveBase
private

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