Ejemplo n.º 1
0
static void cbExecCommandResult(CMessage &msgin, const std::string &serviceName, TServiceId sid)
{
	// treat the rely message sent back from a service whom we asked to execute a command
	NLMISC::InfoLog->displayNL("EXEC_COMMAND_RESULT' Received from: %3d: %s", sid.get() ,serviceName.c_str());

	// retrieve the text from the input message
	CSString txt;
	msgin.serial(txt);

	// divide the text into lines because NeL doesn't like long texts
	CVectorSString lines;
	txt.splitLines(lines);

	// display the lines of text
	for (uint32 i=0;i<lines.size();++i)
	{
		NLMISC::InfoLog->displayNL("%s",lines[i].c_str());
	}
}
Ejemplo n.º 2
0
// update all items with new values
int updateItems(const char *filename)
{
	// verify file
	verifItemsFile(filename);

	CSString data;
	data.readFromFile(filename);

	CVectorSString lines;
	data.splitLines(lines);

	for (uint itemIndex=0 ; itemIndex<items.size() ; itemIndex++)
	{
		nlassert(fields.size() >= items[itemIndex].size());
		cout << "Updating item " << itemIndex << endl;

		uint a, b;
		getItemBounds(lines, itemIndex, a, b);

		// no bound found, it's a new item
		if (b == 0)
		{
			addNewItem(lines, itemIndex);
			getItemBounds(lines, itemIndex, a, b);
		}

		for (uint fieldIndex=0 ; fieldIndex<items[itemIndex].size() ; fieldIndex++)
			updateItemField(lines, itemIndex, fieldIndex, a, b);
	}

	// rewrite file
	data.clear();
	for (uint i=0 ; i<lines.size() ; i++)
		data += lines[i] + "\n";
	data.writeToFile(filename);

	return 0;
}