StringCell* StringCell::fromSymbol(World &world, SymbolCell *symbol) { alloc::SymbolRef symbolRef(world, symbol); void *cellPlacement = alloc::allocateCells(world); if (symbolRef->dataIsInline()) { auto inlineSymbol = static_cast<InlineSymbolCell*>(symbolRef.data()); auto inlineString = new (cellPlacement) InlineStringCell( inlineSymbol->inlineByteLength(), inlineSymbol->inlineCharLength() ); // Copy the inline data over const void *srcData = inlineSymbol->inlineData(); memcpy(inlineString->inlineData(), srcData, inlineSymbol->inlineByteLength()); return inlineString; } else { auto heapSymbol = static_cast<HeapSymbolCell*>(symbolRef.data()); // Share the heap symbols's byte array return new (cellPlacement) HeapStringCell( heapSymbol->heapByteArray()->ref(), heapSymbol->heapByteLength(), heapSymbol->heapCharLength() ); } }
QgsSymbolV2* QgsStyleV2::symbol( QString name ) { const QgsSymbolV2 *symbol = symbolRef( name ); return symbol ? symbol->clone() : 0; }
QgsSymbol* QgsStyle::symbol( const QString& name ) { const QgsSymbol *symbol = symbolRef( name ); return symbol ? symbol->clone() : nullptr; }