📄 _stutil.pas
字号:
procedure TStStringList._OnChanging(Sender: TObject);
begin
if Assigned(FEvents) then
FEvents.OnChanging;
end;
{ ********** TStStringList Properties *** (Get) *******************************************}
function TStStringList.Get__NewEnum: IUnknown;
begin
Result := Self;
end;
function TStStringList.Get_Item(Index: Integer): WideString;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Strings[Index];
end;
function TStStringList.Get_CommaText: WideString;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.CommaText;
end;
function TStStringList.Get_Count: Integer;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Count;
end;
function TStStringList.Get_Duplicates: Integer;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := Ord(FStringList.Duplicates);
end;
function TStStringList.Get_Names(Index: Integer): WideString;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Names[Index];
end;
function TStStringList.Get_Sorted: WordBool;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Sorted;
end;
function TStStringList.Get_Stream: OleVariant;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := StTextToOleVariant(FStringList.Text);
end;
function TStStringList.Get_Strings(Index: Integer): WideString;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Strings[Index];
end;
function TStStringList.Get_Text: WideString;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Text;
end;
function TStStringList.Get_Values(const Name: WideString): WideString;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Values[Name];
end;
{ ********** TStStringList Properties *** (Set) *******************************************}
procedure TStStringList.Set_CommaText(const Value: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.CommaText := Value;
end;
procedure TStStringList.Set_Duplicates(Value: Integer);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Duplicates := Classes.TDuplicates(Value);
end;
procedure TStStringList.Set_Item(Index: Integer; const Value: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Strings[Index] := Value;
end;
procedure TStStringList.Set_Sorted(Value: WordBool);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Sorted := Value;
end;
procedure TStStringList.Set_Stream(Value: OleVariant);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Text := StOleVariantToText(Value);
end;
procedure TStStringList.Set_Strings(Index: Integer;
const Value: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Strings[Index] := Value;
end;
procedure TStStringList.Set_Text(const Value: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Text := Value;
end;
procedure TStStringList.Set_Values(const Name, Value: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Values[Name] := Value;
end;
{ ********** TStStringList Methods *****************************************************}
function TStStringList.Add(const S: WideString): Integer;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Add(S);
end;
procedure TStStringList.Append(const S: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Append(S);
end;
procedure TStStringList.Clear;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Clear;
end;
procedure TStStringList.Delete(Index: Integer);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Delete(Index);
end;
function TStStringList.Equals(const Strings: IStStringList): WordBool;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Equals(TStStringList(Strings).FStringList);
end;
procedure TStStringList.Exchange(Index1, Index2: Integer);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Exchange(Index1, Index2);
end;
function TStStringList.Find(const S: WideString;
var Index: Integer): WordBool;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.Find(S, Index);
end;
function TStStringList.IndexOf(const S: WideString): Integer;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.IndexOf(S);
end;
function TStStringList.IndexOfName(const Name: WideString): Integer;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
Result := FStringList.IndexOfName(Name);
end;
procedure TStStringList.Insert(Index: Integer; const S: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Insert(Index, S);
end;
procedure TStStringList.LoadFromFile(const FileName: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.LoadFromFile(FileName);
end;
procedure TStStringList.Move(CurIndex, NewIndex: Integer);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Move(CurIndex, NewIndex);
end;
procedure TStStringList.SaveToFile(const FileName: WideString);
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.SaveToFile(FileName);
end;
procedure TStStringList.Sort;
begin
{$IFDEF LICENSE}
if (not FIsLicensed) or (not COMHasBeenLicensed) then
OleError(CLASS_E_NOTLICENSED);
{$ENDIF}
FStringList.Sort;
end;
function TStStringList.License(const Key: WideString): WordBool;
begin
{$IFDEF LICENSE}
Result := COMIsValidKey(Key);
{$ELSE}
Result := True;
{$ENDIF}
FIsLicensed := Result;
end;
initialization
TAutoObjectFactory.Create(ComServer, TStStringList, Class_StStringList, ciMultiInstance, tmBoth);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -