src/qvcore/qvpropertycontainerchange.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #include <QVPropertyContainerChange>
00026 #include <QVPropertyContainer>
00027 
00028 
00029 QVPropertyContainerChange::QVPropertyContainerChange(const QVPropertyContainer * container, const ChangeType type, const QString prop):
00030         QObject(), source(container), sourceName(""), origName(""), destName(""), changeType(type), propName(prop), destPropName(""), sinchronous(FALSE)
00031 {
00032         if (container != NULL)
00033                 sourceName = container->getName();
00034 }
00035 
00036 QVPropertyContainerChange::QVPropertyContainerChange(   const QVPropertyContainer * container,
00037                                                                                                                 const ChangeType type,
00038                                                                                                                 const QString contOrig,
00039                                                                                                                 const QString propOrig,
00040                                                                                                                 const QString contDest,
00041                                                                                                                 const QString propDest,
00042                                                                                                                 const bool sinc):
00043         QObject(), source(container), sourceName(""), origName(contOrig), destName(contDest), changeType(type), propName(propOrig), destPropName(propDest),
00044         sinchronous(sinc)
00045 {
00046         if (container != NULL)
00047                 sourceName = container->getName();
00048 }
00049 
00050 
00051 QString QVPropertyContainerChange::toString() const
00052 {
00053         QString result("Change emited from ");
00054         result+= sourceName;
00055         result += ", of type ";
00056 
00057         switch (changeType) {
00058         case Name:
00059                 result += "Name";
00060                 break;
00061 //      case ContainerAdd:
00062 //              result += "ContainerAdd";
00063 //              break;
00064         case ContainerDel:
00065                 result += "ContainerDel";
00066                 break;
00067         case PropertyAdd:
00068                 result += "PropertyAdd: ";
00069                 result += propName;
00070                 break;
00071         case PropertyDel:
00072                 result += "PropertyDel: ";
00073                 result += propName;
00074                 break;
00075         case PropertyValue:
00076                 result += "PropertyValue: ";
00077                 result += propName;
00078                 break;
00079         case LinkAdd:
00080                 result += "LinkAdd: ";
00081                 result += origName;
00082                 result += "[";
00083                 result += propName;
00084                 result += "] => ";
00085                 result += destName;
00086                 result += "[";
00087                 result += destPropName;
00088                 result += "]";
00089                 break;
00090         case LinkDel:
00091                 result += "LinkDel: ";
00092                 result += origName;
00093                 result += "[";
00094                 result += propName;
00095                 result += "] => ";
00096                 result += destName;
00097                 result += "[";
00098                 result += destPropName;
00099                 result += "]";
00100                 break;
00101         case All:
00102                 result += "All";
00103                 break;
00104         default:
00105                 result += "None";
00106                 break;
00107         }
00108         result += ".";
00109 
00110         return result;
00111 }
00112