GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/logindata.h Lines: 4 7 57.1 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2017  The ManaPlus Developers
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#ifndef NET_LOGINDATA_H
24
#define NET_LOGINDATA_H
25
26
#include "enums/being/gender.h"
27
28
#include "enums/net/updatetype.h"
29
30
#include "utils/stringvector.h"
31
32
#include "localconsts.h"
33
34
72
class LoginData final
35
{
36
    public:
37
8
        LoginData() :
38
            username(),
39
            password(),
40
            newPassword(),
41
            updateHost(),
42
            updateHosts(),
43
            lastLogin(),
44
            updateType(UpdateType::Normal),
45
            email(),
46
            captchaResponse(),
47
            registerUrl(),
48
            gender(Gender::UNSPECIFIED),
49
            packetVersion(0),
50
            remember(false),
51
            registerLogin(false),
52
80
            characterSlots(9)
53
        {
54
8
        }
55
56
        A_DELETE_COPY(LoginData)
57
58
        std::string username;
59
        std::string password;
60
        std::string newPassword;
61
        std::string updateHost;
62
        StringVect updateHosts;
63
        std::string lastLogin;
64
        UpdateTypeT updateType;
65
66
        std::string email;
67
        std::string captchaResponse;
68
        std::string registerUrl;
69
70
        GenderT gender;
71
72
        int packetVersion;
73
        bool remember;       // Whether to store the username.
74
        bool registerLogin;  // Whether an account is being registered.
75
76
        uint16_t characterSlots;  // The number of character slots
77
78
        void clear()
79
        {
80
            username.clear();
81
            password.clear();
82
            newPassword.clear();
83
            updateHost.clear();
84
            updateHosts.clear();
85
            updateType = UpdateType::Normal;
86
            email.clear();
87
            captchaResponse.clear();
88
            registerUrl.clear();
89
            gender = Gender::UNSPECIFIED;
90
            packetVersion = 0;
91
            lastLogin.clear();
92
            resetCharacterSlots();
93
        }
94
95
        void clearUpdateHost()
96
        {
97
            updateHost.clear();
98
            updateHosts.clear();
99
        }
100
101
        /**
102
         * Initialize character slots to 3 for TmwAthena compatibility
103
         */
104
        void resetCharacterSlots()
105
        {
106
            characterSlots = 9;  // Default value, used for TmwAthena.
107
        }
108
};
109
110
#endif  // NET_LOGINDATA_H