/*File Name: PicturObject.cpp
  Author: Betti Österholz ; Date: 18.08.2003
  System: C++

  This is implementation of the Basisclass of all pictur objects

*/

#include "PicturObject.h"

#include "Conc.h"
#include "Point.h"
#include "Function.h"
#include "Area.h"

//---------------------------------------------------------------------------
//constructors:

PicturObject::PicturObject()
//blank standart constructor
{}

PicturObject::~PicturObject()
//blank destructor
{}


PicturObject* PicturObject::restoreElementTyp(std::stringstream& in)
//restore the element Typ from the stream in, wich is ther given with the
//syntax from the docu, varl is a list with the variables jet defined
//!this object must be created and his syntax(e.g "fkt(" or "p(") deleted
//from the stream
//pre: the input stream to read from
//post: the object of the Type like in the stream(e.G. a blank Point object)
{
char c;
in>>c;
if (c=='c')//next is a conc("conc(") element
{	//read out the next chars for this object
	in>>c;//o
	in>>c;//n
	in>>c;//c
	in>>c;//(
	return (new Conc());
}
if (c=='p')//next is a point("p(") element
{
	//read out the next chars for this object
	in>>c;//(
	return (new Point());
}
if (c=='f')//next is a function("fkt(") or area("for(") element
{
	in>>c;
	if (c=='k')//next is a function("fkt(") element
	{
		//read out the next chars for this object
		in>>c;//t
		in>>c;//(
		return (new Function());
	}
	if (c=='o')//next is a area("for(") element
	{
		//read out the next chars for this object
		in>>c;//r
		in>>c;//(
		return (new Area());
	}
}
return 0;//error
}
