home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef TUTORIAL_H
- #define TUTORIAL_H
-
- #include <fstream.h>
-
- // forward references are ignored.
- class Insect;
- class Honey;
-
- ////////////////////////////////////////////////////////////////////////
- // This is a simple enum to provide a simple Boolean type. When the ISO
- // C++ standard is finished, *and* most compilers implement, it we will
- // not have to do this any more. Object Outline can document and hyperlink
- // enumerates types. The values comments following the Bool are also
- // extracted.
- enum Bool
- {
- false = 0, // This means that the value is false i.e. zero.
- true // This means that the value is true, i.e. 1.
- };
-
- /*******************************************************************************
- * CLASSNAME: Flower *
- * *
- * DESCRIPTION: This class is a Flower. The Flower gives an Insect the *
- * Pollen object. The Pollen in turn is used to create Honey. *
- * If the Flower does not have any Pollen left, it will return *
- * false when AnyPollenLeft is called. Please note how the end *
- * user documentation has all the stars removed and the paragraph *
- * correctly word wraps. Just to prove it, resize your screen *
- * and watch how the paragraph still looks OK. *
- *******************************************************************************/
- class Flower
- {
- public:
- Flower() {nPollenPods = 2; }
- ~Flower() {};
-
- Bool AnyPollenLeft() const { if (nPollenPods != 0) return true; return false; }
- void GetPollen(Insect *) { --nPollenPods; }
-
- private:
- // not allowed
- Flower(const Flower ©me);
- Flower& operator=(const Flower ©me);
-
- unsigned nPollenPods;
- };
-
- // CLASS: Pollen
- //
- // DESCRIPTION: This class does not do much except show an example of the comment filtering
- // in Object Outline.
- //
- // CHANGE LOG:
- // 1/1/1 - class first created.
- // 1/2/1 - class missing dtor
- // 1/3/1 - class description beefed up.
- // Please note that this information is of no value to the users
- // of Pollen and should not appear in the finial documentation.
- // What we do is define "DESCRIPTION" and "CHANGE LOG" as tags in the
- // Object Outline configuration file. We then tell Object Outline
- // to remove the text before "DESCRIPTION" and after "CHANGE LOG"
- // This leaves only the useful description sentence left in the
- // final document.
- class Pollen
- {
- public:
- // creates a Pollen Object
- Pollen() { a=0; b=0; }
-
- // wipes out the Pollen Object.
- ~Pollen() {}
-
- // This is some public data, please notice how Object Outline
- int a; // knows that all of this comment belongs to a
- // even if it appears after the declaration.
-
- // This is some more public data that Object Outline correctly
- int b; // separated from a. You write your comments the
- // way you always do and let Object Outlines deal with it.
- private:
- // This is a private member functions, they are not documented because
- // clients of Pollen should not have to know about them.
- void PrivateFunction() {};
- };
-
- /*
- CLASSNAME: Insect
-
- DESCRIPTION: This class is a simple class that describes an insect. The Insect
- is a small animal that may or may not fly and can have anywhere from four
- legs to several hundred. This class provides a common protocol
- for other parts of the system to get at this information. Please
- notice that Insect and BumbleBee are automatically hyperlinked. Also
- notice that the next section is automatically documented in a
- fixed space font, where as this section is a free flowing
- paragraph. The end result is that the example code is appropriately
- formatted and this paragraph looks good.
-
- example:
-
- void EatTheInsect(const Insect &insect)
- {
- if (insect.CanFly() != false)
- {
- ... eat the insect
- }
- else
- {
- // it is hard to eat insects that can fly.
- }
- }
- */
- class Insect
- {
- public:
- Insect() {};
- Insect(int,int,const Honey &);
- virtual ~Insect() {}
- virtual Bool CanFly() const = 0;
- };
-
- class Honey
- //**
- // This is the honey class. Not all Insect classes can make it so only the
- // BumbleBee is allows to create it. Some people like to put class comments
- // before the first brace. This style is also supported by Object Outline.
- //**
- {
- public:
- Honey() {};
- ~Honey() {};
-
- void Display(ostream &out) const { out << "Yum, Yum, Yum!!"; }
- };
-
- // dumps the Honey Object to the ostream.
- inline ostream& operator<<(ostream &out,const Honey &dumpme)
- {
- dumpme.Display(out);
- return out;
- }
-
- /****************************************************************************
- CLASSNAME: BumbleBee
-
- DESCRIPTION: This is a class that represents a bumble bee. Because it
- inherits from the Insect it can be used everywhere an Insect
- class is needed. It also has some functionality that not all insects
- have. It can make Honey. Note that classes with many functions
- get a function summary list and that Insect is automatically linked
- back to its definition.
- *****************************************************************************/
- class BumbleBee : public Insect
- {
- public:
- BumbleBee() {};
- virtual ~BumbleBee() {};
-
- Bool CanFly() const;
-
- // a small description that is discarded in favor of the longer description
- // in the source file.
- Honey GetHoney() const;
-
- void Function01() const;
- void Function02() const;
- void Function03() const;
- void Function04() const;
- void Function05() const;
- void Function06() const;
- protected:
- void Function07() const;
- void Function08() const;
- void Function09() const;
- void Function10() const;
- void Function11() const;
- };
-
- #endif
-
-
-
-