Skip to content

Commit ba96877

Browse files
committed
add big5 to AuthnCredential
Signed-off-by: Emelia Lei <[email protected]>
1 parent b2d60e6 commit ba96877

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

src/groups/bmq/bmqt/bmqt_authncredential.cpp

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ namespace bmqt {
3333
// CREATORS
3434

3535
AuthnCredential::AuthnCredential(bslma::Allocator* allocator)
36-
: d_mechanism("", allocator)
37-
, d_data(bsl::vector<char>(), allocator)
36+
: d_mechanism(allocator)
37+
, d_data(allocator)
3838
{
3939
// NOTHING
4040
}
@@ -58,12 +58,38 @@ AuthnCredential::AuthnCredential(const AuthnCredential& other,
5858

5959
AuthnCredential::AuthnCredential(bslmf::MovableRef<AuthnCredential> otherRef,
6060
bslma::Allocator* allocator)
61-
: d_mechanism(bslmf::MovableRefUtil::access(otherRef).d_mechanism, allocator)
62-
, d_data(bslmf::MovableRefUtil::access(otherRef).d_data, allocator)
61+
: d_mechanism(bslmf::MovableRefUtil::move(
62+
bslmf::MovableRefUtil::access(otherRef).d_mechanism),
63+
allocator)
64+
, d_data(bslmf::MovableRefUtil::move(
65+
bslmf::MovableRefUtil::access(otherRef).d_data),
66+
allocator)
6367
{
6468
// NOTHING
6569
}
6670

71+
// ASSIGNMENT
72+
73+
AuthnCredential& AuthnCredential::operator=(const AuthnCredential& rhs)
74+
{
75+
if (this != &rhs) {
76+
d_mechanism = rhs.d_mechanism;
77+
d_data = rhs.d_data;
78+
}
79+
return *this;
80+
}
81+
82+
AuthnCredential&
83+
AuthnCredential::operator=(bslmf::MovableRef<AuthnCredential> rhsRef)
84+
{
85+
AuthnCredential& rhs = bslmf::MovableRefUtil::access(rhsRef);
86+
if (this != &rhs) {
87+
d_mechanism = bslmf::MovableRefUtil::move(rhs.d_mechanism);
88+
d_data = bslmf::MovableRefUtil::move(rhs.d_data);
89+
}
90+
return *this;
91+
}
92+
6793
AuthnCredential::~AuthnCredential()
6894
{
6995
// NOTHING

src/groups/bmq/bmqt/bmqt_authncredential.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,22 @@ class AuthnCredential {
4141
bsl::vector<char> d_data; // authentication data
4242

4343
private:
44-
// NOT IMPLEMENTED
45-
46-
/// Copy constructor and assignment operator are not implemented.
47-
AuthnCredential(const AuthnCredential*); // = delete;
48-
AuthnCredential& operator=(const AuthnCredential&); // = delete;
44+
// NOT IMPLEMENTED (delete non-allocator creators)
45+
AuthnCredential(const AuthnCredential&) BSLS_KEYWORD_DELETED;
46+
AuthnCredential(AuthnCredential&&) BSLS_KEYWORD_DELETED;
4947

5048
public:
5149
// TRAITS
5250
BSLMF_NESTED_TRAIT_DECLARATION(AuthnCredential, bslma::UsesBslmaAllocator)
5351

5452
// CREATORS
55-
5653
AuthnCredential(bslma::Allocator* allocator = 0);
5754

58-
AuthnCredential(const AuthnCredential& other, bslma::Allocator* allocator);
55+
AuthnCredential(const AuthnCredential& other,
56+
bslma::Allocator* allocator = 0);
5957

6058
AuthnCredential(bslmf::MovableRef<AuthnCredential> other,
61-
bslma::Allocator* allocator);
59+
bslma::Allocator* allocator = 0);
6260

6361
/// Create an `AuthnCredential` object with the specified `mechanism`
6462
/// and `data`, using the specified `allocator` to supply memory. If
@@ -69,6 +67,10 @@ class AuthnCredential {
6967

7068
~AuthnCredential();
7169

70+
// ASSIGNMENT (no allocator parameters)
71+
AuthnCredential& operator=(const AuthnCredential& rhs);
72+
AuthnCredential& operator=(bslmf::MovableRef<AuthnCredential> rhs);
73+
7274
// MANIPULATORS
7375
AuthnCredential& setMechanism(const bsl::string& mechanism);
7476
AuthnCredential& setData(const bsl::vector<char>& data);

0 commit comments

Comments
 (0)