Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Object Class Reference

The Object class serves as a convenient base class for all objects in the program that can be loaded from or written to a file. More...

#include <Object.h>

Inheritance diagram for Object:

DrawElement Drawing Tool Circle Group Rectangle CircleTool ColorTool CutTool ExitTool MoveTool MutateTool RectangleTool SelectTool ToBackTool ToFrontTool List of all members.

Public Methods

virtual void add_feature (std::string feature, bool value)
 Note: These functions are typically called by the loading mechanism.

virtual void add_feature (std::string feature, float value)
virtual void add_feature (std::string feature, std::string value)
 This variation of add_feature is the only one that doesn't always throw an exception when it reaches Object.

virtual void add_feature (std::string feature, Position value)
virtual void add_feature (std::string feature, Object *value)
std::string get_text ()
 Return the string associated with this Object.

virtual ~Object ()

Protected Methods

 Object ()

Private Methods

 Object (const Object &)
Object & operator= (const Object &)

Private Attributes

std::string text

Detailed Description

The Object class serves as a convenient base class for all objects in the program that can be loaded from or written to a file.

An essential set of functions to understand are the "add_feature" functions. They are used to add descriptive information to the object.


Constructor & Destructor Documentation

Object::~Object   [virtual]
 

00061 {}

Object::Object   [protected]
 

00060 {}

Object::Object const Object &    [private]
 


Member Function Documentation

void Object::add_feature std::string    feature,
Object *    value
[virtual]
 

Reimplemented in Drawing, and Group.

00045 {
00046   throw unknown_feature(feature + ": <object/>");
00047 }

void Object::add_feature std::string    feature,
Position    value
[virtual]
 

Reimplemented in DrawElement.

00040 {
00041   throw unknown_feature(feature + Utilities::to_string(value));
00042 }

void Object::add_feature std::string    feature,
std::string    value
[virtual]
 

This variation of add_feature is the only one that doesn't always throw an exception when it reaches Object.

If the feature to add is "text", then it sets the text private variable to equal value.

Reimplemented in ColorTool, DrawElement, Drawing, and Tool.

00031 {
00032   if (feature == "text") {
00033     text = value;
00034   } else {
00035     throw unknown_feature(feature + ": \"" + value + "\"");
00036   }
00037 }

void Object::add_feature std::string    feature,
float    value
[virtual]
 

Reimplemented in Circle, Drawing, and Rectangle.

00021 {
00022   throw unknown_feature(feature + ": " + Utilities::to_string(value));
00023 }

void Object::add_feature std::string    feature,
bool    value
[virtual]
 

Note: These functions are typically called by the loading mechanism.

The following three functions are typically executed when the load file contains a feature that is not recognized. That is why they thow an exception. In other words, the logic behind this method is: if execution has reached THIS point, whatever the feature is, it's not recognized. The exception to this rule is add_feature(string,string).

00016 {
00017   throw unknown_feature(feature + ": " + Utilities::to_string(value));
00018 }

string Object::get_text  
 

Return the string associated with this Object.

00054 {
00055 
00056   return text;
00057 }

Object& Object::operator= const Object &    [private]
 


Member Data Documentation

std::string Object::text [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 8 10:52:31 2002 for Draw by doxygen1.2.17