Polaris: StringElem.cc Source File

StringElem.cc

Go to the documentation of this file.
00001 ///
00002 /// \file StringElem.cc
00003 ///
00004 #ifdef POLARIS_GNU_PRAGMAS
00005 #pragma implementation
00006 #endif
00007 ///
00008 #include "StringElem.h"
00009 
00010 StringElem::StringElem()
00011 : String("")
00012 {
00013     #ifdef CLASS_INSTANCE_REGISTRY
00014     register_instance(STRING_ELEM, sizeof(StringElem), this);
00015     #endif
00016 }
00017 
00018 StringElem::StringElem(const char *str)
00019 : String(str)
00020 {
00021     #ifdef CLASS_INSTANCE_REGISTRY
00022     register_instance(STRING_ELEM, sizeof(StringElem), this);
00023     #endif
00024 }
00025 
00026 StringElem::StringElem(const String &other)
00027 : String(other)
00028 {
00029     #ifdef CLASS_INSTANCE_REGISTRY
00030     register_instance(STRING_ELEM, sizeof(StringElem), this);
00031     #endif
00032 }
00033 
00034 StringElem::StringElem(const StringElem &other)
00035 : String(other)
00036 {
00037     #ifdef CLASS_INSTANCE_REGISTRY
00038     register_instance(STRING_ELEM, sizeof(StringElem), this);
00039     #endif
00040 }
00041 
00042 StringElem::~StringElem()
00043 {
00044     #ifdef CLASS_INSTANCE_REGISTRY
00045     unregister_instance(STRING_ELEM, this);
00046     #endif
00047 }
00048 
00049 void StringElem::print(ostream &o) const
00050 {
00051   o << (String &)*this;
00052 }
00053 
00054 Listable *StringElem::listable_clone() const
00055 {
00056   return new StringElem(*this);
00057 }
00058 
00059 StringElem *
00060 StringElem::clone() const
00061 {
00062     return new StringElem( *this );
00063 }
00064 
00065 int StringElem::structures_OK() const
00066 {
00067   return String::structures_OK();
00068 }
00069 
00070 ////////////////////////////////////////////////////////////
00071 ////////////////////////////////////////////////////////////
00072 
00073 #ifdef StringElemTest
00074 
00075 #include "List.h"
00076 
00077 int main()
00078 {
00079   String temp = "Hello";
00080 
00081   List<StringElem> l;
00082   l.ins_last(new StringElem(temp));
00083   l.ins_last(new StringElem("there"));
00084   l.ins_last(new StringElem("I'm"));
00085   l.ins_last(new StringElem("Stephen"));
00086   cout << l << endl;
00087 }
00088 
00089 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:13 2005