The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Interface of SDL_Streams

const
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'streams_r1200_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'streams_r1200_lighted';
  IsLightEd = true;
{$ENDIF}
  Release = 1200;

type
  TSRUnknownModifierEvent = procedure (Command: string; var Substring: string);

  TMixedFStream = class(TFileStream)
    public
      constructor Create(const AFileName: string; Mode: Word); overload;
      destructor  Destroy; override;
      function Eos: boolean;
      function ReadByte (var error: boolean): byte;                      // bin
      function ReadDecimal: integer;                                     // text
      function ReadDouble (var error: boolean): double;                  // bin
      function ReadExtended (var error: boolean): extended;              // bin
      function ReadFPNum (AllowExp: boolean; DecPChar: integer): double; // text
      function ReadInteger (var error: boolean): integer;                // bin
      function ReadLn (EOLMode: integer): string;                        // text
      procedure Write (AString: string);                                 // text
      procedure WriteByte (aNum: byte);                                  // bin
      procedure WriteInteger (aNum: integer);                            // bin
      procedure WriteDouble (aNum: double);                              // bin
      procedure WriteLn (AString: string);                               // text
    end;

  function CountLinesInStream
           (Instream : TStream)                                 { input stream }
                     : integer;                    { number of lines in stream }
  procedure ExtractFromStream
           (InStream : TStream;                         { stream to be scanned }
       var OutStream : TMemoryStream;                       { resulting stream }
            Commands : TStringList);                        { list of commands }
  function FindInStream
           (Instream : TStream;                                 { input stream }
               AByte : byte)                                { byte to be found }
                     : boolean;                    { TRUE: byte has been found }
  function ReadDoubleFromStream
           (InStream : TStream;                                 { input stream }
             var eos : boolean)            { TRUE if end of stream encountered }
                     : double;                                 { double number }
  function ReadExtendedFromStream
           (InStream : TStream;                                 { input stream }
             var eos : boolean)            { TRUE if end of stream encountered }
                     : extended;                             { extended number }
  function ReadLongintFromStream
           (InStream : TStream;                                 { input stream }
             var eos : boolean)            { TRUE if end of stream encountered }
                     : longint;                               { longint number }
  function ReadSingleFromStream
           (InStream : TStream;                                 { input stream }
             var eos : boolean)            { TRUE if end of stream encountered }
                     : single;                                 { single number }
  function ReadLnStream
           (Instream : TStream;                                 { input stream }
             var eos : boolean;            { TRUE if end of stream encountered }
             EOLMode : integer)                 { end of line recognition mode }
                     : string;                       { string read from stream }
  function ReadNextTagInStream
      (const AStream : TStream;                    { stream to reads tags from }
             TagList : array of string;                   { list of valid tags }
          var Attrib,                                   { found tag attributes }
            Contents : string)                            { found tag contents }
                     : integer;                           { index of found tag }
  function ReadNextTagInTextFile
        (const AFile : TextFile;                      { text file to read from }
             TagList : array of string;                   { list of valid tags }
          var Attrib,                                              { found tag }
            Contents : string)                               { contents of tag }
                     : integer;                           { index of found tag }
  function ReadStreamUntil
           (InStream : TStream;                                 { input stream }
           SubString : string;                  { substring to be searched for }
           var Error : integer)                                 { error number }
                     : string;                       { string read from stream }
  function ReadStreamUntilTagList
           (InStream : TStream;                                 { input stream }
       const TagList : array of string;       { array of tags to be tested for }
           var TagNr : integer)                          { number of found tag }
                     : string;                            { string read so far }
  function ScanForXMLAttrib
         (Attributes,
          AttribName : string)
                     : string;
  function ScanStreamDecimal
           (InStream : TStream)                                 { input stream }
                     : longint;                               { decimal number }
  function ScanStreamForXMLTag
           (InStream : TStream;                                 { input stream }
              XMLTag : string;                           { tag to be extracted }
          var Attrib,                                   { found tag attributes }
            Contents : string;                            { found tag contents }
            FeedBack : TOnPercentDoneEvent)                { progress callback }
                     : integer;                                   { error flag }
  function ScanStreamFPNum
           (Instream : TStream;                                 { input stream }
            AllowExp : boolean;
            DecPChar : integer)
                     : double;
  function SearchAndReplace
       (var InStream,                            { input stream to be searched }
           OutStream : TMemoryStream;                       { processed stream }
           SearchExp,                 { search expression (regular expression) }
          ReplaceExp : string;                            { replacement string }
          IgnoreCase : boolean;              { TRUE if cases should be ignored }
           CondToken : integer;    { token of grep search used for a condition }
         Combination : integer;                  { type of logical combination }
            CondText : string;                            { text for condition }
   OnUnknownModifier : TSRUnknownModifierEvent){ handler for unknown modifiers }
                     : boolean;                  { TRUE if any changes occured }
  function StreamAsString
            (AStream : TStream)
                     : string;
  function StreamAsByteString
            (AStream : TStream)
                     : string;
  procedure WriteDoubleToStream
          (OutStream : TStream;                                { output stream }
               value : double);
  procedure WriteExtendedToStream
          (OutStream : TStream;                                { output stream }
               value : extended);
  procedure WriteLongintToStream
          (OutStream : TStream;                                { output stream }
               value : longint);
  procedure WriteLnStream
          (OutStream : TStream;                                { output stream }
                Line : string);
  procedure WriteSingleToStream
          (OutStream : TStream;                                { output stream }
               value : single);
  procedure WriteStringStream
          (OutStream : TStream;                                { output stream }
             AString : string);





Last Update: 2023-Feb-06