[niepce] Some code formatting.



commit 762addf5fc58d7dcb87cfc60ad4c0c91389f0e03
Author: Hubert Figuière <hub figuiere net>
Date:   Fri Jun 19 23:17:28 2015 -0400

    Some code formatting.

 .clang-format                            |   57 ++++++++++++++++++++++++++++++
 doc/style-guide                          |    4 ++-
 src/libraryclient/locallibraryserver.cpp |   13 +++----
 src/libraryclient/locallibraryserver.hpp |   42 +++++++++-------------
 4 files changed, 82 insertions(+), 34 deletions(-)
---
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..6e178a8
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,57 @@
+---
+Language:        Cpp
+# BasedOnStyle:  Mozilla
+AccessModifierOffset: -4
+ConstructorInitializerIndentWidth: 4
+AlignEscapedNewlinesLeft: false
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Inline
+AlwaysBreakTemplateDeclarations: true
+AlwaysBreakBeforeMultilineStrings: false
+BreakBeforeBinaryOperators: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: true
+BinPackParameters: true
+ColumnLimit:     80
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+DerivePointerAlignment: true
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: false
+IndentWrappedFunctionNames: false
+IndentFunctionDeclarationAfterType: false
+MaxEmptyLinesToKeep: 1
+KeepEmptyLinesAtTheStartOfBlocks: true
+NamespaceIndentation: None
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakString: 1000
+PenaltyBreakFirstLessLess: 120
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Left
+SpacesBeforeTrailingComments: 1
+Cpp11BracedListStyle: false
+Standard:        Cpp11
+IndentWidth:     4
+TabWidth:        8
+UseTab:          Never
+BreakBeforeBraces: Stroustrup
+SpacesInParentheses: false
+SpacesInAngles:  false
+SpaceInEmptyParentheses: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpaceBeforeAssignmentOperators: true
+ContinuationIndentWidth: 4
+CommentPragmas:  '^ IWYU pragma:'
+ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
+SpaceBeforeParens: ControlStatements
+DisableFormat:   false
+...
+
diff --git a/doc/style-guide b/doc/style-guide
index 5546cb3..42e684d 100644
--- a/doc/style-guide
+++ b/doc/style-guide
@@ -14,8 +14,10 @@ This is the style guide for the Niepce project.
 INDENTATION
 -----------
 
+There is a .clang-format that will do the formatting for you.
+
 Spaces, not tab.
-2 spaces.
+4 spaces.
 
 Curly braces are mandatory.
 
diff --git a/src/libraryclient/locallibraryserver.cpp b/src/libraryclient/locallibraryserver.cpp
index 656d740..9e449cf 100644
--- a/src/libraryclient/locallibraryserver.cpp
+++ b/src/libraryclient/locallibraryserver.cpp
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301, USA
  */
 
@@ -25,11 +25,8 @@ using eng::Op;
 
 namespace libraryclient {
 
-       void LocalLibraryServer::execute(const Op::Ptr & _op)
-       {
-               (*_op)(m_library);
-       }
-
-
+void LocalLibraryServer::execute(const Op::Ptr& _op)
+{
+    (*_op)(m_library);
+}
 }
-
diff --git a/src/libraryclient/locallibraryserver.hpp b/src/libraryclient/locallibraryserver.hpp
index 373056a..62b3ce8 100644
--- a/src/libraryclient/locallibraryserver.hpp
+++ b/src/libraryclient/locallibraryserver.hpp
@@ -19,8 +19,6 @@
  * 02110-1301, USA
  */
 
-
-
 #ifndef _LIBRARYCLIENT_LOCALLIBRARYSERVER_H_
 #define _LIBRARYCLIENT_LOCALLIBRARYSERVER_H_
 
@@ -29,29 +27,23 @@
 #include "engine/db/library.hpp"
 namespace libraryclient {
 
-       class LocalLibraryServer
-               : public fwk::Worker<eng::Op>
-       {
-       public:
-               /** create the local server for the library whose dir is specified */
-               LocalLibraryServer(const std::string & dir,
-                                                  const fwk::NotificationCenter::Ptr & nc)
-                       : fwk::Worker<eng::Op>()
-                       , m_library(eng::Library::Ptr(new eng::Library(dir, nc)))
-                       {
-                       }
-               bool ok() const
-                       {
-                               return m_library && m_library->ok();
-                       }
-       protected:
-               virtual void execute(const ptr_t & _op) override;
-
-       private:
-               eng::Library::Ptr m_library;
-       };
-
+class LocalLibraryServer : public fwk::Worker<eng::Op> {
+public:
+    /** create the local server for the library whose dir is specified */
+    LocalLibraryServer(const std::string& dir,
+                       const fwk::NotificationCenter::Ptr& nc)
+        : fwk::Worker<eng::Op>()
+        , m_library(eng::Library::Ptr(new eng::Library(dir, nc)))
+    {
+    }
+    bool ok() const { return m_library && m_library->ok(); }
+
+protected:
+    virtual void execute(const ptr_t& _op) override;
+
+private:
+    eng::Library::Ptr m_library;
+};
 }
 
-
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]