~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/user.h

  • Committer: Olaf van der Spek
  • Date: 2011-04-05 12:26:58 UTC
  • mto: (2278.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2272.
  • Revision ID: olafvdspek@gmail.com-20110405122658-xxrvmobwwwwf3oct
Refactor Open_tables_state

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
 
22
 
#ifndef DRIZZLED_IDENTIFIER_USER_H
23
 
#define DRIZZLED_IDENTIFIER_USER_H
 
21
#pragma once
24
22
 
25
23
#include <string>
26
24
#include <boost/shared_ptr.hpp>
27
 
 
 
25
#include <drizzled/common_fwd.h>
 
26
#include <drizzled/identifier.h>
28
27
#include <drizzled/visibility.h>
29
28
 
30
 
namespace drizzled
31
 
{
32
 
namespace identifier
33
 
{
 
29
namespace drizzled {
 
30
namespace identifier {
34
31
 
35
32
/**
36
33
  @class User
40
37
class User : public Identifier
41
38
{
42
39
public:
43
 
  typedef boost::shared_ptr<User> shared_ptr;
44
 
  typedef boost::shared_ptr<const User> const_shared_ptr;
45
 
  typedef const User& const_reference;
46
 
  DRIZZLED_API static shared_ptr make_shared();
 
40
  DRIZZLED_API static user::mptr make_shared();
47
41
 
48
42
  enum PasswordType
49
43
  {
53
47
  };
54
48
 
55
49
  User():
56
 
    password_type(NONE),
57
 
    _user(""),
58
 
    _address("")
 
50
    password_type(NONE)
59
51
  { }
60
52
 
61
 
  virtual void getSQLPath(std::string &arg) const;
 
53
  virtual std::string getSQLPath() const
 
54
        {
 
55
                return _user.empty() ? "<no user>" : _user;
 
56
        }
62
57
 
63
58
  bool hasPassword() const
64
59
  {
65
 
    switch (password_type)
66
 
    {
67
 
    case NONE:
68
 
      return false;
69
 
    case PLAIN_TEXT:
70
 
    case MYSQL_HASH:
71
 
      break;
72
 
    }
73
 
 
74
 
    return true;
 
60
    return password_type != NONE;
75
61
  }
76
62
 
77
63
  const std::string& address() const
81
67
 
82
68
  void setAddress(const char *newip)
83
69
  {
84
 
    _address.assign(newip);
 
70
    _address = newip;
85
71
  }
86
72
 
87
73
  const std::string& username() const
91
77
 
92
78
  void setUser(const std::string &newuser)
93
79
  {
94
 
    _user.assign(newuser);
 
80
    _user = newuser;
95
81
  }
96
82
 
97
 
  PasswordType getPasswordType(void) const
 
83
  PasswordType getPasswordType() const
98
84
  {
99
85
    return password_type;
100
86
  }
123
109
 
124
110
} /* namespace identifier */
125
111
} /* namespace drizzled */
126
 
 
127
 
#endif /* DRIZZLED_IDENTIFIER_USER_H */