Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
Interface_LineBuffer Class Reference

Simple Management of a Line Buffer, to be used by Interface File Writers. While a String is suitable to do that, this class ensures an optimised Memory Management, because this is a hard point of File Writing. More...

#include <Interface_LineBuffer.hxx>

Public Member Functions

 Interface_LineBuffer (const int size=10)
 Creates a LineBuffer with an absolute maximum size (Default value is only to satisfy compiler requirement)
 
void SetMax (const int max)
 Changes Maximum allowed size of Buffer. If <max> is Zero, Maximum size is set to the initial size.
 
void SetInitial (const int initial)
 Sets an Initial reservation for Blank characters (this reservation is counted in the size of the current Line)
 
void SetKeep ()
 Sets a Keep Status at current Length. It means that at next Move, the new line will begin by characters between Keep + 1 and current Length.
 
bool CanGet (const int more)
 Returns True if there is room enough to add <more> characters Else, it is required to Dump the Buffer before refilling it <more> is recorded to manage SetKeep status.
 
const charContent () const
 Returns the Content of the LineBuffer.
 
int Length () const
 Returns the Length of the LineBuffer.
 
void Clear ()
 Clears completely the LineBuffer.
 
void FreezeInitial ()
 Inhibits effect of SetInitial until the next Move (i.e. Keep) Then Prepare will not insert initial blanks, but further ones will. This allows to cancel initial blanks on an internal Split A call to SetInitial has no effect on this until Move.
 
void Move (TCollection_AsciiString &str)
 Fills a AsciiString <str> with the Content of the Line Buffer, then Clears the LineBuffer.
 
void Move (const occ::handle< TCollection_HAsciiString > &str)
 Same as above, but <str> is known through a Handle.
 
occ::handle< TCollection_HAsciiStringMoved ()
 Same as above, but generates the HAsciiString.
 
void Add (const char *const text)
 Adds a text as a CString. Its Length is evaluated from the text (by C function strlen)
 
void Add (const char *const text, const int lntext)
 Adds a text as a CString. Its length is given as <lntext>
 
void Add (const TCollection_AsciiString &text)
 Adds a text as a AsciiString from TCollection.
 
void Add (const char text)
 Adds a text made of only ONE Character.
 

Detailed Description

Simple Management of a Line Buffer, to be used by Interface File Writers. While a String is suitable to do that, this class ensures an optimised Memory Management, because this is a hard point of File Writing.

Constructor & Destructor Documentation

◆ Interface_LineBuffer()

Interface_LineBuffer::Interface_LineBuffer ( const int size = 10)

Creates a LineBuffer with an absolute maximum size (Default value is only to satisfy compiler requirement)

Member Function Documentation

◆ Add() [1/4]

void Interface_LineBuffer::Add ( const char *const text)

Adds a text as a CString. Its Length is evaluated from the text (by C function strlen)

◆ Add() [2/4]

void Interface_LineBuffer::Add ( const char *const text,
const int lntext )

Adds a text as a CString. Its length is given as <lntext>

◆ Add() [3/4]

void Interface_LineBuffer::Add ( const char text)

Adds a text made of only ONE Character.

◆ Add() [4/4]

void Interface_LineBuffer::Add ( const TCollection_AsciiString & text)

Adds a text as a AsciiString from TCollection.

◆ CanGet()

bool Interface_LineBuffer::CanGet ( const int more)

Returns True if there is room enough to add <more> characters Else, it is required to Dump the Buffer before refilling it <more> is recorded to manage SetKeep status.

◆ Clear()

void Interface_LineBuffer::Clear ( )

Clears completely the LineBuffer.

◆ Content()

const char * Interface_LineBuffer::Content ( ) const
inline

Returns the Content of the LineBuffer.

◆ FreezeInitial()

void Interface_LineBuffer::FreezeInitial ( )

Inhibits effect of SetInitial until the next Move (i.e. Keep) Then Prepare will not insert initial blanks, but further ones will. This allows to cancel initial blanks on an internal Split A call to SetInitial has no effect on this until Move.

◆ Length()

int Interface_LineBuffer::Length ( ) const
inline

Returns the Length of the LineBuffer.

◆ Move() [1/2]

void Interface_LineBuffer::Move ( const occ::handle< TCollection_HAsciiString > & str)

Same as above, but <str> is known through a Handle.

◆ Move() [2/2]

void Interface_LineBuffer::Move ( TCollection_AsciiString & str)

Fills a AsciiString <str> with the Content of the Line Buffer, then Clears the LineBuffer.

◆ Moved()

occ::handle< TCollection_HAsciiString > Interface_LineBuffer::Moved ( )

Same as above, but generates the HAsciiString.

◆ SetInitial()

void Interface_LineBuffer::SetInitial ( const int initial)

Sets an Initial reservation for Blank characters (this reservation is counted in the size of the current Line)

◆ SetKeep()

void Interface_LineBuffer::SetKeep ( )

Sets a Keep Status at current Length. It means that at next Move, the new line will begin by characters between Keep + 1 and current Length.

◆ SetMax()

void Interface_LineBuffer::SetMax ( const int max)

Changes Maximum allowed size of Buffer. If <max> is Zero, Maximum size is set to the initial size.


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