attributeitem.cpp
author insilmaril
Wed, 23 Sep 2009 12:14:08 +0000
changeset 797 2876353ea150
parent 795 6b0a5f4923d3
child 822 c2ce9944148c
permissions -rw-r--r--
updated build date
     1 
     2 #include "attributeitem.h"
     3 
     4 #include <iostream>
     5 using namespace std;
     6 
     7 extern bool debug;
     8 
     9 AttributeItem::AttributeItem(const QList<QVariant> &data, TreeItem *parent):TreeItem (data,parent)
    10 {
    11 	TreeItem::setType (Attribute);
    12 	//table=NULL;
    13 	//definition=NULL;
    14 	type=Attribute;
    15 
    16 	internal=false;
    17 }
    18 
    19 AttributeItem::~AttributeItem()
    20 {
    21 }
    22 
    23 void AttributeItem::setKey (const QString &k, const Type &t)
    24 {
    25 /*
    26 	if (!table)
    27 	{
    28 		qWarning (QString("AttributeItem::setKey (%1)  No table defined!\n").arg(k).ascii());
    29 		return;	
    30 	}
    31 	
    32 	if (!definition)
    33 	{
    34 		definition=table->getDef(k);
    35 		if (!definition)
    36 		{
    37 			table->addKey (k,t);
    38 			return;	
    39 		}
    40 	}	
    41 	qWarning (QString("AttributeItem::setKey (%1)  attribute already defined!\n").arg(k).ascii());
    42 	*/
    43 }
    44 
    45 QString AttributeItem::getKey ()
    46 {
    47 /*
    48 	if (!table)
    49 	{
    50 		qWarning ("AttributeItem::getKey ()  No table defined!");
    51 		return QString();	
    52 	}
    53 	if (!definition)
    54 	{
    55 		qWarning ("AttributeItem::getKey ()  No attribute defined!");
    56 		return QString ();	
    57 	}	
    58 	return definition->getKey();
    59 	*/
    60 }
    61 
    62 void AttributeItem::setValue(const QString &v)
    63 {
    64 /*
    65 	if (!table)
    66 	{
    67 		qWarning (QString ("AttributeItem::setValue (%1)  No table defined!").arg(v));
    68 		return;	
    69 	}
    70 	if (!definition)
    71 	{
    72 		qWarning (QString ("AttributeItem::setValue (%1)  No attribute defined!").arg(v));
    73 		return;	
    74 	}	
    75 	definition->setValue (v);
    76 */
    77 }
    78 
    79 QVariant AttributeItem::getValue()
    80 {
    81 /*
    82 	if (!table)
    83 	{
    84 		qWarning ("AttributeItem::getValue  No table defined!");
    85 		return QString();	
    86 	}
    87 	if (!definition)
    88 	{
    89 		qWarning ("AttributeItem::getValue  No attribute defined!");
    90 		return QString();	
    91 	}	
    92 	QVariant v= definition->getValue();
    93 	return v;
    94 	*/
    95 }
    96 
    97 void AttributeItem::setType (const Type &t)
    98 {
    99 /*
   100 	if (!table)
   101 	{
   102 		qWarning ("AttributeItem::setType  No table defined!");
   103 		return;
   104 	}
   105 	if (!definition)
   106 	{
   107 		qWarning ("Attribute::setType  No attribute defined!");
   108 		return; 
   109 	}	
   110 	definition->setType (t);
   111 */
   112 }
   113 
   114 AttributeItem::Type AttributeItem::getAttributeType()
   115 {
   116 /*
   117 	if (!table)
   118 	{
   119 		qWarning ("AttributeItem::getType  No table defined!");
   120 		return Undefined;	
   121 	}
   122 	if (!definition)
   123 	{
   124 		qWarning ("AttributeItem::getType  No attribute defined!");
   125 		return Undefined;	
   126 	}	
   127 	return definition->getType();
   128 */
   129 }
   130 
   131 QString AttributeItem::getTypeString()
   132 {
   133 /*
   134 	if (!table)
   135 	{
   136 		qWarning ("AttributeItem::getTypeString  No table defined!");
   137 		return "Undefined";	
   138 	}
   139 	if (!definition)
   140 	{
   141 		qWarning ("Attribute::getTypeString  No AttributeItem defined!");
   142 		return "Undefined";	
   143 	}	
   144 	return definition->getTypeString();
   145 */	
   146 }
   147 
   148 QString AttributeItem::getDataXML()
   149 {
   150 	QString a=beginElement ("attribute");
   151 	a+=attribut ("key",getKey());
   152 	a+=attribut ("value",getValue().toString() );
   153 	a+=attribut ("type",getTypeString () );
   154 	return a;
   155 }
   156