2009-11-21 00:09:52 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2009-11-21 00:09:52 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2014-02-12 17:30:49 +01:00
|
|
|
* Copyright (c) 2008-2014, Tomasz Sowa
|
2009-11-21 00:09:52 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_core_sessionparser
|
|
|
|
#define headerfile_winix_core_sessionparser
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
|
|
|
#include "session.h"
|
|
|
|
#include "sessioncontainer.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "users.h"
|
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
class SessionParser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
bool Parse(const char * path, SessionContainer & container);
|
|
|
|
bool Parse(const std::string & path, SessionContainer & container);
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetUsers(Users * pusers);
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
private:
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
Users * users;
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
bool Parse(SessionContainer & container);
|
2012-03-17 06:11:23 +01:00
|
|
|
void MakeSession(long id, long user_id, SessionContainer & container);
|
2009-11-21 00:09:52 +01:00
|
|
|
|
|
|
|
bool IsWhite(int c);
|
|
|
|
bool IsDigit(int c);
|
|
|
|
void SkipWhite();
|
|
|
|
void SkipLine();
|
|
|
|
|
|
|
|
long ReadLong();
|
|
|
|
|
|
|
|
std::ifstream file;
|
|
|
|
int last; // last character
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
|
|
|
|
} // namespace Winix
|
|
|
|
|
|
|
|
|
2009-11-21 00:09:52 +01:00
|
|
|
#endif
|
|
|
|
|