Ejemplo n.º 1
0
TInt CFileOperate::WriteFileL(const TDesC& aFileName)
	{
	int pos = aFileName.LocateReverse( '\\');
	if (pos!=KErrNotFound)
		{
		TPtrC dirName = aFileName.Left(pos+1);
		CCoeEnv::Static()->FsSession().MkDirAll(dirName);
		}

	RFile file;

	TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite);
	CleanupClosePushL(file);
	if (KErrNone != err)
		{
		CleanupStack::PopAndDestroy(1); // file
		return err;
		}

	RFileWriteStream outputFileStream(file);
	CleanupClosePushL(outputFileStream);

	iNotifier->FileWriteData(outputFileStream);

	CleanupStack::PopAndDestroy(2); // outputFileStream, file
	return KErrNone;
	}
void CTangImageDataWriter::SaveDataToFile(const TDesC& aFileName)
	{
	GenerateElementsData();
	
	int pos = aFileName.LocateReverse( '\\');
	if (pos!=KErrNotFound)
		{
		TPtrC dirName = aFileName.Left(pos+1);
		CCoeEnv::Static()->FsSession().MkDirAll(dirName);
		}
		
	RFile file;

	TInt err = file.Replace(CCoeEnv::Static()->FsSession(), aFileName, EFileWrite);
	CleanupClosePushL(file);
	if (KErrNone != err)
		{
		CleanupStack::PopAndDestroy(1); // file
		return;
		}

	RFileWriteStream outputFileStream(file);
	CleanupClosePushL(outputFileStream);
	outputFileStream.WriteL(iRequestXml->Des());

	CleanupStack::PopAndDestroy(2); // outputFileStream, file	
	}
Ejemplo n.º 3
0
// -----------------------------------------------------------------------------
// CHelloS60AppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CHelloS60AppUi::ConstructL()
{
    // Initialise app UI with standard value.
    BaseConstructL(CAknAppUi::EAknEnableSkin);

    // Create view object
    iAppView = CHelloS60AppView::NewL(ClientRect());
    AddToStackL(iAppView);

    // Create a file to write the text to
    TInt err = CCoeEnv::Static()->FsSession().MkDirAll(KFileName);
    if ((KErrNone != err) && (KErrAlreadyExists != err))
    {
        return;
    }

    RFile file;
    err = file.Replace(CCoeEnv::Static()->FsSession(), KFileName, EFileWrite);
    CleanupClosePushL(file);
    if (KErrNone != err)
    {
        CleanupStack::PopAndDestroy(1); // file
        return;
    }

    RFileWriteStream outputFileStream(file);
    CleanupClosePushL(outputFileStream);
    outputFileStream << KText;

    CleanupStack::PopAndDestroy(2); // outputFileStream, file

}
Ejemplo n.º 4
0
void FilesManager::createFileIfNotExisting(const char* fileName) {
	std::ifstream inputFileStream;
	inputFileStream.open(fileName, std::ios::in | std::ios::binary);
	if(!inputFileStream) {
		std::ofstream outputFileStream(fileName, std::ios::out | std::ios::binary);
		outputFileStream.close();
	}
	inputFileStream.close();
}
Ejemplo n.º 5
0
/**
 * @brief Completes the second phase of Symbian object construction. 
 * Put initialization code that could leave here. 
 */ 
void CStarDictAppUi::ConstructL()
{
	// [[[ begin generated region: do not modify [Generated Contents]
	
	//BaseConstructL( EAknEnableSkin  | EAknEnableMSK ); 
	BaseConstructL( EAknEnableSkin );

	iDictFactory = CDictFactory::NewL();
	CleanupStack::PushL(iDictFactory);
	CleanupStack::Pop(iDictFactory);
	InitializeContainersL();
	// ]]] end generated region [Generated Contents]
	

	if (iDictFactory->IsDictionaryPresent())
	{
		TDesC *name, *path;

		name = path = NULL;
		TInt currentDatabase = iDictFactory->GetCurrentDataBase();
		if (iDictFactory->GetDataBaseName(currentDatabase, &name, &path))
		{
			if (name)
			{
				iStarDictContainerView->SetDictionaryName(*name);
			}
		}
	}

	iViewId1 = iStarDictContainerView->Id();
	iViewId2 = iDictMeaningContainerView->Id();

	// Create a file to write the text to
	TInt err = CCoeEnv::Static()->FsSession().MkDirAll( KFileName );
	if( ( KErrNone != err ) && ( KErrAlreadyExists != err ) )
	{
		return;
	}

	RFile file;
	err = file.Replace( CCoeEnv::Static()->FsSession(), KFileName, EFileWrite );
	CleanupClosePushL( file );
	if( KErrNone != err )
	{
		CleanupStack::PopAndDestroy( 1 ); // file
		return;
	}

	RFileWriteStream outputFileStream( file );
	CleanupClosePushL( outputFileStream );
	outputFileStream << KText;

	CleanupStack::PopAndDestroy( 2 ); // outputFileStream, file
}
Ejemplo n.º 6
0
void writeBoundaryLabelFile(const std::vector< std::vector<int> >& boundaryLabels, const std::string outputBoundaryLabelFilename) {
	std::ofstream outputFileStream(outputBoundaryLabelFilename.c_str(), std::ios_base::out);
	if (outputFileStream.fail()) {
		std::cerr << "error: can't open output file (" << outputBoundaryLabelFilename << ")" << std::endl;
		exit(1);
	}

	int boundaryTotal = static_cast<int>(boundaryLabels.size());
	for (int boundaryIndex = 0; boundaryIndex < boundaryTotal; ++boundaryIndex) {
		outputFileStream << boundaryLabels[boundaryIndex][0] << " ";
		outputFileStream << boundaryLabels[boundaryIndex][1] << " ";
		outputFileStream << boundaryLabels[boundaryIndex][2] << std::endl;
	}
	outputFileStream.close();
}
Ejemplo n.º 7
0
void writeDisparityPlaneFile(const std::vector< std::vector<double> >& disparityPlaneParameters, const std::string outputDisparityPlaneFilename) {
	std::ofstream outputFileStream(outputDisparityPlaneFilename.c_str(), std::ios_base::out);
	if (outputFileStream.fail()) {
		std::cerr << "error: can't open file (" << outputDisparityPlaneFilename << ")" << std::endl;
		exit(0);
	}

	int segmentTotal = static_cast<int>(disparityPlaneParameters.size());
	for (int segmentIndex = 0; segmentIndex < segmentTotal; ++segmentIndex) {
		outputFileStream << disparityPlaneParameters[segmentIndex][0] << " ";
		outputFileStream << disparityPlaneParameters[segmentIndex][1] << " ";
		outputFileStream << disparityPlaneParameters[segmentIndex][2] << std::endl;
	}

	outputFileStream.close();
}
Ejemplo n.º 8
0
void MasterDegreesComputer::saveDegreesComputation(int numberOfProcesses, int maxCard, int minCard, int globalIterator)
{
	std::cout << "	Begin Saving Degrees Computation\n";

	std::stringstream globalIteratorStream; globalIteratorStream << globalIterator;

	std::ofstream outputFileStream((PreprocessingFolderStructureManager::getDegreesComputationFolderPath(false) + "DegreesComputationStatistics").c_str(), std::ios::app);
	outputFileStream << "Details about the Degrees Computation Iteration " << globalIterator << "\n";
	outputFileStream << "Number of Processes = " << numberOfProcesses << "\n";
	outputFileStream << "Maximum Cardinality = " << maxCard << "\n";
	outputFileStream << "Minimum Cardinality = " << minCard << "\n\n";
	outputFileStream.close();

	outputFileStream.open((PreprocessingFolderStructureManager::getDegreesComputationFolderPath(true) + "DegreesComputation.dat").c_str(), std::ios::binary | std::ios::app);
	outputFileStream.write((char*)&numberOfProcesses, sizeof(int));
	outputFileStream.close();

	std::cout << "	Degrees Computation Saving Complete\n";
}
Ejemplo n.º 9
0
	void ProjectImpl::compileAllAssets(const char* rendererTarget)
	{
		RendererRuntime::AssetPackage outputAssetPackage;

		{ // Compile all assets
			const RendererRuntime::AssetPackage::SortedAssetVector& sortedAssetVector = mAssetPackage.getSortedAssetVector();
			const size_t numberOfAssets = sortedAssetVector.size();
			for (size_t i = 0; i < numberOfAssets; ++i)
			{
				compileAsset(sortedAssetVector[i], rendererTarget, outputAssetPackage);
			}
		}

		{ // Write runtime asset package
		  // TODO(co) Experimental, make more generic elsewhere
			RendererRuntime::AssetPackage::SortedAssetVector& sortedAssetVector = outputAssetPackage.getWritableSortedAssetVector();

			// Ensure the asset package is sorted
			std::sort(sortedAssetVector.begin(), sortedAssetVector.end(), ::detail::orderByAssetId);

			// Open the output file
			std::ofstream outputFileStream("../" + getRenderTargetDataRootDirectory(rendererTarget) + mAssetPackageDirectoryName + "AssetPackage.assets", std::ios::binary);

			// Write down the asset package header
			#pragma pack(push)
			#pragma pack(1)
				struct AssetPackageHeader
				{
					uint32_t formatType;
					uint16_t formatVersion;
					uint32_t numberOfAssets;
				};
			#pragma pack(pop)
			AssetPackageHeader assetPackageHeader;
			assetPackageHeader.formatType	  = RendererRuntime::StringId("AssetPackage");
			assetPackageHeader.formatVersion  = 1;
			assetPackageHeader.numberOfAssets = sortedAssetVector.size();
			outputFileStream.write(reinterpret_cast<const char*>(&assetPackageHeader), sizeof(AssetPackageHeader));

			// Write down the asset package content in one single burst
			outputFileStream.write(reinterpret_cast<const char*>(sortedAssetVector.data()), sizeof(RendererRuntime::Asset) * assetPackageHeader.numberOfAssets);
		}
	}
Ejemplo n.º 10
0
void FileUtils::saveList(const std::string& list_fpath,
		const std::vector<std::string>& list) {

	// Open file
	std::ofstream outputFileStream(list_fpath.c_str(), std::fstream::out);

	// Check file
	if (outputFileStream.good() == false) {
		throw std::runtime_error(
				"Error while opening file [" + list_fpath + "] for writing\n");
	}

	// Save list to file
	for (const std::string& line : list) {
		outputFileStream << line << std::endl;
	}

	// Close file
	outputFileStream.close();
}
TBool RTestStepConvertAudio::CheckConversionL()
	{
	RFile outputFile; //output file
	RFile refFile; //reference file
	
	//open the files
	User::LeaveIfError(outputFile.Open(iFs, iToFileName, EFileRead|EFileShareAny));
	CleanupClosePushL(outputFile);
	User::LeaveIfError(refFile.Open(iFs, iToFileName, EFileRead|EFileShareAny));  // this is changed because of fix for DEF145347 (TSW id : ESLM-844Q3G). As file size is changing everytime, we should compare with output file always
	CleanupClosePushL(refFile);	

	TInt err = KErrNone;
	//read contents of output file using file stream
	RFileReadStream outputFileStream(outputFile, 0);
	CleanupClosePushL(outputFileStream);
	HBufC8* outputFileBuf = HBufC8::NewLC(KNumBytesToCompare);
	TPtr8 outputData = outputFileBuf->Des();
	TRAP(err, outputFileStream.ReadL(outputData));
	if ((err != KErrNone) && (err != KErrEof)) 
		{
		User::Leave(err);	
		}

	//read contents of reference file using file stream
	RFileReadStream refFileStream(refFile, 0);
	CleanupClosePushL(refFileStream);
	HBufC8* refFileBuf = HBufC8::NewLC(KNumBytesToCompare);
	TPtr8 refData = refFileBuf->Des();
	TRAP(err, refFileStream.ReadL(refData))
	if ((err != KErrNone) && (err != KErrEof)) 
		{
		User::Leave(err);	
		}		
			
	TInt result = refFileBuf->Compare(*outputFileBuf);
	INFO_PRINTF2(_L("Result = %d"), result);	

	CleanupStack::PopAndDestroy(6, &outputFile);
	return (result == 0);
	}
Ejemplo n.º 12
0
	void SceneAssetCompiler::compile(const Input& input, const Configuration& configuration, Output& output)
	{
		// Input, configuration and output
		const std::string&			   assetInputDirectory	= input.assetInputDirectory;
		const std::string&			   assetOutputDirectory	= input.assetOutputDirectory;
		RendererRuntime::AssetPackage& outputAssetPackage	= *output.outputAssetPackage;

		// Get the JSON asset object
		const rapidjson::Value& rapidJsonValueAsset = configuration.rapidJsonDocumentAsset["Asset"];

		// Read configuration
		// TODO(co) Add required properties
		std::string inputFile;
		{
			// Read scene asset compiler configuration
			const rapidjson::Value& rapidJsonValueSceneAssetCompiler = rapidJsonValueAsset["SceneAssetCompiler"];
			inputFile = rapidJsonValueSceneAssetCompiler["InputFile"].GetString();
		}

		// Open the input file
		const std::string inputFilename = assetInputDirectory + inputFile;
		std::ifstream inputFileStream(inputFilename, std::ios::binary);
		const std::string assetName = rapidJsonValueAsset["AssetMetadata"]["AssetName"].GetString();
		const std::string outputAssetFilename = assetOutputDirectory + assetName + ".scene";
		std::ofstream outputFileStream(outputAssetFilename, std::ios::binary);

		{ // Scene
			// Parse JSON
			rapidjson::Document rapidJsonDocument;
			JsonHelper::parseDocumentByInputFileStream(rapidJsonDocument, inputFileStream, inputFilename, "SceneAsset", "1");

			{ // Write down the scene resource header
				RendererRuntime::v1Scene::Header sceneHeader;
				sceneHeader.formatType	  = RendererRuntime::v1Scene::FORMAT_TYPE;
				sceneHeader.formatVersion = RendererRuntime::v1Scene::FORMAT_VERSION;
				outputFileStream.write(reinterpret_cast<const char*>(&sceneHeader), sizeof(RendererRuntime::v1Scene::Header));
			}

			// Mandatory main sections of the material blueprint
			const rapidjson::Value& rapidJsonValueSceneAsset = rapidJsonDocument["SceneAsset"];
			const rapidjson::Value& rapidJsonValueNodes = rapidJsonValueSceneAsset["Nodes"];

			{ // Write down the scene nodes
				RendererRuntime::v1Scene::Nodes nodes;
				nodes.numberOfNodes = rapidJsonValueNodes.MemberCount();
				outputFileStream.write(reinterpret_cast<const char*>(&nodes), sizeof(RendererRuntime::v1Scene::Nodes));

				// Loop through all scene nodes
				for (rapidjson::Value::ConstMemberIterator rapidJsonMemberIteratorNodes = rapidJsonValueNodes.MemberBegin(); rapidJsonMemberIteratorNodes != rapidJsonValueNodes.MemberEnd(); ++rapidJsonMemberIteratorNodes)
				{
					const rapidjson::Value& rapidJsonValueNode = rapidJsonMemberIteratorNodes->value;
					const rapidjson::Value* rapidJsonValueItems = rapidJsonValueNode.HasMember("Items") ? &rapidJsonValueNode["Items"] : nullptr;

					{ // Write down the scene node
						RendererRuntime::v1Scene::Node node;

						// Get the scene node transform
						node.transform.scale = glm::vec3(1.0f, 1.0f, 1.0f);
						if (rapidJsonValueNode.HasMember("Properties"))
						{
							const rapidjson::Value& rapidJsonValueProperties = rapidJsonValueNode["Properties"];

							// Position, rotation and scale
							JsonHelper::optionalFloatNProperty(rapidJsonValueProperties, "Position", &node.transform.position.x, 3);
							JsonHelper::optionalFloatNProperty(rapidJsonValueProperties, "Rotation", &node.transform.rotation.x, 4);
							JsonHelper::optionalFloatNProperty(rapidJsonValueProperties, "Scale", &node.transform.scale.x, 3);
						}

						// Write down the scene node
						node.numberOfItems = (nullptr != rapidJsonValueItems) ? rapidJsonValueItems->MemberCount() : 0;
						outputFileStream.write(reinterpret_cast<const char*>(&node), sizeof(RendererRuntime::v1Scene::Node));
					}

					// Write down the scene items
					if (nullptr != rapidJsonValueItems)
					{
						for (rapidjson::Value::ConstMemberIterator rapidJsonMemberIteratorItems = rapidJsonValueItems->MemberBegin(); rapidJsonMemberIteratorItems != rapidJsonValueItems->MemberEnd(); ++rapidJsonMemberIteratorItems)
						{
							const rapidjson::Value& rapidJsonValueItem = rapidJsonMemberIteratorItems->value;
							const RendererRuntime::SceneItemTypeId typeId = RendererRuntime::StringId(rapidJsonMemberIteratorItems->name.GetString());

							// Get the scene item type specific data number of bytes
							// TODO(co) Make this more generic via scene factory
							uint32_t numberOfBytes = 0;
							if (RendererRuntime::CameraSceneItem::TYPE_ID == typeId)
							{
								// Nothing here
							}
							else if (RendererRuntime::MeshSceneItem::TYPE_ID == typeId)
							{
								numberOfBytes = sizeof(RendererRuntime::v1Scene::MeshItem);
							}

							{ // Write down the scene item header
								RendererRuntime::v1Scene::ItemHeader itemHeader;
								itemHeader.typeId		 = typeId;
								itemHeader.numberOfBytes = numberOfBytes;
								outputFileStream.write(reinterpret_cast<const char*>(&itemHeader), sizeof(RendererRuntime::v1Scene::ItemHeader));
							}

							// Write down the scene item type specific data, if there is any
							if (0 != numberOfBytes)
							{
								if (RendererRuntime::CameraSceneItem::TYPE_ID == typeId)
								{
									// Nothing here
								}
								else if (RendererRuntime::MeshSceneItem::TYPE_ID == typeId)
								{
									// Map the source asset ID to the compiled asset ID
									const RendererRuntime::AssetId compiledAssetId = JsonHelper::getCompiledAssetId(input, rapidJsonValueItem, "MeshAssetId");

									// Write the mesh item data
									RendererRuntime::v1Scene::MeshItem meshItem;
									meshItem.meshAssetId = compiledAssetId;
									outputFileStream.write(reinterpret_cast<const char*>(&meshItem), sizeof(RendererRuntime::v1Scene::MeshItem));
								}
							}
						}
					}
				}
			}
		}

		{ // Update the output asset package
			const std::string assetCategory = rapidJsonValueAsset["AssetMetadata"]["AssetCategory"].GetString();
			const std::string assetIdAsString = input.projectName + "/Scene/" + assetCategory + '/' + assetName;

			// Output asset
			RendererRuntime::Asset outputAsset;
			outputAsset.assetId = RendererRuntime::StringId(assetIdAsString.c_str());
			strcpy(outputAsset.assetFilename, outputAssetFilename.c_str());	// TODO(co) Buffer overflow test
			outputAssetPackage.getWritableSortedAssetVector().push_back(outputAsset);
		}
	}
Ejemplo n.º 13
0
void VStreamsUnit::_testStreamTailer() {
    /* example: how to tail the system log for a minute: */
    
    /*
    VFSNode f("/var/log/system.log");
    TestTailHandler sysLogTestHandler;
    VTextTailRunner sysLogTailRunner(f, sysLogTestHandler);
    sysLogTailRunner.start();
    VThread::sleep(10 * VDuration::SECOND());
    sysLogTailRunner.stop(); // Calling stop() is optional; can just destruct.
    */

    VFSNode tempDir = VFSNode::getKnownDirectoryNode(VFSNode::CACHED_DATA_DIRECTORY, "vault", "unittest");
    VFSNode testDirRoot(tempDir, "vstreamsunit_temp");
    (void) testDirRoot.rm();
    testDirRoot.mkdirs();
    
    // Create a test file and open it for writing, and create an output text stream for it.
    VFSNode testFileNode(testDirRoot, "tailed_file.txt");
    VBufferedFileStream outputFileStream(testFileNode);
    outputFileStream.openWrite();
    VTextIOStream outputStream(outputFileStream, VTextIOStream::kUseUnixLineEndings); // assertions below assume 1 code point written for line endings, so don't write DOS 2-byte line endings even on Windows
    
    // First, write 3 lines of initial content.
    outputStream.writeLine("zero");
    outputStream.writeLine("one");
    outputStream.writeLine("two");
    outputStream.flush();
    
    // Open the file read-only and create an input text stream for it.
    VBufferedFileStream inputFileStream(testFileNode);
    inputFileStream.openReadOnly();

    // Now create a file tailer.
    // It should "immediately" (separate thread) read the existing data (since our read mark is at the start).
    bool processByLine = true; // switch to test other mode
    bool callStop = false;     // switch to test other mode
    TestTailHandler testHandler;
    VTextTailRunner tailRunner(inputFileStream, testHandler, processByLine);
    tailRunner.start();
    
    VThread::sleep(VDuration::SECOND());
    if (processByLine) {
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getNumProcessedLines(), 3, "3 initial lines");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedLine(0), "zero", "line zero");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedLine(1), "one", "line one");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedLine(2), "two", "line two");
    } else {
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getNumProcessedCodePoints(), 13, "13 initial code points");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedCodePoint(0), VCodePoint('z'), "code point [0]");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedCodePoint(5), VCodePoint('o'), "code point [5]");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedCodePoint(9), VCodePoint('t'), "code point [9]");
    }
    
    // Write two more lines and verify they are processed.
    outputStream.writeLine("three");
    outputStream.writeLine("four");
    outputStream.flush();

    VThread::sleep(2 * VDuration::SECOND());
    if (processByLine) {
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getNumProcessedLines(), 5, "5 total lines");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedLine(3), "three", "line three");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedLine(4), "four", "line four");
    } else {
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getNumProcessedCodePoints(), 24, "24 initial code points");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedCodePoint(13), VCodePoint('t'), "code point [13]");
        VUNIT_ASSERT_EQUAL_LABELED(testHandler.getProcessedCodePoint(19), VCodePoint('f'), "code point [19]");
    }
    
    if (callStop) {
        tailRunner.stop(); // Calling stop() is optional; can just destruct.
    }

}
Ejemplo n.º 14
0
	void ShaderPieceAssetCompiler::compile(const Input& input, const Configuration& configuration, Output& output)
	{
		// Input, configuration and output
		const std::string&			   assetInputDirectory	= input.assetInputDirectory;
		const std::string&			   assetOutputDirectory	= input.assetOutputDirectory;
		RendererRuntime::AssetPackage& outputAssetPackage	= *output.outputAssetPackage;

		// Get the JSON asset object
		const rapidjson::Value& rapidJsonValueAsset = configuration.rapidJsonDocumentAsset["Asset"];

		// Read configuration
		// TODO(co) Add required properties
		std::string inputFile;
		{
			// Read shader piece asset compiler configuration
			const rapidjson::Value& rapidJsonValueShaderPieceAssetCompiler = rapidJsonValueAsset["ShaderPieceAssetCompiler"];
			inputFile = rapidJsonValueShaderPieceAssetCompiler["InputFile"].GetString();
		}

		// Open the input file
		std::ifstream inputFileStream(assetInputDirectory + inputFile, std::ios::binary);
		const std::string assetName = rapidJsonValueAsset["AssetMetadata"]["AssetName"].GetString();
		const std::string outputAssetFilename = assetOutputDirectory + assetName + ".shader_piece";
		std::ofstream outputFileStream(outputAssetFilename, std::ios::binary);

		{ // Shader piece
			// Get file size and file data
			std::string sourceCode;
			{
				std::string originalSourceCode;
				inputFileStream.seekg(0, std::ifstream::end);
				const std::streampos numberOfBytes = inputFileStream.tellg();
				inputFileStream.seekg(0, std::ifstream::beg);
				originalSourceCode.resize(static_cast<size_t>(numberOfBytes));
				inputFileStream.read(const_cast<char*>(originalSourceCode.c_str()), numberOfBytes);

				// Strip comments from source code
				StringHelper::stripCommentsFromSourceCode(originalSourceCode, sourceCode);
			}
			const std::streampos numberOfBytes = sourceCode.length();

			{ // Shader piece header
				RendererRuntime::v1ShaderPiece::Header shaderPieceHeader;
				shaderPieceHeader.formatType					= RendererRuntime::v1ShaderPiece::FORMAT_TYPE;
				shaderPieceHeader.formatVersion					= RendererRuntime::v1ShaderPiece::FORMAT_VERSION;
				shaderPieceHeader.numberOfShaderSourceCodeBytes	= static_cast<uint32_t>(numberOfBytes);

				// Write down the shader piece header
				outputFileStream.write(reinterpret_cast<const char*>(&shaderPieceHeader), sizeof(RendererRuntime::v1ShaderPiece::Header));
			}

			// Dump the unchanged content into the output file stream
			outputFileStream.write(sourceCode.c_str(), numberOfBytes);
		}

		{ // Update the output asset package
			const std::string assetCategory = rapidJsonValueAsset["AssetMetadata"]["AssetCategory"].GetString();
			const std::string assetIdAsString = input.projectName + "/ShaderPiece/" + assetCategory + '/' + assetName;

			// Output asset
			RendererRuntime::Asset outputAsset;
			outputAsset.assetId = RendererRuntime::StringId(assetIdAsString.c_str());
			strcpy(outputAsset.assetFilename, outputAssetFilename.c_str());	// TODO(co) Buffer overflow test
			outputAssetPackage.getWritableSortedAssetVector().push_back(outputAsset);
		}
	}