~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/user.h

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

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
 
#pragma once
 
21
 
 
22
#ifndef DRIZZLED_IDENTIFIER_USER_H
 
23
#define DRIZZLED_IDENTIFIER_USER_H
22
24
 
23
25
#include <string>
24
26
#include <boost/shared_ptr.hpp>
25
 
#include <drizzled/common_fwd.h>
26
 
#include <drizzled/identifier.h>
27
 
#include <drizzled/visibility.h>
28
 
 
29
 
namespace drizzled {
30
 
namespace identifier {
 
27
 
 
28
#include "drizzled/visibility.h"
 
29
 
 
30
namespace drizzled
 
31
{
 
32
namespace identifier
 
33
{
31
34
 
32
35
/**
33
36
  @class User
37
40
class User : public Identifier
38
41
{
39
42
public:
40
 
  DRIZZLED_API static user::mptr make_shared();
 
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();
41
47
 
42
48
  enum PasswordType
43
49
  {
44
 
    NONE,
45
50
    PLAIN_TEXT,
46
51
    MYSQL_HASH
47
52
  };
48
53
 
49
54
  User():
50
 
    password_type(NONE)
51
 
  { }
52
 
 
53
 
  User(const std::string username_arg):
54
 
    password_type(NONE),
55
 
    _user(username_arg),
 
55
    password_type(PLAIN_TEXT),
 
56
    _user(""),
56
57
    _address("")
57
58
  { }
58
59
 
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
 
  }
 
60
  virtual void getSQLPath(std::string &arg) const;
68
61
 
69
62
  const std::string& address() const
70
63
  {
73
66
 
74
67
  void setAddress(const char *newip)
75
68
  {
76
 
    _address = newip;
 
69
    _address.assign(newip);
77
70
  }
78
71
 
79
72
  const std::string& username() const
83
76
 
84
77
  void setUser(const std::string &newuser)
85
78
  {
86
 
    _user = newuser;
 
79
    _user.assign(newuser);
87
80
  }
88
81
 
89
 
  PasswordType getPasswordType() const
 
82
  PasswordType getPasswordType(void) const
90
83
  {
91
84
    return password_type;
92
85
  }
115
108
 
116
109
} /* namespace identifier */
117
110
} /* namespace drizzled */
 
111
 
 
112
#endif /* DRIZZLED_IDENTIFIER_USER_H */