Commit 6add3313 authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Apply naming convention to types

Use Pascal style for typedefs and class instead of struct.

Change-Id: Ib568994e70c8ac0a219b2fba1d998e04ef5f79da
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent d13b22e6
......@@ -45,8 +45,9 @@
namespace qmt {
struct ConfigController::ConfigControllerPrivate
class ConfigController::ConfigControllerPrivate
{
public:
ConfigControllerPrivate()
: m_stereotypeController(0)
{
......
......@@ -45,7 +45,7 @@ class QMT_EXPORT ConfigController : public QObject
{
Q_OBJECT
struct ConfigControllerPrivate;
class ConfigControllerPrivate;
public:
......
......@@ -107,8 +107,9 @@ StereotypeDefinitionParserError::~StereotypeDefinitionParserError()
}
struct StereotypeDefinitionParser::StereotypeDefinitionParserPrivate
class StereotypeDefinitionParser::StereotypeDefinitionParserPrivate
{
public:
StereotypeDefinitionParserPrivate()
: m_scanner(0)
{
......@@ -119,8 +120,9 @@ struct StereotypeDefinitionParser::StereotypeDefinitionParserPrivate
};
struct StereotypeDefinitionParser::IconCommandParameter
class StereotypeDefinitionParser::IconCommandParameter
{
public:
IconCommandParameter(ShapeValueF::Unit unit, ShapeValueF::Origin origin = ShapeValueF::OriginSmart)
: m_unit(unit),
m_origin(origin)
......
......@@ -67,9 +67,9 @@ class QMT_EXPORT StereotypeDefinitionParser : public QObject
{
Q_OBJECT
struct StereotypeDefinitionParserPrivate;
class StereotypeDefinitionParserPrivate;
struct IconCommandParameter;
class IconCommandParameter;
public:
......
......@@ -54,7 +54,9 @@ TextScannerError::~TextScannerError()
{
}
struct TextScanner::TextScannerPrivate {
class TextScanner::TextScannerPrivate
{
public:
TextScannerPrivate()
: m_maxOperatorLength(0),
m_source(0)
......
......@@ -40,7 +40,7 @@
namespace qmt {
class ITextSource;
struct SourceChar;
class SourceChar;
class Token;
class QMT_EXPORT TextScannerError :
......@@ -65,7 +65,7 @@ class QMT_EXPORT TextScanner : public QObject
{
Q_OBJECT
struct TextScannerPrivate;
class TextScannerPrivate;
public:
explicit TextScanner(QObject *parent = 0);
......
......@@ -38,7 +38,9 @@
namespace qmt {
struct SourceChar {
class SourceChar
{
public:
SourceChar() { }
SourceChar(QChar chr, const SourcePos &sourcePos)
: ch(chr),
......
......@@ -54,7 +54,9 @@
namespace qmt {
struct DiagramController::Clone {
class DiagramController::Clone
{
public:
Clone();
Uid m_elementKey;
int m_indexOfElement;
......
......@@ -71,7 +71,7 @@ public:
private:
struct Clone;
class Clone;
class DiagramUndoCommand;
class UpdateElementCommand;
......
......@@ -56,7 +56,9 @@ public:
Vcenter
};
struct Latch {
class Latch
{
public:
Latch()
: m_latchType(None),
m_pos(0.0),
......
......@@ -64,7 +64,9 @@ static const qreal MINIMUM_AUTO_WIDTH = 100.0;
static const qreal MINIMUM_AUTO_HEIGHT = 70.0;
struct PackageItem::ShapeGeometry {
class PackageItem::ShapeGeometry
{
public:
ShapeGeometry(const QSizeF &minimumSize, const QSizeF &minimumTabSize)
: m_minimumSize(minimumSize),
m_minimumTabSize(minimumTabSize)
......
......@@ -55,7 +55,7 @@ class PackageItem :
public ObjectItem,
public IRelationable
{
struct ShapeGeometry;
class ShapeGeometry;
public:
PackageItem(DPackage *package, DiagramSceneModel *diagramSceneModel, QGraphicsItem *parent = 0);
......
......@@ -81,7 +81,9 @@ bool GeometryUtilities::intersect(const QPolygonF &polygon, const QLineF &line,
namespace {
struct Candidate {
class Candidate
{
public:
Candidate() : third(GeometryUtilities::SideUnspecified) { }
Candidate(const QVector2D &f, const QPointF &s, GeometryUtilities::Side t) : first(f), second(s), third(t) { }
......
......@@ -45,11 +45,11 @@ class Handles
{
public:
typedef QList<Handle<T> > type;
typedef QList<Handle<T> > value_type;
typedef typename type::iterator iterator;
typedef typename value_type::iterator iterator;
typedef typename type::const_iterator const_iterator;
typedef typename value_type::const_iterator const_iterator;
public:
......@@ -154,16 +154,16 @@ public:
public:
const type &get() const { return m_handleList; }
const value_type &get() const { return m_handleList; }
type take()
value_type take()
{
type handles = m_handleList;
value_type handles = m_handleList;
m_handleList.clear();
return handles;
}
void set(const type &handles) {
void set(const value_type &handles) {
reset();
m_handleList = handles;
}
......@@ -259,7 +259,7 @@ public:
private:
type m_handleList;
value_type m_handleList;
bool m_takeOwnership;
};
......
......@@ -47,7 +47,9 @@
namespace qmt {
struct ModelController::Clone {
class ModelController::Clone
{
public:
Clone();
ElementType m_elementType;
......@@ -379,7 +381,7 @@ public:
void add(MElement *element, MObject *owner)
{
struct Clone clone;
ModelController::Clone clone;
clone.m_elementKey = element->uid();
clone.m_ownerKey = owner->uid();
......
......@@ -65,7 +65,7 @@ class QMT_EXPORT ModelController :
TypeObject,
TypeRelation };
struct Clone;
class Clone;
class UpdateObjectCommand;
class UpdateRelationCommand;
......
......@@ -301,7 +301,9 @@ QString ClassMembersEdit::Cursor::preparse(const QString &text)
}
struct ClassMembersEdit::ClassMembersEditPrivate {
class ClassMembersEdit::ClassMembersEditPrivate
{
public:
ClassMembersEditPrivate()
: m_valid(true)
{
......
......@@ -44,7 +44,7 @@ class QMT_EXPORT ClassMembersEdit :
Q_OBJECT
class Cursor;
struct ClassMembersEditPrivate;
class ClassMembersEditPrivate;
public:
......
......@@ -51,7 +51,9 @@ QList<T *> CloneAll(const QList<T *> &rhs)
namespace qmt {
struct IconShape::IconShapePrivate {
class IconShape::IconShapePrivate
{
public:
IconShapePrivate()
{
}
......
......@@ -44,7 +44,7 @@ class ShapeConstVisitor;
class QMT_EXPORT IconShape
{
struct IconShapePrivate;
class IconShapePrivate;
public:
......
......@@ -294,7 +294,9 @@ public:
TypeClose
};
struct Element {
class Element
{
public:
explicit Element(ElementType element = TypeNone)
: m_elementType(element),
m_angle1(0.0),
......
......@@ -46,8 +46,9 @@
namespace qmt {
struct StereotypeController::StereotypeControllerPrivate
class StereotypeController::StereotypeControllerPrivate
{
public:
StereotypeControllerPrivate()
{
}
......
......@@ -48,7 +48,7 @@ class QMT_EXPORT StereotypeController :
{
Q_OBJECT
struct StereotypeControllerPrivate;
class StereotypeControllerPrivate;
public:
explicit StereotypeController(QObject *parent = 0);
......
......@@ -48,7 +48,9 @@ public:
TooltypeSeparator
};
struct Tool {
class Tool
{
public:
Tool()
: m_toolType(TooltypeSeparator)
{
......
......@@ -49,7 +49,9 @@ namespace qmt {
// TODO use tuple instead of these 4 explicit key classes
struct ObjectStyleKey {
class ObjectStyleKey
{
public:
ObjectStyleKey()
: m_elementType(StyleEngine::TypeOther)
{
......@@ -76,7 +78,9 @@ bool operator==(const ObjectStyleKey &lhs, const ObjectStyleKey &rhs)
}
struct RelationStyleKey {
class RelationStyleKey
{
public:
RelationStyleKey(StyleEngine::ElementType elementType = StyleEngine::TypeOther,
DObject::VisualPrimaryRole visualPrimaryRole = DObject::PrimaryRoleNormal)
: m_elementType(elementType),
......@@ -98,7 +102,9 @@ bool operator==(const RelationStyleKey &lhs, const RelationStyleKey &rhs)
}
struct AnnotationStyleKey {
class AnnotationStyleKey
{
public:
AnnotationStyleKey(DAnnotation::VisualRole visualRole = DAnnotation::RoleNormal)
: m_visualRole(visualRole)
{
......@@ -117,7 +123,9 @@ bool operator==(const AnnotationStyleKey &lhs, const AnnotationStyleKey &rhs)
}
struct BoundaryStyleKey {
class BoundaryStyleKey
{
public:
BoundaryStyleKey()
{
}
......@@ -229,7 +237,9 @@ const Style *DefaultStyleEngine::applyObjectStyle(const Style *baseStyle, const
{
ElementType elementType = objectType(styledObject.object());
struct DepthProperties {
class DepthProperties
{
public:
DepthProperties()
: m_elementType(TypeOther),
m_visualPrimaryRole(DObject::PrimaryRoleNormal),
......
......@@ -45,10 +45,10 @@ QT_END_NAMESPACE
namespace qmt {
struct ObjectStyleKey;
struct RelationStyleKey;
struct AnnotationStyleKey;
struct BoundaryStyleKey;
class ObjectStyleKey;
class RelationStyleKey;
class AnnotationStyleKey;
class BoundaryStyleKey;
class QMT_EXPORT DefaultStyleEngine :
......
......@@ -84,7 +84,7 @@ public:
}
private:
Flag::maskType m_flags;
Flag::MaskType m_flags;
QHash<QString, QVariant> m_userData;
};
......
......@@ -35,15 +35,15 @@ namespace qark {
class Flag {
public:
typedef unsigned int maskType;
typedef unsigned int MaskType;
explicit Flag() : m_mask(m_nextMask) { m_nextMask *= 2; }
maskType mask() const { return m_mask; }
MaskType mask() const { return m_mask; }
private:
static maskType m_nextMask;
maskType m_mask;
static MaskType m_nextMask;
MaskType m_mask;
};
}
......
......@@ -61,13 +61,13 @@ public:
private:
typedef ObjectId keyType;
typedef void * valueType;
typedef QMap<keyType, valueType> mapType;
typedef ObjectId KeyType;
typedef void *ValueType;
typedef QMap<KeyType, ValueType> MapType;
private:
mapType m_references;
MapType m_references;
};
}
......
......@@ -82,13 +82,13 @@ private:
private:
typedef QPair<const void *, const char *> keyType;
typedef QPair<ObjectId, bool> valueType;
typedef QMap<keyType, valueType> mapType;
typedef QPair<const void *, const char *> KeyType;
typedef QPair<ObjectId, bool> ValueType;
typedef QMap<KeyType, ValueType> MapType;
private:
mapType m_references;
MapType m_references;
ObjectId m_nextRef;
};
......
......@@ -62,7 +62,7 @@ public:
private:
Flag::maskType m_flags;
Flag::MaskType m_flags;
};
}
......
......@@ -68,16 +68,16 @@ public:
private:
struct XmlTag;
class XmlTag;
class Node {
public:
typedef QList<Node *> childrenType;
typedef QList<Node *> ChildrenType;
public:
virtual ~Node() { qDeleteAll(m_children); }
const childrenType &children() const { return m_children; }
const ChildrenType &children() const { return m_children; }
virtual QString qualifiedName() const = 0;
......@@ -86,7 +86,7 @@ private:
void append(Node *node) { m_children.append(node); }
private:
childrenType m_children;
ChildrenType m_children;
};
class TagNode :
......@@ -517,7 +517,9 @@ public:
Instance
};
struct ReferenceTag {
class ReferenceTag
{
public:
explicit ReferenceTag(ReferenceKind k = Nullpointer, const QString &string = QLatin1String("")) : kind(k), typeName(string) { }
ReferenceKind kind;
......@@ -568,7 +570,9 @@ public:
private:
struct XmlTag {
class XmlTag
{
public:
XmlTag() : m_endTag(false) { }
QString m_tagName;
bool m_endTag;
......@@ -586,7 +590,7 @@ private:
return;
} else {
bool foundTag = false;
for (Node::childrenType::const_iterator it = node->children().begin(); it != node->children().end(); ++it) {
for (Node::ChildrenType::const_iterator it = node->children().begin(); it != node->children().end(); ++it) {
if ((*it)->qualifiedName() == xmlTag.m_tagName) {
foundTag = true;
(*it)->accept(*this, xmlTag);
......
......@@ -50,9 +50,9 @@ inline void save(Archive &archive, T *p, const Parameters &)
archive.endInstance();
} else {
archive.beginInstance(typeUid(*p));
typename registry::TypeRegistry<Archive, T>::typeInfo typeData = typeInfo<Archive, T>(*p);
typename registry::TypeRegistry<Archive, T>::TypeInfo typeData = typeInfo<Archive, T>(*p);
if (typeData.m_saveFunc == 0) {
throw unregisteredType();
throw UnregisteredType();
} else {
typeData.m_saveFunc(archive, p);
}
......@@ -80,9 +80,9 @@ void load(Archive &archive, T *&p, const Parameters &)
if (refTag.typeName.isEmpty()) {
registry::loadNonVirtualPointer<Archive,T>(archive, p);
} else {
typename registry::TypeRegistry<Archive, T>::typeInfo typeData = typeInfo<Archive, T>(refTag.typeName);
typename registry::TypeRegistry<Archive, T>::TypeInfo typeData = typeInfo<Archive, T>(refTag.typeName);
if (typeData.m_loadFunc == 0) {
throw unregisteredType();
throw UnregisteredType();
} else {
typeData.m_loadFunc(archive, p);
}
......
......@@ -45,12 +45,12 @@
namespace qark {
class unregisteredType :
class UnregisteredType :
public std::exception
{
};
class abstractType :
class AbstractType :
public std::exception
{
};
......@@ -63,13 +63,13 @@ template<int N>
class TypeNameMaps {
public:
typedef QHash<QString, QString> mapType;
typedef QHash<QString, QString> MapType;
public:
static mapType &nameToUidMap() { return *typeidNameToUidMap; }
static MapType &nameToUidMap() { return *typeidNameToUidMap; }
static mapType &uidToNameMap() { return *typeidUidToNameMap; }
static MapType &uidToNameMap() { return *typeidUidToNameMap; }
#if !defined(QT_NO_DEBUG)
static bool hasNameToUidMap() { return typeidNameToUidMap != 0; }
......@@ -82,8 +82,8 @@ protected:
static void init()
{
static bool initialized = false;
static mapType nameToUidMap;
static mapType uidToNameMap;
static MapType nameToUidMap;
static MapType uidToNameMap;
if (!initialized) {
typeidNameToUidMap = &nameToUidMap;
......@@ -94,16 +94,16 @@ protected:
private:
static mapType *typeidNameToUidMap;
static MapType *typeidNameToUidMap;
static mapType *typeidUidToNameMap;
static MapType *typeidUidToNameMap;
};
template<int N>
typename TypeNameMaps<N>::mapType *TypeNameMaps<N>::typeidNameToUidMap;
typename TypeNameMaps<N>::MapType *TypeNameMaps<N>::typeidNameToUidMap;
template<int N>
typename TypeNameMaps<N>::mapType *TypeNameMaps<N>::typeidUidToNameMap;
typename TypeNameMaps<N>::MapType *TypeNameMaps<N>::typeidUidToNameMap;
template<class T>
......@@ -111,7 +111,7 @@ class TypeNameRegistry :
public TypeNameMaps<0>
{
typedef TypeNameMaps<0> base;
typedef TypeNameMaps<0> Base;
private:
......@@ -120,11 +120,11 @@ private:
private:
static int __init(const QString &name)
{
base::init();
QMT_CHECK(!base::nameToUidMap().contains(QLatin1String(typeid(T).name())) || base::nameToUidMap().value(QLatin1String(typeid(T).name())) == name);
QMT_CHECK(!base::uidToNameMap().contains(name) || base::uidToNameMap().value(name) == QLatin1String(typeid(T).name()));
base::nameToUidMap().insert(QLatin1String(typeid(T).name()), name);
base::uidToNameMap().insert(name, QLatin1String(typeid(T).name()));
Base::init();
QMT_CHECK(!Base::nameToUidMap().contains(QLatin1String(typeid(T).name())) || Base::nameToUidMap().value(QLatin1String(typeid(T).name())) == name);
QMT_CHECK(!Base::uidToNameMap().contains(name) || Base::uidToNameMap().value(name) == QLatin1String(typeid(T).name()));
Base::nameToUidMap().insert(QLatin1String(typeid(T).name()), name);
Base::uidToNameMap().insert(name, QLatin1String(typeid(T).name()));
return 0;
}
};
......@@ -135,37 +135,39 @@ template<class Archive, class BASE>
class TypeRegistry {
public:
struct typeInfo {
class TypeInfo
{
public:
typedef Archive &(*saveFuncType)(Archive &, BASE * const &p);