fix formating

This commit is contained in:
arcan1s 2015-10-08 01:14:30 +03:00
parent f1e6f74c7d
commit 6f86e8ec5e

View File

@ -25,11 +25,13 @@ for more details. Some additional detail see below.
* Any header should have [include guard](https://en.wikipedia.org/wiki/Include_guard) * Any header should have [include guard](https://en.wikipedia.org/wiki/Include_guard)
named as `CLASSNAMECAPS_H` named as `CLASSNAMECAPS_H`
* If any `#if` directive is used condition should be mentioned in `#endif`: * If any `#if` directive is used condition should be mentioned in `#endif`:
``` ```
#if (FOO) #if (FOO)
someCodeInside(); someCodeInside();
#endif /* FOO */ #endif /* FOO */
``` ```
* `Q_PROPERTY` macro is allowed and recommended for QObject based classes. * `Q_PROPERTY` macro is allowed and recommended for QObject based classes.
* Qt macros (e.g. `signals`, `slots`, `Q_OBJECT`, etc) are allowed. * Qt macros (e.g. `signals`, `slots`, `Q_OBJECT`, etc) are allowed.
* Current project standard is **C++11**. * Current project standard is **C++11**.
@ -40,11 +42,13 @@ for more details. Some additional detail see below.
of `reinterpret_cast` is not recommended. It is highly recommended to use of `reinterpret_cast` is not recommended. It is highly recommended to use
`dynamic_Cast` with the exception catching. It is also possible to use `dynamic_Cast` with the exception catching. It is also possible to use
`qvariant_cast` if required. Exception is class constructors, e.g.: `qvariant_cast` if required. Exception is class constructors, e.g.:
``` ```
char c = 'c'; char c = 'c';
std::string s = "string"; std::string s = "string";
qDebug() << QString("some string") << QChar(c) << QString(s); qDebug() << QString("some string") << QChar(c) << QString(s);
``` ```
* C-like `NULL`, use `nullptr` instead. * C-like `NULL`, use `nullptr` instead.
* It is highly recommended to avoid implicit casts. * It is highly recommended to avoid implicit casts.
* Abstract classes (which has at least one pure virtual method) are allowed. * Abstract classes (which has at least one pure virtual method) are allowed.
@ -103,11 +107,13 @@ Development
* For experimental features development new branch `feature-foo` creation is allowed * For experimental features development new branch `feature-foo` creation is allowed
and recommended. and recommended.
* Experimental features should be added inside `BUILD_FUTURE` definition: * Experimental features should be added inside `BUILD_FUTURE` definition:
``` ```
#ifdef BUILD_FUTURE #ifdef BUILD_FUTURE
someTestFunctionInside(); someTestFunctionInside();
#endif /* BUILD_FUTURE */ #endif /* BUILD_FUTURE */
``` ```
* Any project specific build variable should be mentioned inside `version.h` as * Any project specific build variable should be mentioned inside `version.h` as
well. well.
@ -152,48 +158,53 @@ Tools
* For QString concatenation use `QString::arg` method. * For QString concatenation use `QString::arg` method.
* Any source file should have license header: * Any source file should have license header:
``` ```
/*************************************************************************** /***************************************************************************
* This file is part of awesome-widgets * * This file is part of awesome-widgets *
* * * *
* awesome-widgets is free software: you can redistribute it and/or * * awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the * * published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. * * License, or (at your option) any later version. *
* * * *
* awesome-widgets is distributed in the hope that it will be useful, * * awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ * * along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/ ***************************************************************************/
``` ```
* Recommended class constructor for QObject based classes: * Recommended class constructor for QObject based classes:
``` ```
FooClass::FooClass(QObject *parent, const QVariant var) FooClass::FooClass(QObject *parent, const QVariant var)
: QObject(parent), : QObject(parent),
m_var(var) m_var(var)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
// some code below if any // some code below if any
} }
``` ```
* Property usage: * Property usage:
``` ```
Q_PROPERTY(bool prop READ prop WRITE setProp); Q_PROPERTY(bool prop READ prop WRITE setProp);
public: public:
bool prop() const bool prop() const
{ {
return m_prop; return m_prop;
}; };
void setProp(const bool _prop) void setProp(const bool _prop)
{ {
// error checking if required // error checking if required
m_prop = _prop m_prop = _prop
} }
private: private:
// declare with default value // declare with default value
bool m_prop = false; bool m_prop = false;
``` ```