public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/libbash:master commit in: src/, src/core/, coding_standard/
@ 2011-04-08 11:12 Petteri Räty
  0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2011-04-08 11:12 UTC (permalink / raw
  To: gentoo-commits

commit:     7ca17c2ab62ede136e83c7a86c9cd23aa7ff9bb4
Author:     Mu Qiao <qiaomuf <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  8 03:14:54 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Fri Apr  8 11:01:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=7ca17c2a

Add style guide for classes

Source code are fixed following the style guide.

---
 coding_standard/coding_standard.tex |    5 +++++
 src/core/parser_builder.h           |    2 +-
 src/core/walker_builder.h           |    2 +-
 src/cppbash_builtin.h               |    2 +-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/coding_standard/coding_standard.tex b/coding_standard/coding_standard.tex
index fb578d3..e039fb0 100644
--- a/coding_standard/coding_standard.tex
+++ b/coding_standard/coding_standard.tex
@@ -112,6 +112,11 @@ vector<string> names; //Not good
 std::vector<std::string> names; //GOOD
 \end{verbatim}
 Namespaces may be used in implementation files if they do not cause conflicts, as implementation files should never be included in another file.
+\subsection{Classes}
+Use the C++ keyword explicit for constructors with one argument.\\
+Provide a copy constructor and assignment operator only when necessary. Otherwise, disable them with "= delete" from C++0x.\\
+Use a struct only for passive objects that carry data; everything else is a class.\\
+Composition is often more appropriate than inheritance. When using inheritance, make it public.
 \section{Statements}
 \subsection{Simple statements}
 Each line should contain only one statement:

diff --git a/src/core/parser_builder.h b/src/core/parser_builder.h
index ab22c26..654f0eb 100644
--- a/src/core/parser_builder.h
+++ b/src/core/parser_builder.h
@@ -51,7 +51,7 @@ class parser_builder
 
   void init_parser();
 public:
-  parser_builder(std::istream& source);
+  explicit parser_builder(std::istream& source);
   ~parser_builder();
 
   ///

diff --git a/src/core/walker_builder.h b/src/core/walker_builder.h
index 72566a1..6b6714b 100644
--- a/src/core/walker_builder.h
+++ b/src/core/walker_builder.h
@@ -40,7 +40,7 @@ public:
   /// \brief the interpreter object that contains all runtime information
   std::shared_ptr<interpreter> walker;
 
-  walker_builder(pANTLR3_COMMON_TREE_NODE_STREAM nodes);
+  explicit walker_builder(pANTLR3_COMMON_TREE_NODE_STREAM nodes);
 };
 
 #endif

diff --git a/src/cppbash_builtin.h b/src/cppbash_builtin.h
index 7a4a46e..62f8c6a 100644
--- a/src/cppbash_builtin.h
+++ b/src/cppbash_builtin.h
@@ -49,7 +49,7 @@ class cppbash_builtin
     /// \param errstream where to send standard error.  Default: cerr
     /// \param instream where to get standard input from.  Default: stdin
     ///
-    cppbash_builtin(STREAM_ARGS);
+    explicit cppbash_builtin(STREAM_ARGS);
     /// prevent copying
     cppbash_builtin(const cppbash_builtin& ) = delete;
     const cppbash_builtin& operator=( const cppbash_builtin& ) = delete;



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-08 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-08 11:12 [gentoo-commits] proj/libbash:master commit in: src/, src/core/, coding_standard/ Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox