Example #1
0
void Node::output(ostream& printStream, int indentLevet) 
{
	char *indentString = getIndentLevelString(indentLevet);

	if (isInstanceNode() == false) {
		outputHead(printStream, indentString);
		outputContext(printStream, indentString);
	
		if (!isElevationGridNode() && !isShapeNode() && !isSoundNode() && !isPointSetNode() && !isIndexedFaceSetNode() && 
			!isIndexedLineSetNode() && !isTextNode() && !isAppearanceNode()) {
			if (getChildNodes() != NULL) {
				if (isLodNode()) 
					printStream << indentString << "\tlevel [" << endl;
				else if (isSwitchNode()) 
					printStream << indentString << "\tchoice [" << endl;
				else
					printStream << indentString <<"\tchildren [" << endl;
			
				for (Node *node = getChildNodes(); node; node = node->next()) {
					if (node->isInstanceNode() == false) 
						node->output(printStream, indentLevet+2);
					else
						node->output(printStream, indentLevet+2);
				}
			
				printStream << indentString << "\t]" << endl;
			}
		}
		outputTail(printStream, indentString);
	}
	else 
		printStream << indentString << "USE " << getName() << endl;

	delete indentString;
}
Example #2
0
void Node::outputContext(ostream& printStream, const char *indentString1, const char *indentString2) 
{
	char *indentString = new char[strlen(indentString1)+strlen(indentString2)+1];
	strcpy(indentString, indentString1);
	strcat(indentString, indentString2);
	outputContext(printStream, indentString);
	delete indentString;
}
Example #3
0
int H264::writeOutputPacket(uint8_t* buf, int size, int64_t pts)
{
	AVPacket packet;
	av_init_packet(&packet);
	
	packet.data = buf;
	packet.size = size;
	packet.pts = pts;
	packet.dts = AV_NOPTS_VALUE;
	packet.flags = AV_PKT_FLAG_KEY;
	
	return av_interleaved_write_frame(outputContext(), &packet);
}
Example #4
0
bool rab::WriteRegistry( Options const& options, Config const& config, FolderInfo& rootFolder, PackageOutput_t& package, LogOutput_t& out )
{
	out << "Creating registry file..." << std:: endl;

	_tstringstream stringStream;
	OutputContext outputContext( stringStream, out );

	if( !options.newVersion.empty() )
		outputContext.stream << _T("new_version=") << quote << options.newVersion << quote << endl;
	
	if( !options.oldVersion.empty() )
		outputContext.stream << _T("old_version=") << quote << options.oldVersion << quote << endl;

	Path_t relativePath;
	WriteRegistryFolders( options, config, FolderInfo::FolderInfos_t( 1, &rootFolder ), relativePath, outputContext );

	_tstring fileContent = stringStream.str();
	std::string fileContentUtf8 = loc::conv::utf_to_utf<char>( fileContent );

	if( !package.WriteFile( dung::REGISTRY_FILENAME, fileContentUtf8.c_str(), fileContentUtf8.size() ) )
	{
		out << "Can't write file " << dung::REGISTRY_FILENAME << " to package" << std::endl;
		return false;
	}

	if( options.produceTemp )
	{
		std::ofstream file ( dung::REGISTRY_FILENAME, std::ios::out|std::ios::binary|std::ios::trunc );
		if( !file.is_open() )
		{
			out << "Can't create " << dung::REGISTRY_FILENAME << std::endl;
			return false;
		}

		file.write( fileContentUtf8.c_str(), fileContentUtf8.size() );

		file.close();
	}

	return true;
}