⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs_iclassesrtti.pas

📁 这个是功能强大的报表软件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
      Result := _TStrings.IndexOf(Caller.Params[0])
    else if MethodName = 'INDEXOFNAME' then
      Result := _TStrings.IndexOfName(Caller.Params[0])
    else if MethodName = 'INDEXOFOBJECT' then
      Result := _TStrings.IndexOfObject(TObject(Integer(Caller.Params[0])))
    else if MethodName = 'INSERT' then
      _TStrings.Insert(Caller.Params[0], Caller.Params[1])
    else if MethodName = 'INSERTOBJECT' then
      _TStrings.InsertObject(Caller.Params[0], Caller.Params[1], TObject(Integer(Caller.Params[2])))
    else if MethodName = 'LOADFROMFILE' then
      _TStrings.LoadFromFile(Caller.Params[0])
    else if MethodName = 'LOADFROMSTREAM' then
      _TStrings.LoadFromStream(TStream(Integer(Caller.Params[0])))
    else if MethodName = 'MOVE' then
      _TStrings.Move(Caller.Params[0], Caller.Params[1])
    else if MethodName = 'SAVETOFILE' then
      _TStrings.SaveToFile(Caller.Params[0])
    else if MethodName = 'SAVETOSTREAM' then
      _TStrings.SaveToStream(TStream(Integer(Caller.Params[0])))
    else if MethodName = 'NAMES.GET' then
      Result := _TStrings.Names[Caller.Params[0]]
    else if MethodName = 'OBJECTS.GET' then
      Result := Integer(_TStrings.Objects[Caller.Params[0]])
    else if MethodName = 'OBJECTS.SET' then
      _TStrings.Objects[Caller.Params[0]] := TObject(Integer(Caller.Params[1]))
    else if MethodName = 'VALUES.GET' then
      Result := _TStrings.Values[Caller.Params[0]]
    else if MethodName = 'VALUES.SET' then
      _TStrings.Values[Caller.Params[0]] := Caller.Params[1]
    else if MethodName = 'STRINGS.GET' then
      Result := _TStrings.Strings[Caller.Params[0]]
    else if MethodName = 'STRINGS.SET' then
      _TStrings.Strings[Caller.Params[0]] := Caller.Params[1]
  end
  else if ClassType = TStringList then
  begin
    if MethodName = 'FIND' then
    begin
      Result := TStringList(Instance).Find(Caller.Params[0], i);
      Caller.Params[1] := i;
    end
    else if MethodName = 'SORT' then
      TStringList(Instance).Sort
  end
  else if ClassType = TStream then
  begin
    _TStream := TStream(Instance);
    if MethodName = 'READ' then
    begin
      SetLength(s, Integer(Caller.Params[1]));
      Result := _TStream.Read(s[1], Caller.Params[1]);
      SetLength(s, Integer(Result));
      Caller.Params[0] := s;
    end
    else if MethodName = 'WRITE' then
    begin
      s := Caller.Params[0];
      Result := _TStream.Write(s[1], Caller.Params[1]);
    end
    else if MethodName = 'SEEK' then
      Result := _TStream.Seek(Caller.Params[0], Caller.Params[1])
    else if MethodName = 'COPYFROM' then
      Result := _TStream.CopyFrom(TStream(Integer(Caller.Params[0])), Caller.Params[1])
  end
  else if ClassType = TFileStream then
  begin
    if MethodName = 'CREATE' then
      Result := Integer(TFileStream(Instance).Create(Caller.Params[0], Caller.Params[1]))
  end
  else if ClassType = TMemoryStream then
  begin
    _TMemoryStream := TMemoryStream(Instance);
    if MethodName = 'CLEAR' then
      _TMemoryStream.Clear
    else if MethodName = 'LOADFROMSTREAM' then
      _TMemoryStream.LoadFromStream(TStream(Integer(Caller.Params[0])))
    else if MethodName = 'LOADFROMFILE' then
      _TMemoryStream.LoadFromFile(Caller.Params[0])
    else if MethodName = 'SAVETOSTREAM' then
      _TMemoryStream.SaveToStream(TStream(Integer(Caller.Params[0])))
    else if MethodName = 'SAVETOFILE' then
      _TMemoryStream.SaveToFile(Caller.Params[0])
  end
  else if ClassType = TComponent then
  begin
    if MethodName = 'CREATE' then
      Result := Integer(TComponent(Instance).Create(TComponent(Integer(Caller.Params[0]))))
  end
  else if ClassType = TfsXMLItem then
  begin
    _TfsXMLItem := TfsXMLItem(Instance);
    if MethodName = 'CREATE' then
      Result := Integer(_TfsXMLItem.Create)
    else if MethodName = 'ADDITEM' then
      _TfsXMLItem.AddItem(TfsXMLItem(Integer(Caller.Params[0])))
    else if MethodName = 'CLEAR' then
      _TfsXMLItem.Clear
    else if MethodName = 'INSERTITEM' then
      _TfsXMLItem.InsertItem(Caller.Params[0], TfsXMLItem(Integer(Caller.Params[1])))
    else if MethodName = 'ADD' then
      Result := Integer(_TfsXMLItem.Add)
    else if MethodName = 'FIND' then
      Result := _TfsXMLItem.Find(Caller.Params[0])
    else if MethodName = 'FINDITEM' then
      Result := Integer(_TfsXMLItem.FindItem(Caller.Params[0]))
    else if MethodName = 'PROP.GET' then
      Result := _TfsXMLItem.Prop[Caller.Params[0]]
    else if MethodName = 'PROP.SET' then
      _TfsXMLItem.Prop[Caller.Params[0]] := Caller.Params[1]
    else if MethodName = 'ROOT' then
      Result := Integer(_TfsXMLItem.Root)
    else if MethodName = 'ROOT' then
      Result := Integer(_TfsXMLItem.Root)
    else if MethodName = 'ITEMS.GET' then
      Result := Integer(_TfsXMLItem[Caller.Params[0]])
  end
  else if ClassType = TfsXMLDocument then
  begin
    _TfsXMLDocument := TfsXMLDocument(Instance);
    if MethodName = 'CREATE' then
      Result := Integer(_TfsXMLDocument.Create)
    else if MethodName = 'SAVETOSTREAM' then
      _TfsXMLDocument.SaveToStream(TStream(Integer(Caller.Params[0])))
    else if MethodName = 'LOADFROMSTREAM' then
      _TfsXMLDocument.LoadFromStream(TStream(Integer(Caller.Params[0])))
    else if MethodName = 'SAVETOFILE' then
      _TfsXMLDocument.SaveToFile(Caller.Params[0])
    else if MethodName = 'LOADFROMFILE' then
      _TfsXMLDocument.LoadFromFile(Caller.Params[0])
  end
