]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/VfrCompile: Add assignment operator definition for some classes
authorHao Wu <hao.a.wu@intel.com>
Tue, 27 Sep 2016 05:41:50 +0000 (13:41 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 8 Nov 2016 08:37:20 +0000 (16:37 +0800)
For class that defines the copy constructor, it is better to add the
assignment operator definition as well.

This commit adds the definition for assignment operator for the classes
with the copy constructor defined.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/VfrCompile/VfrFormPkg.h
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
BaseTools/Source/C/VfrCompile/VfrUtilityLib.h

index 051df28768acc94e355111051a6c7ab1552f97ed..3c7964ac4294051a125777722c73bb13f3c042d7 100644 (file)
@@ -307,6 +307,7 @@ private:
 public:\r
   CIfrOpHeader (IN UINT8 OpCode, IN VOID *StartAddr, IN UINT8 Length = 0);\r
   CIfrOpHeader (IN CIfrOpHeader &);\r
+  CIfrOpHeader& operator=(IN CONST CIfrOpHeader &);\r
 \r
   VOID IncLength (UINT8 Size) {\r
     if ((mHeader->Length + Size) > mHeader->Length) {\r
index 1afa5a2590a1ede8a710ec4bb1e752a39d9d2bde..3ca57ed74184c41645cd1c7a60c5ab2e1a2ac4eb 100644 (file)
@@ -2390,6 +2390,22 @@ EFI_VARSTORE_INFO::EFI_VARSTORE_INFO (
   mVarTotalSize    = Info.mVarTotalSize;\r
 }\r
 \r
+EFI_VARSTORE_INFO&\r
+EFI_VARSTORE_INFO::operator= (\r
+  IN CONST EFI_VARSTORE_INFO &Info\r
+  )\r
+{\r
+  if (this != &Info) {\r
+    mVarStoreId      = Info.mVarStoreId;\r
+    mInfo.mVarName   = Info.mInfo.mVarName;\r
+    mInfo.mVarOffset = Info.mInfo.mVarOffset;\r
+    mVarType         = Info.mVarType;\r
+    mVarTotalSize    = Info.mVarTotalSize;\r
+  }\r
+\r
+  return *this;\r
+}\r
+\r
 BOOLEAN\r
 EFI_VARSTORE_INFO::operator == (\r
   IN EFI_VARSTORE_INFO  *Info\r
index 35d17a031b1b47b87c3df546fe00d05ce09cb26c..2e06e4f1672ce1925e47f4775c00b8b6cce24055 100644 (file)
@@ -264,6 +264,7 @@ struct EFI_VARSTORE_INFO {
 \r
   EFI_VARSTORE_INFO (VOID);\r
   EFI_VARSTORE_INFO (IN EFI_VARSTORE_INFO &);\r
+  EFI_VARSTORE_INFO& operator=(IN CONST EFI_VARSTORE_INFO &);\r
   BOOLEAN operator == (IN EFI_VARSTORE_INFO *);\r
 };\r
 \r