aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample/abstract.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-08-17 19:31:37 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-08-17 19:31:37 -0300
commite0c29962e6f334452f0c9db2caaf6ed18065de85 (patch)
treecee27801c196fbcacf6130ad64216af133b555dd /tests/libsample/abstract.cpp
The End Is the Beginning Is the End
Diffstat (limited to 'tests/libsample/abstract.cpp')
-rw-r--r--tests/libsample/abstract.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/libsample/abstract.cpp b/tests/libsample/abstract.cpp
new file mode 100644
index 000000000..8b49f37f8
--- /dev/null
+++ b/tests/libsample/abstract.cpp
@@ -0,0 +1,64 @@
+#include <iostream>
+#include "abstract.h"
+
+using namespace std;
+
+Abstract::Abstract(int id) : m_id(id)
+{
+ cout << __PRETTY_FUNCTION__;
+ show();
+ cout << endl;
+}
+
+Abstract::~Abstract()
+{
+ cout << __PRETTY_FUNCTION__;
+ show();
+ cout << endl;
+}
+
+void
+Abstract::unpureVirtual()
+{
+ cout << __PRETTY_FUNCTION__ << endl;
+}
+
+void
+Abstract::callUnpureVirtual()
+{
+ cout << __PRETTY_FUNCTION__ << " --- BEGIN" << endl;
+ this->unpureVirtual();
+ cout << __PRETTY_FUNCTION__ << " --- END" << endl;
+}
+
+
+void
+Abstract::callPureVirtual()
+{
+ cout << __PRETTY_FUNCTION__ << " --- BEGIN" << endl;
+ this->pureVirtual();
+ cout << __PRETTY_FUNCTION__ << " --- END" << endl;
+}
+
+void
+Abstract::show(PrintFormat format)
+{
+ cout << '<';
+ switch(format) {
+ case Short:
+ cout << this;
+ break;
+ case Verbose:
+ cout << "class " << className() << " | cptr: " << this;
+ cout << ", id: " << m_id;
+ break;
+ case OnlyId:
+ cout << "id: " << m_id;
+ break;
+ case ClassNameAndId:
+ cout << className() << " - id: " << m_id;
+ break;
+ }
+ cout << '>';
+}
+