| 48 | } |
| 49 | |
| 50 | djinni::DataRef dataRefFromBytesView(const Valdi::BytesView& bytesView) { |
| 51 | auto existingDataRef = castOrNull<DataRefSimpleRef>(bytesView.getSource()); |
| 52 | if (existingDataRef != nullptr && existingDataRef->getDataRef().buf() == bytesView.data() && |
| 53 | existingDataRef->getDataRef().len() == bytesView.size()) { |
| 54 | return existingDataRef->getDataRef(); |
| 55 | } |
| 56 | |
| 57 | return djinni::DataRef(std::make_shared<DataRefValdi>(bytesView)); |
| 58 | } |
| 59 | } // namespace Valdi |