소스 검색

* the TOmfLibDictionaryEntry class in unit owomflib converted to two identical
nested classes inside TOmfLibObjectWriter and TOmfLibObjectReader. The reason
is I'm planning to change the class, used in TOmfLibObjectWriter, but not the
one in TOmfLibObjectReader. And using nested classes keeps things clean and
avoids exposing implementation details in the interface of the owomflib unit.
* also changed 'private' to 'strict private' in the classes of the owomflib to
reduce the risk of interference between TOmfLibObjectWriter and TOmfLibObjectReader.

git-svn-id: trunk@39191 -

nickysn 7 년 전
부모
커밋
af5e6e182d
1개의 변경된 파일40개의 추가작업 그리고 14개의 파일을 삭제
  1. 40 14
      compiler/owomflib.pas

+ 40 - 14
compiler/owomflib.pas

@@ -35,20 +35,22 @@ uses
 
 type
 
-  { TOmfLibDictionaryEntry }
-
-  TOmfLibDictionaryEntry=class(TFPHashObject)
-  private
-    FPageNum: Word;
-  public
-    constructor Create(HashObjectList:TFPHashObjectList;const aName:TSymStr;aPageNum:Word);
-    property PageNum: Word read FPageNum write FPageNum;
-  end;
-
   { TOmfLibObjectWriter }
 
   TOmfLibObjectWriter=class(TObjectWriter)
-  private
+  strict private
+    type
+
+      { TOmfLibDictionaryEntry }
+
+      TOmfLibDictionaryEntry=class(TFPHashObject)
+      strict private
+        FPageNum: Word;
+      public
+        constructor Create(HashObjectList:TFPHashObjectList;const aName:TSymStr;aPageNum:Word);
+        property PageNum: Word read FPageNum write FPageNum;
+      end;
+  strict private
     FPageSize: Integer;
     FLibName: string;
     FLibData: TDynamicArray;
@@ -75,7 +77,19 @@ type
   { TOmfLibObjectReader }
 
   TOmfLibObjectReader=class(TObjectReader)
-  private
+  strict private
+    type
+
+      { TOmfLibDictionaryEntry }
+
+      TOmfLibDictionaryEntry=class(TFPHashObject)
+      strict private
+        FPageNum: Word;
+      public
+        constructor Create(HashObjectList:TFPHashObjectList;const aName:TSymStr;aPageNum:Word);
+        property PageNum: Word read FPageNum write FPageNum;
+      end;
+  strict private
     LibSymbols : TFPHashObjectList;
     islib: boolean;
     CurrMemberPos : longint;
@@ -122,10 +136,11 @@ implementation
       end;
 
 {*****************************************************************************
-                                TOmfLibDictionaryEntry
+                 TOmfLibObjectWriter.TOmfLibDictionaryEntry
 *****************************************************************************}
 
-    constructor TOmfLibDictionaryEntry.Create(HashObjectList: TFPHashObjectList; const aName: TSymStr; aPageNum: Word);
+    constructor TOmfLibObjectWriter.TOmfLibDictionaryEntry.Create(
+        HashObjectList: TFPHashObjectList; const aName: TSymStr; aPageNum: Word);
       begin
         inherited Create(HashObjectList,aName);
         PageNum:=aPageNum;
@@ -353,6 +368,17 @@ implementation
         Result:=true;
       end;
 
+{*****************************************************************************
+                 TOmfLibObjectReader.TOmfLibDictionaryEntry
+*****************************************************************************}
+
+  constructor TOmfLibObjectReader.TOmfLibDictionaryEntry.Create(
+      HashObjectList: TFPHashObjectList; const aName: TSymStr; aPageNum: Word);
+    begin
+      inherited Create(HashObjectList,aName);
+      PageNum:=aPageNum;
+    end;
+
 {*****************************************************************************
                                 TOmfLibObjectReader
 *****************************************************************************}