| 873 | } |
| 874 | |
| 875 | void Object::load(QDataStream &stream) |
| 876 | { |
| 877 | // Start from 1 to skip QObject::objectName |
| 878 | for (int i=1; i<metaObject()->propertyCount(); i++) { |
| 879 | QMetaProperty property = metaObject()->property(i); |
| 880 | if (!property.isStored(this)) |
| 881 | continue; |
| 882 | |
| 883 | const QString type = property.typeName(); |
| 884 | if (type == "QList<br::Transform*>") { |
| 885 | foreach (Transform *transform, property.read(this).value< QList<Transform*> >()) |
| 886 | transform->load(stream); |
| 887 | } else if (type == "QList<br::Distance*>") { |
| 888 | foreach (Distance *distance, property.read(this).value< QList<Distance*> >()) |
| 889 | distance->load(stream); |
| 890 | } else if (type == "QList<br::Representation*>") { |
| 891 | foreach (Representation *representation, property.read(this).value< QList<Representation*> >()) |
| 892 | representation->load(stream); |
| 893 | } else if (type == "QList<br::Classifier*>") { |
| 894 | foreach (Classifier *classifier, property.read(this).value< QList<Classifier*> >()) |
| 895 | classifier->load(stream); |
| 896 | } else if (type == "br::Transform*") { |
| 897 | property.read(this).value<Transform*>()->load(stream); |
| 898 | } else if (type == "br::Distance*") { |
| 899 | property.read(this).value<Distance*>()->load(stream); |
| 900 | } else if (type == "br::Representation*") { |
| 901 | property.read(this).value<Representation*>()->load(stream); |
| 902 | } else if (type == "br::Classifier*") { |
| 903 | property.read(this).value<Classifier*>()->load(stream); |
| 904 | } else if (type == "bool") { |
| 905 | bool value; |
| 906 | stream >> value; |
| 907 | property.write(this, value); |
| 908 | } else if (type == "int") { |
| 909 | int value; |
| 910 | stream >> value; |
| 911 | property.write(this, value); |
| 912 | } else if (type == "float") { |
| 913 | float value; |
| 914 | stream >> value; |
| 915 | property.write(this, value); |
| 916 | } else if (type == "double") { |
| 917 | double value; |
| 918 | stream >> value; |
| 919 | property.write(this, value); |
| 920 | } else if (type == "QString") { |
| 921 | QString value; |
| 922 | stream >> value; |
| 923 | property.write(this, value); |
| 924 | } else if (type == "QStringList") { |
| 925 | QStringList value; |
| 926 | stream >> value; |
| 927 | property.write(this, value); |
| 928 | } else { |
| 929 | qFatal("Can't serialize value of type: %s", qPrintable(type)); |
| 930 | } |
| 931 | } |
| 932 |
no test coverage detected