1
153141271
Unregistered / Unconfirmed
GUEST, unregistred user!
这下面函数是Tstream中seek方法的实现!
但有些地方不明白!还望大家 指点!!!
?????为不明白的!以前好像 也没用过!
function TStream.Seek(Offset: Longint
Origin: Word): Longint;
procedure RaiseException;???????????怎么函数的的这个位置写个过程,是什么意思?
begin
raise EStreamError.CreateResFmt(@sSeekNotImplemented, [Classname]);
end;
type???????????这个地方也不太懂!
TSeek64 = function (const Offset: Int64
Origin: TSeekOrigin): Int64 of object;
var
Impl: TSeek64;
Base: TSeek64;
ClassTStream: TClass;
begin
{ Deflect 32 seek requests to the 64 bit seek, if 64 bit is implemented.
No existing TStream classes should call this method, since it was originally
abstract. Descendent classes MUST implement at least one of either
the 32 bit or the 64 bit version, and must not call the inherited
default implementation. }
Impl := Seek;
ClassTStream := Self.ClassType;
while (ClassTStream <> nil) and (ClassTStream <> TStream) do
ClassTStream := ClassTStream.ClassParent;
if ClassTStream = nil then RaiseException;
Base := TStream(@ClassTStream).Seek;
if TMethod(Impl).Code = TMethod(Base).Code then
RaiseException;
Result := Seek(Int64(Offset), TSeekOrigin(Origin));???????这个好像是互相调用的,这样可以吗????????
end;
但有些地方不明白!还望大家 指点!!!
?????为不明白的!以前好像 也没用过!
function TStream.Seek(Offset: Longint
Origin: Word): Longint;
procedure RaiseException;???????????怎么函数的的这个位置写个过程,是什么意思?
begin
raise EStreamError.CreateResFmt(@sSeekNotImplemented, [Classname]);
end;
type???????????这个地方也不太懂!
TSeek64 = function (const Offset: Int64
Origin: TSeekOrigin): Int64 of object;
var
Impl: TSeek64;
Base: TSeek64;
ClassTStream: TClass;
begin
{ Deflect 32 seek requests to the 64 bit seek, if 64 bit is implemented.
No existing TStream classes should call this method, since it was originally
abstract. Descendent classes MUST implement at least one of either
the 32 bit or the 64 bit version, and must not call the inherited
default implementation. }
Impl := Seek;
ClassTStream := Self.ClassType;
while (ClassTStream <> nil) and (ClassTStream <> TStream) do
ClassTStream := ClassTStream.ClassParent;
if ClassTStream = nil then RaiseException;
Base := TStream(@ClassTStream).Seek;
if TMethod(Impl).Code = TMethod(Base).Code then
RaiseException;
Result := Seek(Int64(Offset), TSeekOrigin(Origin));???????这个好像是互相调用的,这样可以吗????????
end;