From 736613e26c911645237594980f6fa3064f634701 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Wed, 5 Aug 2015 10:01:15 +0200 Subject: [Go] Documentation cleanup of obsolete 'callback' and 'extend' examples. After commit 17b1c1c (pull request 447; issue 418) the 'callback' and 'extend' examples have been removed in favor of the 'director' example. --- Examples/go/extend/example.h | 56 -------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 Examples/go/extend/example.h (limited to 'Examples/go/extend/example.h') diff --git a/Examples/go/extend/example.h b/Examples/go/extend/example.h deleted file mode 100644 index ca1aed28f..000000000 --- a/Examples/go/extend/example.h +++ /dev/null @@ -1,56 +0,0 @@ -/* File : example.h */ - -#include -#include -#include -#include -#include - -class Employee { -private: - std::string name; -public: - Employee(const char* n): name(n) {} - virtual std::string getTitle() { return getPosition() + " " + getName(); } - virtual std::string getName() { return name; } - virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } -}; - - -class Manager: public Employee { -public: - Manager(const char* n): Employee(n) {} - virtual std::string getPosition() const { return "Manager"; } -}; - - -class EmployeeList { - std::vector list; -public: - EmployeeList() { - list.push_back(new Employee("Bob")); - list.push_back(new Employee("Jane")); - list.push_back(new Manager("Ted")); - } - void addEmployee(Employee *p) { - list.push_back(p); - std::cout << "New employee added. Current employees are:" << std::endl; - std::vector::iterator i; - for (i=list.begin(); i!=list.end(); i++) { - std::cout << " " << (*i)->getTitle() << std::endl; - } - } - const Employee *get_item(int i) { - return list[i]; - } - ~EmployeeList() { - std::vector::iterator i; - std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; - for (i=list.begin(); i!=list.end(); i++) { - delete *i; - } - std::cout << "~EmployeeList empty." << std::endl; - } -}; - -- cgit v1.2.1 From a941e5b605670a8b4686cec5f0d87562846552e2 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Sat, 8 Aug 2015 19:44:41 +0200 Subject: [Go] Revert commit 5e88857 to undelete the 'callback' and 'extend' examples. The 'callback' and 'extend' examples were presumed to be obsoleted by the new 'director' example. The examples are helpful though to have similar examples across target languages and hence the commit @5e88857 which removed these examples got reverted. --- Examples/go/extend/example.h | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Examples/go/extend/example.h (limited to 'Examples/go/extend/example.h') diff --git a/Examples/go/extend/example.h b/Examples/go/extend/example.h new file mode 100644 index 000000000..ca1aed28f --- /dev/null +++ b/Examples/go/extend/example.h @@ -0,0 +1,56 @@ +/* File : example.h */ + +#include +#include +#include +#include +#include + +class Employee { +private: + std::string name; +public: + Employee(const char* n): name(n) {} + virtual std::string getTitle() { return getPosition() + " " + getName(); } + virtual std::string getName() { return name; } + virtual std::string getPosition() const { return "Employee"; } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } +}; + + +class Manager: public Employee { +public: + Manager(const char* n): Employee(n) {} + virtual std::string getPosition() const { return "Manager"; } +}; + + +class EmployeeList { + std::vector list; +public: + EmployeeList() { + list.push_back(new Employee("Bob")); + list.push_back(new Employee("Jane")); + list.push_back(new Manager("Ted")); + } + void addEmployee(Employee *p) { + list.push_back(p); + std::cout << "New employee added. Current employees are:" << std::endl; + std::vector::iterator i; + for (i=list.begin(); i!=list.end(); i++) { + std::cout << " " << (*i)->getTitle() << std::endl; + } + } + const Employee *get_item(int i) { + return list[i]; + } + ~EmployeeList() { + std::vector::iterator i; + std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; + for (i=list.begin(); i!=list.end(); i++) { + delete *i; + } + std::cout << "~EmployeeList empty." << std::endl; + } +}; + -- cgit v1.2.1 From 85037c3a33f4943afdcdaf0bc49b3f0433165f05 Mon Sep 17 00:00:00 2001 From: Michael Schaller Date: Sun, 9 Aug 2015 14:03:19 +0200 Subject: [Go] Updated the 'callback' and 'extend' examples to match the 'director' one. After the documentation update on how to utilize the director feature with commit @17b1c1c the 'callback' and 'extend' examples needed an update as well. --- Examples/go/extend/example.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Examples/go/extend/example.h') diff --git a/Examples/go/extend/example.h b/Examples/go/extend/example.h index ca1aed28f..0c3b721bd 100644 --- a/Examples/go/extend/example.h +++ b/Examples/go/extend/example.h @@ -44,7 +44,7 @@ public: const Employee *get_item(int i) { return list[i]; } - ~EmployeeList() { + ~EmployeeList() { std::vector::iterator i; std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; for (i=list.begin(); i!=list.end(); i++) { -- cgit v1.2.1