lazutils: added compwriterpas.pas

git-svn-id: trunk@56093 -
This commit is contained in:
mattias 2017-10-17 12:12:46 +00:00
parent 7ccb568efa
commit 099b09d88d
8 changed files with 52 additions and 15 deletions

3
.gitattributes vendored
View File

@ -1026,6 +1026,7 @@ components/codetools/tests/testbasiccodetools.pas svneol=native#text/plain
components/codetools/tests/testcfgscript.pas svneol=native#text/plain
components/codetools/tests/testcodecompletion.pas svneol=native#text/plain
components/codetools/tests/testcompleteblock.pas svneol=native#text/plain
components/codetools/tests/testcompreaderwriterpas.pas svneol=native#text/plain
components/codetools/tests/testcth2pas.pas svneol=native#text/pascal
components/codetools/tests/testctrangescan.pas svneol=native#text/plain
components/codetools/tests/testctxmlfixfragments.pas svneol=native#text/pascal
@ -3096,6 +3097,7 @@ components/lazutils/amigalazfileutils.inc svneol=native#text/plain
components/lazutils/asiancodepagefunctions.inc svneol=native#text/pascal
components/lazutils/asiancodepages.inc svneol=native#text/pascal
components/lazutils/avglvltree.pas svneol=native#text/pascal
components/lazutils/compwriterpas.pas svneol=native#text/plain
components/lazutils/dynamicarray.pas svneol=native#text/pascal
components/lazutils/dynhasharray.pp svneol=native#text/pascal
components/lazutils/dynqueue.pas svneol=native#text/pascal
@ -6118,7 +6120,6 @@ examples/openurltest/openurltest.lpr svneol=native#text/plain
examples/openurltest/openurltest.res -text
examples/pascalstream/PascalStream1.lpi svneol=native#text/plain
examples/pascalstream/PascalStream1.lpr svneol=native#text/plain
examples/pascalstream/componentstreampas.pas svneol=native#text/plain
examples/pascalstream/unit1.pas svneol=native#text/plain
examples/pen_brush/project1.lpi svneol=native#text/plain
examples/pen_brush/project1.lpr svneol=native#text/pascal

View File

@ -0,0 +1,33 @@
unit TestCompReaderWriterPas;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LazLoggerBase, fpcunit, testregistry,
CodeToolManager, CodeCache, LinkScanner,
TestStdCodetools;
type
{ TTestCompReaderWriterPas }
TTestCompReaderWriterPas = class(TCustomTestCTStdCodetools)
published
procedure TestWriteProperties;
end;
implementation
{ TTestCompReaderWriterPas }
procedure TTestCompReaderWriterPas.TestWriteProperties;
begin
end;
initialization
RegisterTest(TTestCompReaderWriterPas);
end.

View File

@ -28,14 +28,14 @@
- a reader
}
unit ComponentStreamPas;
unit CompWriterPas;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, typinfo;
Classes, SysUtils, typinfo, LazLoggerBase;
type
@ -107,7 +107,7 @@ type
procedure WriteUInt64(Value: QWord); override;
procedure WriteUnicodeString(const Value: UnicodeString); override;
procedure WriteVariant(const VarValue: Variant); override;
procedure Write(const Buffer; Count: Longint); override;
procedure Write(const {%H-}Buffer; {%H-}Count: Longint); override;
public
property Stream: TStream read FStream;
end;
@ -283,6 +283,9 @@ var
i: Integer;
Item: TPASObjectWriterStackEl;
begin
if Flags<>[] then ; // ToDo
if ChildPos>0 then ; //
if not IsValidIdent(Component.Name) then
raise Exception.Create('TPASObjectWriter.BeginComponent not pascal identifier');
if (FStack<>nil) and (FStack.Count>0) then begin
@ -500,6 +503,7 @@ end;
procedure TPASObjectWriter.Write(const Buffer; Count: Longint);
begin
// there can be arbitrary lots of Write calls
// ToDo
raise Exception.Create('TPASObjectWriter.Write not supported');
end;

View File

@ -16,7 +16,7 @@
<Description Value="Useful units for Lazarus packages."/>
<License Value="Modified LGPL-2"/>
<Version Major="1"/>
<Files Count="93">
<Files Count="94">
<Item1>
<Filename Value="LazLoggerImpl.inc"/>
<Type Value="Include"/>
@ -389,6 +389,10 @@
<Filename Value="laz_avl_tree.pp"/>
<UnitName Value="Laz_AVL_Tree"/>
</Item93>
<Item94>
<Filename Value="compwriterpas.pas"/>
<UnitName Value="ComponentStreamPas"/>
</Item94>
</Files>
<LazDoc Paths="../../docs/xml/lazutils"/>
<i18n>

View File

@ -21,7 +21,7 @@ uses
StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug,
TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile,
TTRASTER, TTTables, TTTypes, UTF8Process, HTML2TextRender, Laz_AVL_Tree,
LazarusPackageIntf;
compwriterpas, LazarusPackageIntf;
implementation

View File

@ -38,21 +38,16 @@
<MinVersion Major="1" Release="1" Valid="True"/>
</Item2>
</RequiredPackages>
<Units Count="3">
<Units Count="2">
<Unit0>
<Filename Value="PascalStream1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="componentstreampas.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ComponentStreamPas"/>
</Unit1>
<Unit2>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Unit1"/>
</Unit2>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -6,7 +6,7 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, XMLStreaming, ComponentStreamPas, Unit1;
Classes, XMLStreaming, Unit1;
begin
StreamAsPasForm:=TStreamAsPasForm.Create(nil);

View File

@ -5,7 +5,7 @@ unit Unit1;
interface
uses
Classes, SysUtils, LCLProc, typinfo, ComponentStreamPas;
Classes, SysUtils, LCLProc, typinfo, CompWriterPas;
type
TMyEnum = (myEnum1, myEnum2, myEnum3);