コード例 #1
0
ファイル: StringCell.cpp プロジェクト: abduld/llambda
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()
		);
	}
}
コード例 #2
0
QgsSymbolV2* QgsStyleV2::symbol( QString name )
{
  const QgsSymbolV2 *symbol = symbolRef( name );
  return symbol ? symbol->clone() : 0;
}
コード例 #3
0
ファイル: qgsstyle.cpp プロジェクト: fritsvanveen/QGIS
QgsSymbol* QgsStyle::symbol( const QString& name )
{
  const QgsSymbol *symbol = symbolRef( name );
  return symbol ? symbol->clone() : nullptr;
}