Beispiel #1
0
string User::GetJsonBySharedFilesList(bool full)
{
	string json;
	for (std::list<int>::iterator it=sharedFiles.begin(); it != sharedFiles.end(); ++it)
	{
		if(full)
		{
			File* file = new File();
			file->Load(*it);

			json += "{";
			json += "\"identifier\" : " + std::to_string(file->GetIdentifier())  + ",";
			json += "\"type\" : " + std::to_string(file->GetType()) + ",";
			json += "\"name\" : \"" + file->GetName() + "\",";
			json += "\"extension\" : \"" + file->GetExtension() + "\",";
			json += "\"sizeMB\" : " + std::to_string(file->GetSize()) + ",";
			json += "\"owner\" : " + file->GetOwner() + ",";
			json += "\"tags\" : " + file->GetTagsStr() + ",";
			if(file->IsDeleted())
				json += "\"delete\" : true,";
			else
				json += "\"delete\" : false,";
			json += "\"lastModifiedOn\" : \"" + to_string(file->GetLastModifiedOn()) + "\",";
			json += "\"lastModifiedBy\" : \"" + file->GetLastModifiedBy() + "\",";
			json += "\"lastVersion\" : " + std::to_string(file->GetLastVersion()) + ",";
			json += "\"versions\" : " + file->GetVersionsStr();

			delete file;

			json += "},";

		}
		else
			json += std::to_string(*it) + ",";
	}
	return json.substr(0, json.length() - 1);
}