~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
 
 
28
 
#include "drizzled/visibility.h"
29
 
 
30
 
namespace drizzled
31
 
{
32
 
namespace identifier
33
 
{
 
25
#include <drizzled/common_fwd.h>
 
26
#include <drizzled/identifier.h>
 
27
#include <drizzled/visibility.h>
 
28
 
 
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
  {
 
44
    NONE,
50
45
    PLAIN_TEXT,
51
46
    MYSQL_HASH
52
47
  };
53
48
 
54
49
  User():
55
 
    password_type(PLAIN_TEXT),
56
 
    _user(""),
 
50
    password_type(NONE)
 
51
  { }
 
52
 
 
53
  User(const std::string &username_arg):
 
54
    password_type(NONE),
 
55
    _user(username_arg),
57
56
    _address("")
58
57
  { }
59
58
 
60
 
  virtual void getSQLPath(std::string &arg) const;
 
59
  virtual std::string getSQLPath() const
 
60
  {
 
61
    return _user.empty() ? "<no user>" : _user;
 
62
  }
 
63
 
 
64
  bool hasPassword() const
 
65
  {
 
66
    return password_type != NONE;
 
67
  }
61
68
 
62
69
  const std::string& address() const
63
70
  {
66
73
 
67
74
  void setAddress(const char *newip)
68
75
  {
69
 
    _address.assign(newip);
 
76
    _address = newip;
70
77
  }
71
78
 
72
79
  const std::string& username() const
76
83
 
77
84
  void setUser(const std::string &newuser)
78
85
  {
79
 
    _user.assign(newuser);
 
86
    _user = newuser;
80
87
  }
81
88
 
82
 
  PasswordType getPasswordType(void) const
 
89
  PasswordType getPasswordType() const
83
90
  {
84
91
    return password_type;
85
92
  }
108
115
 
109
116
} /* namespace identifier */
110
117
} /* namespace drizzled */
111
 
 
112
 
#endif /* DRIZZLED_IDENTIFIER_USER_H */