/* Area */ void Area::setTitle (QString p_value) { if (p_value != Title) { Title = p_value; } } void Area::linkItem (Area * item, Area * bef, Area * aft) { assert (this != NULL); assert (item != NULL); assert (item->prevItem == NULL); assert (item->nextItem == NULL); assert (item->aboveArea == NULL); Area * tmp = this; while (tmp != NULL) { assert (tmp != item); tmp = tmp->aboveArea; } item->prevItem = bef; item->nextItem = aft; item->aboveArea = this; if (bef == NULL) this->firstItem = item; else bef->nextItem = item; if (aft == NULL) this->lastItem = item; else aft->prevItem = item; item->connected (); } void Area::insertFirstItem (Area * item) { assert (this != NULL); linkItem (item, NULL, firstItem); } void Area::insertLastItem (Area * item) { assert (this != NULL); linkItem (item, lastItem, NULL); } void Area::insertPrevItem (Area * item) { assert (this != NULL); assert (aboveArea != NULL); aboveArea->linkItem (item, prevItem, this); } void Area::insertNextItem (Area * item) { assert (this != NULL); assert (aboveArea != NULL); aboveArea->linkItem (item, this, nextItem); } void Area::removeItem () { assert (this != NULL); assert (aboveArea != NULL); disconnected (); if (prevItem == NULL) aboveArea->firstItem = nextItem; else prevItem->nextItem = nextItem; if (nextItem == NULL) aboveArea->lastItem = prevItem; else nextItem->prevItem = prevItem; prevItem = NULL; nextItem = NULL; aboveArea = NULL; } void Area::removeAllItems () { Area * p = firstItem; while (p != NULL) { Area * t = p; p = p->nextItem; t->removeItem (); delete t; } firstItem = NULL; lastItem = NULL; } void Area::linkSource (Source * item, Source * bef, Source * aft) { assert (this != NULL); assert (item != NULL); assert (item->prevSource == NULL); assert (item->nextSource == NULL); assert (item->area == NULL); item->prevSource = bef; item->nextSource = aft; item->area = this; if (bef == NULL) this->firstSource = item; else bef->nextSource = item; if (aft == NULL) this->lastSource = item; else aft->prevSource = item; item->connected (); } void Area::insertFirstSource (Source * item) { assert (this != NULL); linkSource (item, NULL, firstSource); } void Area::insertLastSource (Source * item) { assert (this != NULL); linkSource (item, lastSource, NULL); } void Area::removeAllSources () { Source * p = firstSource; while (p != NULL) { Source * t = p; p = p->nextSource; t->removeSource (); delete t; } firstSource = NULL; lastSource = NULL; } void Area::linkTarget (Target * item, Target * bef, Target * aft) { assert (this != NULL); assert (item != NULL); assert (item->prevTarget == NULL); assert (item->nextTarget == NULL); assert (item->area == NULL); item->prevTarget = bef; item->nextTarget = aft; item->area = this; if (bef == NULL) this->firstTarget = item; else bef->nextTarget = item; if (aft == NULL) this->lastTarget = item; else aft->prevTarget = item; item->connected (); } void Area::insertFirstTarget (Target * item) { assert (this != NULL); linkTarget (item, NULL, firstTarget); } void Area::insertLastTarget (Target * item) { assert (this != NULL); linkTarget (item, lastTarget, NULL); } void Area::removeAllTargets () { Target * p = firstTarget; while (p != NULL) { Target * t = p; p = p->nextTarget; t->removeTarget (); delete t; } firstTarget = NULL; lastTarget = NULL; } void Area::linkField (Field * item, Field * bef, Field * aft) { assert (this != NULL); assert (item != NULL); assert (item->prevField == NULL); assert (item->nextField == NULL); assert (item->aboveArea == NULL); item->prevField = bef; item->nextField = aft; item->aboveArea = this; if (bef == NULL) this->firstField = item; else bef->nextField = item; if (aft == NULL) this->lastField = item; else aft->prevField = item; } void Area::insertFirstField (Field * item) { assert (this != NULL); linkField (item, NULL, firstField); } void Area::insertLastField (Field * item) { assert (this != NULL); linkField (item, lastField, NULL); } void Area::removeAllFields () { Field * p = firstField; while (p != NULL) { Field * t = p; p = p->nextField; t->removeField (); delete t; } firstField = NULL; lastField = NULL; } Area::~Area () { removeAllItems (); if (aboveArea != NULL) removeItem (); removeAllSources (); removeAllTargets (); removeAllFields (); } Area::Area () : Title (), firstItem (NULL), lastItem (NULL), prevItem (NULL), nextItem (NULL), aboveArea (NULL), firstSource (NULL), lastSource (NULL), firstTarget (NULL), lastTarget (NULL), firstField (NULL), lastField (NULL) { initialize (); } /* Source */ void Source::linkConnection (Connection * item, Connection * bef, Connection * aft) { assert (this != NULL); assert (item != NULL); assert (item->prevConnection == NULL); assert (item->nextConnection == NULL); assert (item->source == NULL); item->prevConnection = bef; item->nextConnection = aft; item->source = this; if (bef == NULL) this->firstConnection = item; else bef->nextConnection = item; if (aft == NULL) this->lastConnection = item; else aft->prevConnection = item; item->connected (); } void Source::insertFirstConnection (Connection * item) { assert (this != NULL); linkConnection (item, NULL, firstConnection); } void Source::insertLastConnection (Connection * item) { assert (this != NULL); linkConnection (item, lastConnection, NULL); } void Source::removeAllConnections () { Connection * p = firstConnection; while (p != NULL) { Connection * t = p; p = p->nextConnection; t->removeConnection (); delete t; } firstConnection = NULL; lastConnection = NULL; } void Source::insertPrevSource (Source * item) { assert (this != NULL); assert (area != NULL); area->linkSource (item, prevSource, this); } void Source::insertNextSource (Source * item) { assert (this != NULL); assert (area != NULL); area->linkSource (item, this, nextSource); } void Source::removeSource () { assert (this != NULL); assert (area != NULL); disconnected (); if (prevSource == NULL) area->firstSource = nextSource; else prevSource->nextSource = nextSource; if (nextSource == NULL) area->lastSource = prevSource; else nextSource->prevSource = prevSource; prevSource = NULL; nextSource = NULL; area = NULL; } Source::~Source () { if (area != NULL) removeSource (); removeAllConnections (); } Source::Source () : firstConnection (NULL), lastConnection (NULL), prevSource (NULL), nextSource (NULL), area (NULL) { initialize (); } /* Target */ void Target::insertPrevTarget (Target * item) { assert (this != NULL); assert (area != NULL); area->linkTarget (item, prevTarget, this); } void Target::insertNextTarget (Target * item) { assert (this != NULL); assert (area != NULL); area->linkTarget (item, this, nextTarget); } void Target::removeTarget () { assert (this != NULL); assert (area != NULL); disconnected (); if (prevTarget == NULL) area->firstTarget = nextTarget; else prevTarget->nextTarget = nextTarget; if (nextTarget == NULL) area->lastTarget = prevTarget; else nextTarget->prevTarget = prevTarget; prevTarget = NULL; nextTarget = NULL; area = NULL; } Target::~Target () { if (area != NULL) removeTarget (); } Target::Target () : prevTarget (NULL), nextTarget (NULL), area (NULL) { initialize (); } /* Connection */ void Connection::setTarget (Target * p_value) { if (p_value != target) { target = p_value; } } void Connection::insertPrevConnection (Connection * item) { assert (this != NULL); assert (source != NULL); source->linkConnection (item, prevConnection, this); } void Connection::insertNextConnection (Connection * item) { assert (this != NULL); assert (source != NULL); source->linkConnection (item, this, nextConnection); } void Connection::removeConnection () { assert (this != NULL); assert (source != NULL); disconnected (); if (prevConnection == NULL) source->firstConnection = nextConnection; else prevConnection->nextConnection = nextConnection; if (nextConnection == NULL) source->lastConnection = prevConnection; else nextConnection->prevConnection = prevConnection; prevConnection = NULL; nextConnection = NULL; source = NULL; } Connection::~Connection () { if (source != NULL) removeConnection (); } Connection::Connection () : target (NULL), prevConnection (NULL), nextConnection (NULL), source (NULL) { initialize (); } /* Field */ void Field::setName (QString p_value) { if (p_value != Name) { Name = p_value; } } void Field::setValue (QString p_value) { if (p_value != Value) { Value = p_value; } } void Field::insertPrevField (Field * item) { assert (this != NULL); assert (aboveArea != NULL); aboveArea->linkField (item, prevField, this); } void Field::insertNextField (Field * item) { assert (this != NULL); assert (aboveArea != NULL); aboveArea->linkField (item, this, nextField); } void Field::removeField () { assert (this != NULL); assert (aboveArea != NULL); if (prevField == NULL) aboveArea->firstField = nextField; else prevField->nextField = nextField; if (nextField == NULL) aboveArea->lastField = prevField; else nextField->prevField = prevField; prevField = NULL; nextField = NULL; aboveArea = NULL; } QString Field::getText () { return ""; } void Field::setText (QString txt) { } bool Field::ReadOnly () { return false; } bool Field::DialogEnabled () { return false; } void Field::DialogExecute () { } bool Field::ListEnabled () { return false; } int Field::ListCount () { return 0; } QString Field::ListValue (int inx) { return ""; } void Field::ListClick (int inx) { } Field::~Field () { if (aboveArea != NULL) removeField (); } Field::Field () : Name (), Value (), prevField (NULL), nextField (NULL), aboveArea (NULL) { }