Exemple #1
0
RESULT eServiceEvent::parseFrom(const std::string& filename, int tsidonid)
{
	if (!filename.empty())
	{
		int fd = ::open( filename.c_str(), O_RDONLY );
		if ( fd > -1 )
		{
			uint8_t buf[4096];
			int rd = ::read(fd, buf, 4096);
			::close(fd);
			if ( rd > 12 /*EIT_LOOP_SIZE*/ )
			{
				Event ev(buf);
				parseFrom(&ev, tsidonid);
				return 0;
			}
		}
	}
	return -1;
}
void CRecogStep::ConvertFileToPrivateL()
	{
	// Read source file
	RFile fromFile;	
	User::LeaveIfError(fromFile.Open(iTheFs, iFileName, EFileShareReadersOrWriters | EFileRead | EFileStream));
	CleanupClosePushL(fromFile);
	TInt size;
	User::LeaveIfError(fromFile.Size(size));
	HBufC8* memForFileContents = HBufC8::NewLC(size);
	TPtr8 fileContents(memForFileContents->Des());		
	User::LeaveIfError(fromFile.Read(fileContents, size));
	
	// Create destination path
	TDriveUnit sysDrive = RFs::GetSystemDrive();
	(void)iTheFs.CreatePrivatePath(static_cast<TInt> (sysDrive));
	TFileName newFileName;
	User::LeaveIfError(iTheFs.PrivatePath(newFileName));
	newFileName.Insert(0, sysDrive.Name());
	TParsePtr parseFrom(iFileName);
	newFileName.Append(parseFrom.NameAndExt());

	// Make sure destination does not already exist.
	(void) iTheFs.Delete(newFileName);

	// Copy file to private location
	RFile toFile;
	User::LeaveIfError(toFile.Create(iTheFs, newFileName, EFileShareExclusive | EFileWrite | EFileStream));
	CleanupClosePushL(toFile);

	User::LeaveIfError(toFile.Write(fileContents));

	// Update iFileName
	iFileName = newFileName;
	
	// Cleanup
	CleanupStack::PopAndDestroy(&toFile);
	CleanupStack::PopAndDestroy(memForFileContents);
	CleanupStack::PopAndDestroy(&fromFile);
	}
Exemple #3
0
AsteroidTypes::AsteroidType AsteroidTypes::parseFrom(const QString & data) {
    QByteArray dataBytes = data.toLocal8Bit();
    return parseFrom(dataBytes.data());
}
ModFilterTypes::ModFilterType ModFilterTypes::parseFrom(const QString & data) {
	QByteArray dataBytes = data.toLocal8Bit();
	return parseFrom(dataBytes.data());
}
		int EXIFInfo::parseFrom(const std::string &data) {
			return parseFrom((const unsigned char *)data.data(), data.length());
		}
bool ScriptChunk::parse(DATFile &dat) {
	clear();

	_signature = dat.getSignature();

	const Common::String *cmd, *arg;
	while (dat.nextLine(cmd, arg)) {
		debugC(2, kDebugScript, "Parsing script action \"%s\" [%s]", cmd->c_str(), arg->c_str());

		if (cmd->equalsIgnoreCase("Cond")) {
			// Found a condition

			if (!_conditions.empty()) {
				// Already got one, must belong to the next chunk
				dat.previous();
				break;
			}

			// A primary condition
			_conditions.push_back(*arg);
		} else if (cmd->equalsIgnoreCase("Cond2")) {
			// A secondary condition
			_conditions.push_back(*arg);
		} else if (cmd->matchString("*End", true)) {
			// Reached the end of the current verb section
			dat.previous();
			break;
		} else {
			// An action

			if (_conditions.empty()) {
				// We do need a condition first
				warning("ScriptChunk::parse(Script sync error, first line must be a condition");
				return false;
			}

			// Is this a known action?
			ScriptAction action = parseScriptAction(*cmd);
			if (action == kScriptActionNone) {
				if (cmd->equalsIgnoreCase("Chnage")) {
					// Workaround for OBJ_0307.DAT
					action = kScriptActionChange;
				} else {
					// No know action, die
					warning("ScriptChunk::parse(): Unknown script action \"%s\" (\"%s\")", cmd->c_str(), arg->c_str());
					return false;
				}
			}

			if (action == kScriptActionFrom)
				parseFrom(*arg);

			// Put the action into our list
			_actions.push_back(Action(action, *arg));
		}
	}

	uint32 lineNumber = _scriptRegister->getLine(*this);
	if (lineNumber == 0xFFFFFFFF) {
		clear();
		return true;
	}

	_ready = true;

	rewind();
	seekTo(lineNumber);

	_scriptRegister->addScript(*this);

	return true;
}
SpriteAnimationTypes::SpriteAnimationType SpriteAnimationTypes::parseFrom(const std::string & data) {
	return parseFrom(data.data());
}
Exemple #8
0
AsteroidTypes::AsteroidType AsteroidTypes::parseFrom(const std::string & data) {
	return parseFrom(data.data());
}
Exemple #9
0
HSLLocation::HSLLocation(const std::string &xmldata) {
   parseFrom(xmldata);
}