76 lines
1.1 KiB
C++
Executable File
76 lines
1.1 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "sessiondata.h"
|
|
|
|
|
|
namespace Ticket
|
|
{
|
|
|
|
SessionData::SessionData()
|
|
{
|
|
fun_rm = 0;
|
|
}
|
|
|
|
|
|
SessionData::~SessionData()
|
|
{
|
|
RemoveFileMap(create_file_map);
|
|
RemoveFileMap(edit_file_map);
|
|
}
|
|
|
|
|
|
|
|
void SessionData::RemoveFileMap(SessionData::FileMap & file_map)
|
|
{
|
|
FileMap::iterator i;
|
|
|
|
if( fun_rm )
|
|
{
|
|
for(i=file_map.begin() ; i!=file_map.end() ; ++i)
|
|
{
|
|
for(size_t a=0 ; a<i->second.size() ; ++a)
|
|
{
|
|
long file_id = i->second[a];
|
|
fun_rm->RemoveItemById(file_id);
|
|
}
|
|
}
|
|
|
|
file_map.clear();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Ticket & SessionData::GetTicket(long id, SessionData::TicketMap & ticket_map, bool * is_new)
|
|
{
|
|
std::pair<TicketMap::iterator, bool> res = ticket_map.insert( std::make_pair(id, Ticket()) );
|
|
|
|
if( is_new )
|
|
*is_new = res.second;
|
|
|
|
return res.first->second;
|
|
}
|
|
|
|
|
|
|
|
std::vector<long> & SessionData::GetFileTab(long id, FileMap & file_map)
|
|
{
|
|
std::pair<FileMap::iterator, bool> res = file_map.insert( std::make_pair(id, std::vector<long>()) );
|
|
|
|
return res.first->second;
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|