logon_mgr.h 710 Bytes
#ifndef ETRADECLIENT_UTILITY_LOGON_MGR_H_INCLUDED
#define ETRADECLIENT_UTILITY_LOGON_MGR_H_INCLUDED

#include <string>

class LogonMgr
{
public:
	static LogonMgr& Instance();

	bool DoLogin(const std::wstring& account, const std::wstring& pwd, const std::string& type, std::string &sMerName);
	bool DoLogout();
	const std::wstring& ErrorMsg() const;

	bool IsFirstLogin();

private:
	LogonMgr();
	LogonMgr(const LogonMgr&);
	LogonMgr& operator=(const LogonMgr&);

	bool GetLoginResult(const std::string& response_str, std::string &sMerName); //Parse the response string which is a JSON string.
private:
	bool		 m_is_first_login;
	std::wstring m_err_msg;
};

#endif // ETRADECLIENT_UTILITY_LOGON_MGR_H_INCLUDED