Example #1
0
void SqlUtils::executeRefLoadCommand(std::string logPath, std::string bulkPath,
		std::string filename, Mapper * mapper) {
	std::string sql = determineSql(loadFile);
	std::string bulkDirectory = bulkPath + "/" + filename;

	sql = replacePlaceholder(sql, tableName, mapper->getTableName());
	sql = replacePlaceholder(sql, Ref::refIDColumn + datPlaceholder,
			"'" + mapper->getFilename(bulkDirectory, Ref::refIDColumn) + "'");
	sql = replacePlaceholder(sql, Ref::posColumn + datPlaceholder,
			"'" + mapper->getFilename(bulkDirectory, Ref::posColumn) + "'");
	sql = replacePlaceholder(sql, Ref::refNucColumn + datPlaceholder,
			"'" + mapper->getFilename(bulkDirectory, Ref::refNucColumn) + "'");
	executeCommand(logPath, sql, filename, mapper->getTableName());
}
void ChatExporterHtml::exportChat(WhatsappChat &chat, const std::string &filename)
{
	std::set<int> usedEmoticons;
	std::string messages = buildMessages(chat, usedEmoticons);

	std::string contact = chat.getKey();
	if (chat.getSubject().length() > 0)
	{
		contact += "; " + chat.getSubject();
	}

	std::string contactName = chat.getDisplayName();

	if (contactName == contact)
	{
		contactName = "";
	}

	std::ofstream file(filename.c_str());
	if (!file)
	{
		throw Exception("could not open chat export file");
	}

	std::string html = templateHtml;
	std::string heading = "WhatsApp Chat";
	replacePlaceholder(html, "%HEADING%", heading);
	replacePlaceholder(html, "%TITLE%", heading + " " + contact);
	replacePlaceholder(html, "%CONTACT%", contact);
	replacePlaceholder(html, "%CONTACT_NAME%", contactName);
	replacePlaceholder(html, "%MESSAGES%", messages);
	replacePlaceholder(html, "%EMOTICON_STYLES%", buildEmoticonStyles(usedEmoticons));

	file << html;
}
Example #3
0
std::string MarkerSection::formatSign(std::string format, const mc::SignEntity& sign) const {
	// sign text with prefix
	std::string textp = sign.getText();
	// sign text without prefix
	std::string text = textp;
	// remove prefix from sign text
	// but make sure there is also other text except the prefix, otherwise don't remove prefix
	if (textp.size() > prefix.getValue().size())
		text = util::trim(textp.substr(prefix.getValue().size()));

	// replace the placeholders with the sign data
	replacePlaceholder(format, "textp", textp);
	replacePlaceholder(format, "text", text);
	replacePlaceholder(format, "prefix", prefix.getValue());
	replacePlaceholder(format, "line1", sign.getLines()[0]);
	replacePlaceholder(format, "line2", sign.getLines()[1]);
	replacePlaceholder(format, "line3", sign.getLines()[2]);
	replacePlaceholder(format, "line4", sign.getLines()[3]);
	replacePlaceholder(format, "x", sign.getPos().x);
	replacePlaceholder(format, "y", sign.getPos().y);
	replacePlaceholder(format, "z", sign.getPos().z);
	return format;
}