Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/AbonUnit.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.40 by h677, Mon Aug 22 15:05:31 2005 UTC revision 1.41 by h677, Thu Aug 25 14:35:25 2005 UTC
# Line 39  type Line 39  type
39    
40    TAbon = class(TObject)    TAbon = class(TObject)
41    private    private
42                  { Private 宣言 }          { Private 宣言 }
43                  Froot : String;          Froot : String;
44      Flistpath : String;          Flistpath : String;
45      FNGwordpath : String;          FNGwordpath : String;
46      Ftokens : array of array of string;          Ftokens : array of array of string;
47                  FAbonRes : TIndiviAbonList;          FAbonRes : TIndiviAbonList;
48                  FAbonString : String;          FAbonString : String;
49            FpAbons : PChar;
50            FpAbone : PChar;
51          FDeleterlo : Boolean; //&rlo;を削るか //追加&lro;も削る          FDeleterlo : Boolean; //&rlo;を削るか //追加&lro;も削る
52      FReplaceul :Boolean ; //<ul>タグを<br>タグに置換するか          FReplaceul :Boolean ; //<ul>タグを<br>タグに置換するか
53      FReverse : Boolean ;  //NGワードでのあぼ〜んの結果を反転させるか          FReverse : Boolean ;  //NGワードでのあぼ〜んの結果を反転させるか
54      FAbonPopupRes : Boolean; //レスポップアップの時にあぼーんするか          FAbonPopupRes : Boolean; //レスポップアップの時にあぼーんするか
55          FNGwordFileIndex : Integer; //現在読み込んでるNGワードがlistの何行目か          FNGwordFileIndex : Integer; //現在読み込んでるNGワードがlistの何行目か
56      FNGwordname : String; //現在読み込んでるNGワードの表示名          FNGwordname : String; //現在読み込んでるNGワードの表示名
57      FIndividualFileName : String;       //個別あぼ〜んのファイル名          FIndividualFileName : String;   //個別あぼ〜んのファイル名
58      FReturnNGwordLineNum : Boolean;     //NGワードの行数を返す。          FReturnNGwordLineNum : Boolean; //NGワードの行数を返す。
59      FSetNGResAnchor : Boolean; //NGに該当したときに本文にそのレスへのレスアンカーをつけるかどうか          FSetNGResAnchor : Boolean; //NGに該当したときに本文にそのレスへのレスアンカーをつけるかどうか
60                  FDeleteSyria: Boolean;  //シリア語ブラクラ対策(&#1792~&#1871)          FDeleteSyria: Boolean;  //シリア語ブラクラ対策(&#1792~&#1871)
61                  FIgnoreKana: Boolean;   //全角半角ひらがなカタカナの違いを無視するか          FIgnoreKana: Boolean;   //全角半角ひらがなカタカナの違いを無視するか
62      procedure SetTokens(index: integer ; argline:String);          procedure SetTokens(index: integer ; argline:String);
63      function Getlistpath() : String;          function Getlistpath() : String;
64      procedure Setlistpath(const Value : String);          procedure Setlistpath(const Value : String);
65      function LoadListFile(path :String;listStringList : TStringList) : Boolean;          function LoadListFile(path :String;listStringList : TStringList) : Boolean;
66      function ReadNGwordslist(line : Integer) : Boolean;          function ReadNGwordslist(line : Integer) : Boolean;
67      function LoadFromSetResNumFile(SetResNumFile : String) : Boolean;          function LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
68    public    public
69      { Public 宣言 }          { Public 宣言 }
70      constructor Create; // コンストラクタ          constructor Create; // コンストラクタ
71      destructor Destroy; override; // デストラクタ          destructor Destroy; override; // デストラクタ
72      property Deleterlo: Boolean read FDeleterlo write FDeleterlo  default false;          property Deleterlo: Boolean read FDeleterlo write FDeleterlo  default false;
73      property Replaceul: Boolean read FReplaceul write FReplaceul  default false;          property Replaceul: Boolean read FReplaceul write FReplaceul  default false;
74      property Reverse: Boolean read FReverse write FReverse  default false;          property Reverse: Boolean read FReverse write FReverse  default false;
75          property AbonString : String read FAbonString write FAbonString;          property AbonString : String read FAbonString write FAbonString;
76      property  AbonPopupRes : Boolean read FAbonPopupRes write FAbonPopupRes default false;          property  AbonPopupRes : Boolean read FAbonPopupRes write FAbonPopupRes default false;
77      property listpath : String read Getlistpath write Setlistpath;          property listpath : String read Getlistpath write Setlistpath;
78      property NGwordFileIndex : Integer read FNGwordFileIndex write FNGwordFileIndex default 0;          property NGwordFileIndex : Integer read FNGwordFileIndex write FNGwordFileIndex default 0;
79      property NGwordname : String read FNGwordname write FNGwordname;          property NGwordname : String read FNGwordname write FNGwordname;
80          property ReturnNGwordLineNum : Boolean read FReturnNGwordLineNum write FReturnNGwordLineNum default false;          property ReturnNGwordLineNum : Boolean read FReturnNGwordLineNum write FReturnNGwordLineNum default false;
81      property SetNGResAnchor : Boolean read FSetNGResAnchor write FSetNGResAnchor default false;          property SetNGResAnchor : Boolean read FSetNGResAnchor write FSetNGResAnchor default false;
82          property DeleteSyria : Boolean read FDeleteSyria write FDeleteSyria default false;          property DeleteSyria : Boolean read FDeleteSyria write FDeleteSyria default false;
83          property IgnoreKana: Boolean read FIgnoreKana write FIgnoreKana default false;          property IgnoreKana: Boolean read FIgnoreKana write FIgnoreKana default false;
84      procedure Setroot(root :String);          procedure Setroot(root :String);
85      function Getroot() : String;          function Getroot() : String;
86    
87      function Getfullpath(argpath : String) : String;          function Getfullpath(argpath : String) : String;
88      procedure SetNGwordpath(path :String);          procedure SetNGwordpath(path :String);
89      function GetNGwordpath() : String;          function GetNGwordpath() : String;
90      function LoadFromNGwordFile(path :String) : Boolean;          function LoadFromNGwordFile(path :String) : Boolean;
91      function ReLoadFromNGwordFile() : Boolean;          function ReLoadFromNGwordFile() : Boolean;
92      procedure LoadFromStringList( bufstl : TStringList );          procedure LoadFromStringList( bufstl : TStringList );
93      function CheckAbonPopupRes(line : String) :Boolean;          function CheckAbonPopupRes(line : String) :Boolean;
94          function FindNGwords(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean;//1ラインずつ用。          function FindNGwords(const line : String; var NGwordsLineNum : Integer; var Invisible : Boolean) : Boolean;//1ラインずつ用。
95          //あぼ〜ん処理(NGワードでのフィルタリング)          //あぼ〜ん処理(NGワードでのフィルタリング)
96          procedure Execute(var ThreadStrings : TStringList); overload;          procedure Execute(var ThreadStrings : TStringList); overload;
# Line 235  begin Line 237  begin
237          // 初期化          // 初期化
238          FAbonString := '&nbsp;<>&nbsp;<>&nbsp;<>&nbsp;&nbsp;<><>';          FAbonString := '&nbsp;<>&nbsp;<>&nbsp;<>&nbsp;&nbsp;<><>';
239          FAbonRes := TIndiviAbonList.Create;          FAbonRes := TIndiviAbonList.Create;
240            FpAbons := PChar(FAbonString);
241            FpAbone := FpAbons + Length(FAbonString);
242    
243  end;  end;
244    
# Line 429  var Line 433  var
433          bufline : String;          bufline : String;
434          start : Integer;          start : Integer;
435          target : String;          target : String;
436          pos : Integer;          pos : PChar;
437            pts, pte : PChar;
438            trgLen : Integer;
439  begin  begin
440          hit := false;          hit := false;
441          if AnsiPos(FAbonString,line) <> 1 then begin          if AnsiStrPosEx(PChar(line), PChar(line)+Length(line), FpAbons, FpAbone) = nil then begin
442                  //全半角ひらカナ無視するか                  //全半角ひらカナ無視するか
443                  if IgnoreKana then                  if IgnoreKana then
444                          target := ZenToHan(line)                          target := ZenToHan(line)
445                  else                  else
446                          target := line;                          target := line;
447    
448                    trgLen := Length(target);
449    
450                  for lines := 0 to High(Ftokens) do begin                  for lines := 0 to High(Ftokens) do begin
451                          hit := true;                          hit := true;
452                          bufline := target;                          bufline := target;
453                            pts := PChar(bufline);
454                            pte := pts + trgLen;
455    
456                          if Ftokens[lines][0] <> ''  then begin                          if Ftokens[lines][0] <> ''  then begin
457                                  Invisible := false;                                  Invisible := false;
458                                  start := 0;                                  start := 0;
# Line 450  begin Line 462  begin
462                          end;                          end;
463    
464                          for cells := start to High(Ftokens[lines]) do begin                          for cells := start to High(Ftokens[lines]) do begin
465                                  pos := AnsiPos(Ftokens[lines][cells],bufline);                                  pos := AnsiStrPosEx(pts, pte,
466                                  if pos = 0 then begin                                                  PChar(Ftokens[lines][cells]), PChar(Ftokens[lines][cells]) + Length(Ftokens[lines][cells]));
467                                    if pos = nil then begin
468                                          hit := false;                                          hit := false;
469                                          break;                                          break;
470                                  end else begin                                  end else begin
471                                          Delete(bufline, pos, Length(Ftokens[lines][cells]));                                          Delete(bufline, pos - pte + 1, Length(Ftokens[lines][cells]));
472                                            pts := PChar(bufline);
473                                            pte := pts + Length(bufline);
474                                  end;                                  end;
475                          end;                          end;
476                          if hit = true then begin                          if hit = true then begin

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26