Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-07-21 21:14:10 +0000
committerDoug Schaefer2003-07-21 21:14:10 +0000
commitd8ee61be381462fee3501e736c934e6b77efdfb5 (patch)
tree982bd720b757f74884ae8117db3903803348f43d /core/org.eclipse.cdt.core.tests/resources/indexer
parenta3c2f8e4230d20852ca2af53b0d591d4eaa16836 (diff)
downloadorg.eclipse.cdt-d8ee61be381462fee3501e736c934e6b77efdfb5.tar.gz
org.eclipse.cdt-d8ee61be381462fee3501e736c934e6b77efdfb5.tar.xz
org.eclipse.cdt-d8ee61be381462fee3501e736c934e6b77efdfb5.zip
Patch for Bogdan Gheorghe:
- adds namespaces, enums, typedefs, functions, methods, fields and vars to the index. - also fixes a problem with the Search label provider which caused it to not display properly under some conditions.
Diffstat (limited to 'core/org.eclipse.cdt.core.tests/resources/indexer')
-rw-r--r--core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp108
1 files changed, 108 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp b/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp
new file mode 100644
index 00000000000..965d56b196c
--- /dev/null
+++ b/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp
@@ -0,0 +1,108 @@
+#include <iostream.h>
+#include <stdlib.h>
+#include <alloc.h>
+#include <iomanip.h>
+
+typedef int int32;
+
+static void doSomething();
+
+namespace Z{
+ int x;
+ namespace X{
+ namespace Y{
+ enum test{cool,hi,bye,why};
+ class Mail
+ {
+ public:
+ Mail(){}
+ virtual void print()=0; //Pure Virtual Function, forces redefinition
+ protected:
+ float postage;
+ char *type;
+ friend ostream& operator << (ostream& os, Mail *m);
+ };
+
+ class postcard : public Mail
+ {
+ public:
+ postcard(): Mail(){postage = 0.20; type = "Postcard";}
+ void print(){cout << type << ": $" << setiosflags(ios::fixed)
+ <<setprecision(2) << postage <<endl;}
+ };
+
+ class first_class : public Mail
+ {
+ public:
+ first_class() : Mail(){postage = 0.32; type = "First Class";}
+ void print(){cout << type << ": $" <<setiosflags(ios::fixed)
+ << setprecision(2) << postage <<endl;}
+
+ };
+
+ class Unknown : public postcard, first_class // ??? Multiple Inheritance
+ {
+ public:
+ Unknown(): postcard(), first_class()
+ {
+ postcard::postage = 1.50; // MUST disambiguate
+ postcard::type = "Unknown";
+ }
+ void print(){cout << postcard::type << ": $" <<setiosflags(ios::fixed)
+ <<setprecision(2)<<postcard::postage <<endl;}
+ };
+
+ class container
+ {
+ private:
+ Mail **array;
+ int index;
+ int sz;
+ public:
+ container(){array = 0;}
+ ~container(){
+ for(int x = 0; x <sz; x++)
+ delete array[x];
+ free(array);
+ }
+ int size() {return sz;}
+ Mail* operator[](int index);
+ Mail* operator = (Mail* mail);
+ };
+
+ main()
+ {
+ container PO_Box;
+ PO_Box = new postcard;
+ PO_Box = new first_class;
+ PO_Box = new parcel_Post;
+ //PO_Box = new Unknown;
+ //one way of printing information
+ for(int x =0; x <3; x++){
+ PO_Box[x]->print();
+ }
+ //Overloaded <<
+ for(int x =0; x <PO_Box.size(); x++){
+ cout << PO_Box[x];
+ }
+ }
+
+ ostream& operator << (ostream &os, Mail *m)
+ {
+ os <<setiosflags(ios::fixed) << setprecision(2)<< m->type
+ << ": $" << m->postage <<endl;
+
+ return os;
+ }
+ Mail* container::operator[](int index) {return array[index];}
+ Mail* container::operator = (Mail* mail)
+ {
+ int size = sizeof(Mail*) * (++sz);
+ int temp = sz -1;
+ array = (Mail**)realloc(array, size);
+ array[temp] = mail;
+ return 0;
+ }
+ }
+ }
+}

Back to the top