home *** CD-ROM | disk | FTP | other *** search
- /*****
- * CPerson.h
- *
- * Declaration of application-specific persistent classes.
- *
- * This sample app is derived from a contribution originally made
- * by Paul Gee (Thanks Paul!).
- *
- * Copyright © 1994 NeoLogic Systems. All rights reserved.
- *
- *****/
-
- #include CNeoPartMgrH
- #include <string.h>
-
- const NeoID kPersonID = 25;
- const NeoID kJokerID = 26;
- const NeoID kClownID = 27;
- const NeoID kJokeID = 28;
- const NeoID kPieID = 29;
-
- const long kMaxJokeLength = 80;
- const long kMaxFillingName = 25;
-
- class CPerson : public CNeoPartMgr
- {
- public:
- CPerson(const CNeoString &aName = "\p");
- void getName(CNeoString &aName) const {aName = fName;}
- void printName(void) const;
- void setName(const CNeoString &aName = "\p") {fName = aName;}
- virtual void skill(void) = 0;
-
- /** I/O Methods **/
- virtual void readObject(CNeoStream *aStream, const NeoTag aTag);
- virtual void writeObject(CNeoStream *aStream, const NeoTag aTag);
-
- protected:
- CNeoString fName;
- };
-
- const long kPersonFileLength = kNeoPartMgrFileLength + sizeof(CNeoString);
-
- class CJoke : public CNeoPersistNative
- {
- public:
- CJoke(const char *aText = "");
-
- static CNeoPersist *New(void);
- virtual NeoID getClassID(void) const;
- virtual long getFileLength(void) const;
-
- /** I/O Methods **/
- virtual void readObject(CNeoStream *aStream, const NeoTag aTag);
- virtual void writeObject(CNeoStream *aStream, const NeoTag aTag);
-
- void getJoke(char *aText) const {strncpy(aText, fJoke, kMaxJokeLength -1);}
- void printJoke(void) const;
- void setJoke(const char *aText) {strncpy(fJoke, aText, kMaxJokeLength -1);}
-
- protected:
- char fJoke[kMaxJokeLength];
- };
-
- class CJoker : public CPerson
- {
- public:
- CJoker(const CNeoString &aName = "\p");
-
- static CNeoPersist *New(void);
- virtual NeoID getClassID(void) const;
- virtual long getFileLength(void) const;
-
- virtual void skill(void);
- void forgetJoke(CJoke *aJoke);
- CJoke * getJoke(const long aIndex);
- long getJokeCount(void) const {return getListCount();}
- void learnJoke(CJoke *aJoke);
- };
-
- class CPie : public CNeoPersistNative
- {
- public:
- CPie(const char *aFilling = "Custard");
-
- static CNeoPersist *New(void);
- virtual NeoID getClassID(void) const;
- virtual long getFileLength(void) const;
-
- /** I/O Methods **/
- virtual void readObject(CNeoStream *aStream, const NeoTag aTag);
- virtual void writeObject(CNeoStream *aStream, const NeoTag aTag);
-
- void getFilling(char *aText) const {strncpy(aText, fFilling, kMaxFillingName -1);}
- void setFilling(const char *aText) {strncpy(fFilling, aText, kMaxFillingName -1);}
-
- protected:
- char fFilling[kMaxFillingName];
- };
-
- class CClown : public CPerson
- {
- public:
- CClown(const CNeoString &aName = "\p", const long aShoeSize = 15);
-
- static CNeoPersist *New(void);
- virtual NeoID getClassID(void) const;
- virtual long getFileLength(void) const;
-
- /** I/O Methods **/
- virtual void readObject(CNeoStream *aStream, const NeoTag aTag);
- virtual void writeObject(CNeoStream *aStream, const NeoTag aTag);
-
- CPie * bakePie(const char *aFilling = "Custard");
- CPie * getPie(const long aIndex);
- long getPieCount(void) const {return getListCount();}
- long getShoeSize(void) const {return fShoeSize;}
- void setShoeSize(const long aShoeSize) {fShoeSize = aShoeSize;}
- virtual void skill(void);
- void throwPie(CPie *aPie);
-
- protected:
- long fShoeSize;
- };
-
-