end;

function TFunctions.GetProp(Instance: TObject; ClassType: TClass;
  const PropName: String): Variant;
begin
  Result := 0;

  if ClassType = TCollection then
  begin
    if PropName = 'COUNT' then
      Result := TCollection(Instance).Count
  end
  else if ClassType = TList then
  begin
    if PropName = 'COUNT' then
      Result := TList(Instance).Count
  end
  else if ClassType = TStrings then
  begin
    if PropName = 'COMMATEXT' then
      Result := TStrings(Instance).CommaText
    else if PropName = 'COUNT' then
      Result := TStrings(Instance).Count
    else if PropName = 'TEXT' then
      Result := TStrings(Instance).Text
  end
  else if ClassType = TStringList then
  begin
    if PropName = 'DUPLICATES' then
      Result := TStringList(Instance).Duplicates
    else if PropName = 'SORTED' then
      Result := TStringList(Instance).Sorted
  end
  else if ClassType = TStream then
  begin
    if PropName = 'POSITION' then
      Result := TStream(Instance).Position
    else if PropName = 'SIZE' then
      Result := TStream(Instance).Size
  end
  else if ClassType = TComponent then
  begin
    if PropName = 'OWNER' then
      Result := Integer(TComponent(Instance).Owner)
  end
  else if ClassType = TfsXMLItem then
  begin
    if PropName = 'DATA' then
      Result := Integer(TfsXMLItem(Instance).Data)
    else if PropName = 'COUNT' then
      Result := TfsXMLItem(Instance).Count
    else if PropName = 'NAME' then
      Result := TfsXMLItem(Instance).Name
    else if PropName = 'PARENT' then
      Result := Integer(TfsXMLItem(Instance).Parent)
    else if PropName = 'TEXT' then
      Result := TfsXMLItem(Instance).Text
  end
  else if ClassType = TfsXMLDocument then
  begin
    if PropName = 'ROOT' then
      Result := Integer(TfsXMLDocument(Instance).Root)
  end
end;

procedure TFunctions.SetProp(Instance: TObject; ClassType: TClass;
  const PropName: String; Value: Variant);
begin
  if ClassType = TStrings then
  begin
    if PropName = 'COMMATEXT' then
      TStrings(Instance).CommaText := Value
    else if PropName = 'TEXT' then
      TStrings(Instance).Text := Value
  end
  else if ClassType = TStringList then
  begin
    if PropName = 'DUPLICATES' then
      TStringList(Instance).Duplicates := Value
    else if PropName = 'SORTED' then
      TStringList(Instance).Sorted := Value
  end
  else if ClassType = TStream then
  begin
    if PropName = 'POSITION' then
      TStream(Instance).Position := Value
  end
  else if ClassType = TfsXMLItem then
  begin
    if PropName = 'DATA' then
      TfsXMLItem(Instance).Data := Pointer(Integer(Value))
    else if PropName = 'NAME' then
      TfsXMLItem(Instance).Name := Value
    else if PropName = 'TEXT' then
      TfsXMLItem(Instance).Text := Value
  end
end;


initialization
  fsRTTIModules.Add(TFunctions);

finalization
  if fsRTTIModules <> nil then
    fsRTTIModules.Remove(TFunctions);

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -