umbrello: CPPCodeGenerationPolicy Class Reference

umbrello 2.38.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:

## 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)
CodeGenerationPolicyPage * | createPage (QWidget *parent=0, const char *name=0)
Public Member Functions inherited from CodeGenPolicyExt
| CodeGenPolicyExt ()
virtual | ~CodeGenPolicyExt ()
virtual CodeGenerationPolicyPage * | createPage (QWidget *parent=0, const char *name=0)=0
virtual void | setDefaults (bool emitUpdateSignal=true)=0

## 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.

## ◆ ~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

  parent | the parent widget
  name | the name of the page

Returns
  dialog object

Implements CodeGenPolicyExt.

## ◆ getAccessorMethodsStartWithUpperCase()

bool CPPCodeGenerationPolicy::getAccessorMethodsStartWithUpperCase | ( |  | ) |

## ◆ getAccessorsAreInline()

bool CPPCodeGenerationPolicy::getAccessorsAreInline | ( |  | ) |

Get the value of m_inlineAccessors.

Returns
  the boolean value of m_inlineAccessors

## ◆ getAccessorsArePublic()

bool CPPCodeGenerationPolicy::getAccessorsArePublic | ( |  | ) |

Get the value of m_publicAccessors

Returns
  the boolean value of m_publicAccessors

## ◆ getAutoGenerateAccessors()

bool CPPCodeGenerationPolicy::getAutoGenerateAccessors | ( |  | ) |

Get the value of m_autoGenerateAccessors.

Returns
  the boolean value of m_autoGenerateAccessors

## ◆ getClassMemberPrefix()

QString CPPCodeGenerationPolicy::getClassMemberPrefix | ( |  | ) |

## ◆ getDestructorsAreVirtual()

bool CPPCodeGenerationPolicy::getDestructorsAreVirtual | ( |  | ) |

Get the value of m_virtualDestructors.

Returns
  the boolean value of m_virtualDestructors

## ◆ getDocToolTag()

QString CPPCodeGenerationPolicy::getDocToolTag | ( |  | ) |

## ◆ getGetterWithGetPrefix()

bool CPPCodeGenerationPolicy::getGetterWithGetPrefix | ( |  | ) |

## ◆ 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

  variableName | variable name
  itemClassName | item class name

Returns
  object method init string

## ◆ getOperationsAreInline()

bool CPPCodeGenerationPolicy::getOperationsAreInline | ( |  | ) |

Get the value of m_inlineOperations.

Returns
  the boolean value of m_inlineOperations

## ◆ getPackageIsNamespace()

bool CPPCodeGenerationPolicy::getPackageIsNamespace | ( |  | ) |

Get the value of m_packageIsNamespace.

Returns
  the boolean value of m_packageIsNamespace

## ◆ getRemovePrefixFromAccessorMethods()

bool CPPCodeGenerationPolicy::getRemovePrefixFromAccessorMethods | ( |  | ) |

## ◆ getStringClassName()

QString CPPCodeGenerationPolicy::getStringClassName | ( |  | ) |

## ◆ getStringClassNameInclude()

QString CPPCodeGenerationPolicy::getStringClassNameInclude | ( |  | ) |

## ◆ getVectorClassName()

QString CPPCodeGenerationPolicy::getVectorClassName | ( |  | ) |

## ◆ getVectorClassNameInclude()

QString CPPCodeGenerationPolicy::getVectorClassNameInclude | ( |  | ) |

## ◆ 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.

## ◆ getVectorMethodInit()

QString CPPCodeGenerationPolicy::getVectorMethodInit | ( | const QString & | variableName = `QString()`,
|  | const QString & | itemClassName = `QString()`
| ) |  |

## ◆ getVectorMethodRemove()

QString CPPCodeGenerationPolicy::getVectorMethodRemove | ( | const QString & | variableName = `QString()`,
|  | const QString & | itemClassName = `QString()`
| ) |  |

## ◆ init()

void CPPCodeGenerationPolicy::init | ( |  | ) |
| protected

Initialisation routine.

## ◆ setAccessorMethodsStartWithUpperCase()

void CPPCodeGenerationPolicy::setAccessorMethodsStartWithUpperCase | ( | bool | var | ) |

## ◆ setAccessorsAreInline()

void CPPCodeGenerationPolicy::setAccessorsAreInline | ( | bool | var | ) |

Set the value of m_inlineAccessors

Parameters

  var | the new value

## ◆ setAccessorsArePublic()

void CPPCodeGenerationPolicy::setAccessorsArePublic | ( | bool | var | ) |

Set the value of publicAccessors

Parameters

  var | the new value

## ◆ setAutoGenerateAccessors()

void CPPCodeGenerationPolicy::setAutoGenerateAccessors | ( | bool | var | ) |

Set the value of m_autoGenerateAccessors.

Parameters

  var | the new value

## ◆ setClassMemberPrefix()

void CPPCodeGenerationPolicy::setClassMemberPrefix | ( | const QString & | value | ) |

## ◆ 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

  emitUpdateSignal | flag whether to emit update signal

Implements CodeGenPolicyExt.

## ◆ setDefaults() [2/2]

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

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

Parameters

  cppclone | code generation policy object for cloning
  emitUpdateSignal | flag whether to emit update signal

## ◆ setDestructorsAreVirtual()

void CPPCodeGenerationPolicy::setDestructorsAreVirtual | ( | bool | var | ) |

Set the value of m_virtualDestructors.

Parameters

  var | the new value

## ◆ setDocToolTag()

void CPPCodeGenerationPolicy::setDocToolTag | ( | const QString & | value | ) |

## ◆ setGetterWithGetPrefix()

void CPPCodeGenerationPolicy::setGetterWithGetPrefix | ( | bool | var | ) |

## ◆ setOperationsAreInline()

void CPPCodeGenerationPolicy::setOperationsAreInline | ( | bool | var | ) |

Set the value of m_inlineOperations.

Parameters

  var | the new value

## ◆ setPackageIsNamespace()

void CPPCodeGenerationPolicy::setPackageIsNamespace | ( | bool | var | ) |

Set the value of m_packageIsNamespace.

Parameters

  var | the new value

## ◆ setRemovePrefixFromAccessorMethods()

void CPPCodeGenerationPolicy::setRemovePrefixFromAccessorMethods | ( | bool | var | ) |

## ◆ 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.

## ◆ setStringClassNameInclude()

void CPPCodeGenerationPolicy::setStringClassNameInclude | ( | const QString & | value | ) |

## ◆ setStringIncludeIsGlobal()

void CPPCodeGenerationPolicy::setStringIncludeIsGlobal | ( | bool | value | ) |

Set flag whether string include is global.

Parameters

  value | the value of the flag

## ◆ setVectorClassName()

void CPPCodeGenerationPolicy::setVectorClassName | ( | const QString & | value | ) |

## ◆ setVectorClassNameInclude()

void CPPCodeGenerationPolicy::setVectorClassNameInclude | ( | const QString & | value | ) |

## ◆ setVectorIncludeIsGlobal()

void CPPCodeGenerationPolicy::setVectorIncludeIsGlobal | ( | bool | value | ) |

Set flag whether vector include is global.

Parameters

  value | the value of the flag

## ◆ stringIncludeIsGlobal()

bool CPPCodeGenerationPolicy::stringIncludeIsGlobal | ( |  | ) |

Determine if the string include is global.

Returns
  value of flag

## ◆ vectorIncludeIsGlobal()

bool CPPCodeGenerationPolicy::vectorIncludeIsGlobal | ( |  | ) |

Determine if the vector include is global.

Returns
  value of flag

## 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:

- umbrello/codegenerators/cpp/cppcodegenerationpolicy.h
- umbrello/codegenerators/cpp/cppcodegenerationpolicy.cpp