~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/user.h

  • Committer: Mark Atwood
  • Date: 2011-08-12 04:08:33 UTC
  • mfrom: (2385.2.17 refactor5)
  • Revision ID: me@mark.atwood.name-20110812040833-u6j85nc6ahuc0dtz
mergeĀ lp:~olafvdspek/drizzle/refactor5

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():
 
50
    password_type(NONE)
 
51
  { }
 
52
 
 
53
  User(const std::string &username_arg):
56
54
    password_type(NONE),
57
 
    _user(""),
 
55
    _user(username_arg),
58
56
    _address("")
59
57
  { }
60
58
 
61
 
  virtual void getSQLPath(std::string &arg) const;
 
59
  virtual std::string getSQLPath() const
 
60
  {
 
61
    return _user.empty() ? "<no user>" : _user;
 
62
  }
62
63
 
63
64
  bool hasPassword() const
64
65
  {
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;
 
66
    return password_type != NONE;
75
67
  }
76
68
 
77
69
  const std::string& address() const
81
73
 
82
74
  void setAddress(const char *newip)
83
75
  {
84
 
    _address.assign(newip);
 
76
    _address = newip;
85
77
  }
86
78
 
87
79
  const std::string& username() const
91
83
 
92
84
  void setUser(const std::string &newuser)
93
85
  {
94
 
    _user.assign(newuser);
 
86
    _user = newuser;
95
87
  }
96
88
 
97
 
  PasswordType getPasswordType(void) const
 
89
  PasswordType getPasswordType() const
98
90
  {
99
91
    return password_type;
100
92
  }
123
115
 
124
116
} /* namespace identifier */
125
117
} /* namespace drizzled */
126
 
 
127
 
#endif /* DRIZZLED_IDENTIFIER_USER_H */