OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    Standard_ReadLineBuffer Class Reference

    Auxiliary tool for buffered reading of lines from input stream. More...

    #include <Standard_ReadLineBuffer.hxx>

    Public Member Functions

     Standard_ReadLineBuffer (size_t theMaxBufferSizeBytes)
     Constructor with initialization.
    virtual ~Standard_ReadLineBuffer ()=default
     Destructor.
    void Clear ()
     Clear buffer and cached values.
    template<typename Stream_T>
    const char * ReadLine (Stream_T &theStream, size_t &theLineLength)
     Read next line from the stream.
    template<typename Stream_T>
    const char * ReadLine (Stream_T &theStream, size_t &theLineLength, int64_t &theReadData)
     Read next line from the stream.
    bool IsMultilineMode () const
     Returns TRUE when the Multiline Mode is on; FALSE by default. Multiline modes joins several lines in file having \ at the end of line:
    bool ToPutGapInMultiline () const
     Put gap space while merging lines within multiline syntax, so that the following sample:
    void SetMultilineMode (bool theMultilineMode, bool theToPutGap=true)
     Sets or unsets the multi-line mode.

    Protected Member Functions

    bool readStream (std::istream &theStream, size_t theLen, size_t &theReadLen)
     Read from stl stream.
    bool readStream (FILE *theStream, size_t theLen, size_t &theReadLen)
     Read from FILE stream.

    Protected Attributes

    NCollection_LinearVector< char > myReadBuffer
     Temp read buffer.
    NCollection_LinearVector< char > myReadBufferLastStr
     Part of last string of myReadBuffer.
    bool myUseReadBufferLastStr
     Flag to use myReadBufferLastStr during next line reading.
    bool myIsMultilineMode
     Flag to process of the special multi-line case at the end of the line.
    bool myToPutGapInMultiline
     Flag to put gap space while joining lines in multi-line syntax.
    size_t myBufferPos
     Current position in myReadBuffer.
    size_t myBytesLastRead
     The number of characters that were read last time from myReadBuffer.

    Detailed Description

    Auxiliary tool for buffered reading of lines from input stream.

    Constructor & Destructor Documentation

    ◆ Standard_ReadLineBuffer()

    Standard_ReadLineBuffer::Standard_ReadLineBuffer ( size_t theMaxBufferSizeBytes)
    inline

    Constructor with initialization.

    Parameters
    theMaxBufferSizeBytesthe length of buffer to read (in bytes)

    ◆ ~Standard_ReadLineBuffer()

    virtual Standard_ReadLineBuffer::~Standard_ReadLineBuffer ( )
    virtualdefault

    Destructor.

    Member Function Documentation

    ◆ Clear()

    void Standard_ReadLineBuffer::Clear ( )
    inline

    Clear buffer and cached values.

    ◆ IsMultilineMode()

    bool Standard_ReadLineBuffer::IsMultilineMode ( ) const
    inline

    Returns TRUE when the Multiline Mode is on; FALSE by default. Multiline modes joins several lines in file having \ at the end of line:

    Line starts here, \ // line continuation character without this comment
    continues \ // line continuation character without this comment
    and ends.

    ◆ ReadLine() [1/2]

    template<typename Stream_T>
    const char * Standard_ReadLineBuffer::ReadLine ( Stream_T & theStream,
    size_t & theLineLength )
    inline

    Read next line from the stream.

    Returns
    pointer to the line or NULL on error / end of reading buffer (in case of NULL result theStream should be checked externally to identify the presence of errors). Empty lines will be returned also with zero length.
    Parameters
    theStream[inout] - the stream to read from.
    [out]theLineLength- output parameter defined length of returned line.

    ◆ ReadLine() [2/2]

    template<typename Stream_T>
    const char * Standard_ReadLineBuffer::ReadLine ( Stream_T & theStream,
    size_t & theLineLength,
    int64_t & theReadData )
    inline

    Read next line from the stream.

    Returns
    pointer to the line or NULL on error / end of reading buffer (in case of NULL result theStream should be checked externally to identify the presence of errors). Empty lines will be returned also with zero length.
    Parameters
    theStream[inout] - the stream to read from.
    [out]theLineLength- output parameter defined length of returned line.
    [out]theReadData- output parameter defined the number of elements successfully read from the stream during this call, it can be zero if no data was read and the line is taken from the buffer.

    ◆ readStream() [1/2]

    bool Standard_ReadLineBuffer::readStream ( FILE * theStream,
    size_t theLen,
    size_t & theReadLen )
    inlineprotected

    Read from FILE stream.

    Returns
    true if reading was finished without errors.

    ◆ readStream() [2/2]

    bool Standard_ReadLineBuffer::readStream ( std::istream & theStream,
    size_t theLen,
    size_t & theReadLen )
    inlineprotected

    Read from stl stream.

    Returns
    true if reading was finished without errors.

    ◆ SetMultilineMode()

    void Standard_ReadLineBuffer::SetMultilineMode ( bool theMultilineMode,
    bool theToPutGap = true )
    inline

    Sets or unsets the multi-line mode.

    Parameters
    [in]theMultilineModemultiline mode flag
    [in]theToPutGapput gap space while connecting lines (no gap otherwise)

    ◆ ToPutGapInMultiline()

    bool Standard_ReadLineBuffer::ToPutGapInMultiline ( ) const
    inline

    Put gap space while merging lines within multiline syntax, so that the following sample:

    1/2/3\ // line continuation character without this comment
    4/5/6

    Will become "1/2/3 4/5/6" when flag is TRUE, and "1/2/35/5/6" otherwise.

    Field Documentation

    ◆ myBufferPos

    size_t Standard_ReadLineBuffer::myBufferPos
    protected

    Current position in myReadBuffer.

    ◆ myBytesLastRead

    size_t Standard_ReadLineBuffer::myBytesLastRead
    protected

    The number of characters that were read last time from myReadBuffer.

    ◆ myIsMultilineMode

    bool Standard_ReadLineBuffer::myIsMultilineMode
    protected

    Flag to process of the special multi-line case at the end of the line.

    ◆ myReadBuffer

    NCollection_LinearVector<char> Standard_ReadLineBuffer::myReadBuffer
    protected

    Temp read buffer.

    ◆ myReadBufferLastStr

    NCollection_LinearVector<char> Standard_ReadLineBuffer::myReadBufferLastStr
    protected

    Part of last string of myReadBuffer.

    ◆ myToPutGapInMultiline

    bool Standard_ReadLineBuffer::myToPutGapInMultiline
    protected

    Flag to put gap space while joining lines in multi-line syntax.

    ◆ myUseReadBufferLastStr

    bool Standard_ReadLineBuffer::myUseReadBufferLastStr
    protected

    Flag to use myReadBufferLastStr during next line reading.


    The documentation for this class was generated from the following file: