summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodestylesettings.h
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-02-03 15:48:14 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2011-05-24 12:45:07 +0200
commit779fafcbfe6f92dd1288664fae512f69bc12418b (patch)
tree38a3b75cc3a18f386ab72102e97f06ffa24d4d29 /src/plugins/cpptools/cppcodestylesettings.h
parentf69eb52944a7fc8306cbb72b7325a610045dea7a (diff)
downloadqt-creator-779fafcbfe6f92dd1288664fae512f69bc12418b.tar.gz
Make C++ code style configurable.
Change-Id: Iaf08edb2361146e6b5e1cbafdb716a23c938875b Done-with: Jarek Kobus Task-number: QTCREATORBUG-2670 Task-number: QTCREATORBUG-4310 Task-number: QTCREATORBUG-2763 Task-number: QTCREATORBUG-3623 Task-number: QTCREATORBUG-567 Reviewed-on: http://codereview.qt.nokia.com/74 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodestylesettings.h')
-rw-r--r--src/plugins/cpptools/cppcodestylesettings.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodestylesettings.h b/src/plugins/cpptools/cppcodestylesettings.h
new file mode 100644
index 0000000000..20651ed11c
--- /dev/null
+++ b/src/plugins/cpptools/cppcodestylesettings.h
@@ -0,0 +1,67 @@
+#ifndef CPPCODESTYLESETTINGS_H
+#define CPPCODESTYLESETTINGS_H
+
+#include "cpptools_global.h"
+
+#include <QtCore/QMetaType>
+#include <QtCore/QVariant>
+
+QT_BEGIN_NAMESPACE
+class QSettings;
+QT_END_NAMESPACE
+
+namespace CppTools {
+
+struct CPPTOOLS_EXPORT CppCodeStyleSettings
+{
+ CppCodeStyleSettings();
+
+ bool indentBlockBraces;
+ bool indentBlockBody;
+ bool indentClassBraces;
+ bool indentEnumBraces;
+ bool indentNamespaceBraces;
+ bool indentNamespaceBody;
+ bool indentAccessSpecifiers;
+ bool indentDeclarationsRelativeToAccessSpecifiers;
+ bool indentFunctionBody;
+ bool indentFunctionBraces;
+ bool indentSwitchLabels;
+ bool indentStatementsRelativeToSwitchLabels;
+ bool indentBlocksRelativeToSwitchLabels;
+ bool indentControlFlowRelativeToSwitchLabels;
+
+ // false: if (a &&
+ // b)
+ // c;
+ // true: if (a &&
+ // b)
+ // c;
+ // but always: while (a &&
+ // b)
+ // foo;
+ bool extraPaddingForConditionsIfConfusingAlign;
+
+ // false: a = a +
+ // b;
+ // true: a = a +
+ // b
+ bool alignAssignments;
+
+ void toSettings(const QString &category, QSettings *s) const;
+ void fromSettings(const QString &category, const QSettings *s);
+
+ void toMap(const QString &prefix, QVariantMap *map) const;
+ void fromMap(const QString &prefix, const QVariantMap &map);
+
+ bool equals(const CppCodeStyleSettings &rhs) const;
+};
+
+inline bool operator==(const CppCodeStyleSettings &s1, const CppCodeStyleSettings &s2) { return s1.equals(s2); }
+inline bool operator!=(const CppCodeStyleSettings &s1, const CppCodeStyleSettings &s2) { return !s1.equals(s2); }
+
+} // namespace CppTools
+
+Q_DECLARE_METATYPE(CppTools::CppCodeStyleSettings)
+
+#endif // CPPCODESTYLESETTINGS_H