1 |
commit: ae8b855bd14a965db5d9d49ca64e8c0c334874f0 |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 2 11:41:27 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 2 11:41:27 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=ae8b855b |
7 |
|
8 |
Core: prevent copying classes |
9 |
|
10 |
Now classes that are not designed to be copyable inherit from |
11 |
boost::noncopyable. |
12 |
|
13 |
--- |
14 |
src/core/bash_ast.h | 3 ++- |
15 |
src/core/interpreter.h | 3 ++- |
16 |
src/cppbash_builtin.h | 6 ++---- |
17 |
3 files changed, 6 insertions(+), 6 deletions(-) |
18 |
|
19 |
diff --git a/src/core/bash_ast.h b/src/core/bash_ast.h |
20 |
index 9e388cb..5469d95 100644 |
21 |
--- a/src/core/bash_ast.h |
22 |
+++ b/src/core/bash_ast.h |
23 |
@@ -33,6 +33,7 @@ |
24 |
#include <vector> |
25 |
|
26 |
#include <antlr3.h> |
27 |
+#include <boost/utility.hpp> |
28 |
|
29 |
#include "libbashWalker.h" |
30 |
|
31 |
@@ -42,7 +43,7 @@ class interpreter; |
32 |
|
33 |
/// \class bash_ast |
34 |
/// \brief a wrapper class that helps interpret from istream and string |
35 |
-class bash_ast |
36 |
+class bash_ast: public boost::noncopyable |
37 |
{ |
38 |
pANTLR3_INPUT_STREAM input; |
39 |
std::string script; |
40 |
|
41 |
diff --git a/src/core/interpreter.h b/src/core/interpreter.h |
42 |
index 3420ee4..46c3d6a 100644 |
43 |
--- a/src/core/interpreter.h |
44 |
+++ b/src/core/interpreter.h |
45 |
@@ -32,6 +32,7 @@ |
46 |
#include <string> |
47 |
|
48 |
#include <antlr3basetree.h> |
49 |
+#include <boost/utility.hpp> |
50 |
#include <boost/xpressive/xpressive.hpp> |
51 |
|
52 |
#include "core/symbols.hpp" |
53 |
@@ -46,7 +47,7 @@ typedef struct libbashWalker_Ctx_struct * plibbashWalker; |
54 |
/// \class interpreter |
55 |
/// \brief implementation for bash interpreter |
56 |
/// |
57 |
-class interpreter |
58 |
+class interpreter: public boost::noncopyable |
59 |
{ |
60 |
|
61 |
/// \var private::members |
62 |
|
63 |
diff --git a/src/cppbash_builtin.h b/src/cppbash_builtin.h |
64 |
index e7b68ea..11c1edb 100644 |
65 |
--- a/src/cppbash_builtin.h |
66 |
+++ b/src/cppbash_builtin.h |
67 |
@@ -33,6 +33,7 @@ |
68 |
#include <boost/functional/factory.hpp> |
69 |
#include <boost/function.hpp> |
70 |
#include <boost/scoped_ptr.hpp> |
71 |
+#include <boost/utility.hpp> |
72 |
|
73 |
#define BUILTIN_ARGS std::ostream &out, std::ostream &err, std::istream &in, interpreter &walker |
74 |
|
75 |
@@ -41,7 +42,7 @@ class interpreter; |
76 |
/// \class cppbash_builtin |
77 |
/// \brief a virtual class to inherit builtin functions from |
78 |
/// |
79 |
-class cppbash_builtin |
80 |
+class cppbash_builtin: public boost::noncopyable |
81 |
{ |
82 |
public: |
83 |
/// |
84 |
@@ -51,9 +52,6 @@ class cppbash_builtin |
85 |
/// \param instream where to get standard input from. Default: stdin |
86 |
/// |
87 |
explicit cppbash_builtin(BUILTIN_ARGS); |
88 |
- /// prevent copying |
89 |
- cppbash_builtin(const cppbash_builtin& ) = delete; |
90 |
- const cppbash_builtin& operator=( const cppbash_builtin& ) = delete; |
91 |
|
92 |
virtual ~cppbash_builtin() {}; |
93 |
/// |