示例#1
0
	void packFilesIncoming(
		std::vector<char> &buf,
		const std::unordered_multimap<std::string, Transfer::FileIncoming> &map
	) {
		packNumber(buf, map.size() );

		for (auto it = map.cbegin(); map.cend() != it; ++it) {
			packString(buf, it->first);

			const Transfer::FileIncoming &file = it->second;

			packString(buf, file.getTmpName() );
			packString(buf, file.getName() );
			packString(buf, file.getType() );
			packNumber(buf, file.getSize() );
		}
	}
示例#2
0
	void filesIncomingToRawFilesInfo(Utils::raw_fileinfo *raw[], const std::unordered_multimap<std::string, HttpServer::FileIncoming> &map)
	{
		if (raw && map.size() )
		{
			raw_fileinfo *arr = new raw_fileinfo[map.size()];

			*raw = arr;

			size_t i = 0;

			for (auto it = map.cbegin(); map.cend() != it; ++it, ++i)
			{
				arr[i].key = stlStringToPChar(it->first);

				const HttpServer::FileIncoming &file = it->second;

				arr[i].file_name = stlStringToPChar(file.getName() );
				arr[i].file_type = stlStringToPChar(file.getType() );
				arr[i].file_size = file.getSize();
			}
		}
	}