Skip to content

Commit

Permalink
Re-added copy constructors with correct initializers (closes #29)
Browse files Browse the repository at this point in the history
  • Loading branch information
abumq committed Jul 24, 2023
1 parent 19ed973 commit d8764e2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Change Log

## [1.2.0] - 24-07-2023
- Re-added copy constructors with correct initializers (closes #29)

## [1.1.0] - 20-07-2023
- Updated Crypto++ dep to 8.8.0
- Change C++ dependency to C++14
- Using `std::array` instead of raw array
- C bindings (special shout out to [`spotzai`](https://github.com/spotzai) for PR)
Expand Down
2 changes: 2 additions & 0 deletions include/license++/license.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class License
{
public:
License();
License(const License&);
License& operator=(License);

inline void setLicensee(const std::string& licensee)
{
Expand Down
23 changes: 23 additions & 0 deletions src/license.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ License::License() :
{
}

License::License(const License& other):
m_issueDate(other.m_issueDate),
m_expiryDate(other.m_expiryDate),
m_licensee(other.m_licensee),
m_issuingAuthorityId(other.m_issuingAuthorityId),
m_licenseeSignature(other.m_licenseeSignature),
m_authoritySignature(other.m_authoritySignature),
m_additionalPayload(other.m_additionalPayload)
{
}

License& License::operator=(License other)
{
std::swap(m_issueDate, other.m_issueDate);
std::swap(m_expiryDate, other.m_expiryDate);
std::swap(m_licensee, other.m_licensee);
std::swap(m_licenseeSignature, other.m_licenseeSignature);
std::swap(m_issuingAuthorityId, other.m_issuingAuthorityId);
std::swap(m_authoritySignature, other.m_authoritySignature);
std::swap(m_additionalPayload, other.m_additionalPayload);
return *this;
}

std::string License::formattedExpiry() const
{
struct timeval tval;
Expand Down

0 comments on commit d8764e2

Please sign in to comment.