| 53 | } |
| 54 | |
| 55 | void DataUtility::cloneData(DataPtr _target, DataPtr _prototype) |
| 56 | { |
| 57 | MYGUI_ASSERT(_target != _prototype, "Error clone self"); |
| 58 | MYGUI_ASSERT(_target->getType() == _prototype->getType(), "Error clone different types"); |
| 59 | MYGUI_ASSERT(_target->getChilds().empty(), "Target not empty"); |
| 60 | |
| 61 | copyProperty(_target, _prototype); |
| 62 | |
| 63 | for (Data::VectorData::const_iterator child = _prototype->getChilds().begin(); |
| 64 | child != _prototype->getChilds().end(); |
| 65 | child++) |
| 66 | { |
| 67 | DataPtr data = Data::CreateInstance(); |
| 68 | data->setType((*child)->getType()); |
| 69 | |
| 70 | _target->addChild(data); |
| 71 | |
| 72 | cloneData(data, *child); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | void DataUtility::copyProperty(DataPtr _target, DataPtr _prototype) |
| 77 | { |