[es] Change order of methods to fit with style.

This commit is contained in:
jakcron 2018-06-24 13:20:56 +08:00
parent cf71223163
commit 4d6eb6f694
4 changed files with 42 additions and 42 deletions

View file

@ -12,9 +12,9 @@ namespace es
SectionHeader_V2(); SectionHeader_V2();
SectionHeader_V2(const SectionHeader_V2& other); SectionHeader_V2(const SectionHeader_V2& other);
void operator=(const SectionHeader_V2& other);
bool operator==(const SectionHeader_V2& other) const; bool operator==(const SectionHeader_V2& other) const;
bool operator!=(const SectionHeader_V2& other) const; bool operator!=(const SectionHeader_V2& other) const;
void operator=(const SectionHeader_V2& other);
// export/import binary // export/import binary
void toBytes(); void toBytes();

View file

@ -12,9 +12,9 @@ namespace es
TicketBody_V2(); TicketBody_V2();
TicketBody_V2(const TicketBody_V2& other); TicketBody_V2(const TicketBody_V2& other);
void operator=(const TicketBody_V2& other);
bool operator==(const TicketBody_V2& other) const; bool operator==(const TicketBody_V2& other) const;
bool operator!=(const TicketBody_V2& other) const; bool operator!=(const TicketBody_V2& other) const;
void operator=(const TicketBody_V2& other);
// export/import binary // export/import binary
void toBytes(); void toBytes();

View file

@ -10,20 +10,6 @@ es::SectionHeader_V2::SectionHeader_V2(const SectionHeader_V2 & other)
*this = other; *this = other;
} }
bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
{
return (mSectionOffset == other.mSectionOffset) \
&& (mRecordSize == other.mRecordSize) \
&& (mSectionSize == other.mSectionSize) \
&& (mRecordNum == other.mRecordNum) \
&& (mSectionType == other.mSectionType);
}
bool es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const
{
return !(*this ==other);
}
void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other) void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
@ -41,6 +27,20 @@ void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
} }
} }
bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
{
return (mSectionOffset == other.mSectionOffset) \
&& (mRecordSize == other.mRecordSize) \
&& (mSectionSize == other.mSectionSize) \
&& (mRecordNum == other.mRecordNum) \
&& (mSectionType == other.mSectionType);
}
bool es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const
{
return !(*this ==other);
}
void es::SectionHeader_V2::toBytes() void es::SectionHeader_V2::toBytes()
{ {
mRawBinary.alloc(sizeof(sSectionHeader_v2)); mRawBinary.alloc(sizeof(sSectionHeader_v2));

View file

@ -12,32 +12,6 @@ es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other)
*this = other; *this = other;
} }
bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
{
return (mIssuer == other.mIssuer) \
&& (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \
&& (mEncType == other.mEncType) \
&& (mTicketVersion == other.mTicketVersion) \
&& (mLicenseType == other.mLicenseType) \
&& (mPreInstall == other.mPreInstall) \
&& (mSharedTitle == other.mSharedTitle) \
&& (mAllowAllContent == other.mAllowAllContent) \
&& (memcmp(mReservedRegion, other.mReservedRegion, ticket::kReservedRegionSize) == 0) \
&& (mTicketId == other.mTicketId) \
&& (mDeviceId == other.mDeviceId) \
&& (memcmp(mRightsId, other.mRightsId, ticket::kRightsIdSize) == 0) \
&& (mAccountId == other.mAccountId) \
&& (mSectTotalSize == other.mSectTotalSize) \
&& (mSectHeaderOffset == other.mSectHeaderOffset) \
&& (mSectNum == other.mSectNum) \
&& (mSectEntrySize == other.mSectEntrySize);
}
bool es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const
{
return !(*this == other);
}
void es::TicketBody_V2::operator=(const TicketBody_V2 & other) void es::TicketBody_V2::operator=(const TicketBody_V2 & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
@ -67,6 +41,32 @@ void es::TicketBody_V2::operator=(const TicketBody_V2 & other)
} }
} }
bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
{
return (mIssuer == other.mIssuer) \
&& (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \
&& (mEncType == other.mEncType) \
&& (mTicketVersion == other.mTicketVersion) \
&& (mLicenseType == other.mLicenseType) \
&& (mPreInstall == other.mPreInstall) \
&& (mSharedTitle == other.mSharedTitle) \
&& (mAllowAllContent == other.mAllowAllContent) \
&& (memcmp(mReservedRegion, other.mReservedRegion, ticket::kReservedRegionSize) == 0) \
&& (mTicketId == other.mTicketId) \
&& (mDeviceId == other.mDeviceId) \
&& (memcmp(mRightsId, other.mRightsId, ticket::kRightsIdSize) == 0) \
&& (mAccountId == other.mAccountId) \
&& (mSectTotalSize == other.mSectTotalSize) \
&& (mSectHeaderOffset == other.mSectHeaderOffset) \
&& (mSectNum == other.mSectNum) \
&& (mSectEntrySize == other.mSectEntrySize);
}
bool es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const
{
return !(*this == other);
}
void es::TicketBody_V2::toBytes() void es::TicketBody_V2::toBytes()
{ {
mRawBinary.alloc(sizeof(sTicketBody_v2)); mRawBinary.alloc(sizeof(sTicketBody_v2));