//------------------------------FileBuff-------------------------------------- // This class defines a nicely behaved buffer of text. Entire file of text // is read into buffer at creation, with sentinels at start and end. class FileBuff { private: long _bufferSize; // Size of text holding buffer. long _offset; // Expected filepointer offset. long _bufoff; // Start of buffer file offset
char *_buf; // The buffer itself. char *_bigbuf; // The buffer plus sentinels; actual heap area char *_bufmax; // A pointer to the buffer end sentinel char *_bufeol; // A pointer to the last complete line end
int _err; // Error flag for file seek/read operations long _filepos; // Current offset from start of file int _linenum;
ArchDesc& _AD; // Reference to Architecture Description
// Error reporting function void file_error(int flag, int linenum, constchar *fmt, ...);
public: const BufferedFile *_fp; // File to be buffered
// This returns a pointer to the start of the current line in the buffer, // and increments bufeol and filepos to point at the end of that line. char *get_line(void); int linenum() const { return _linenum; } void set_linenum(int line) { _linenum = line; }
// This converts a pointer into the buffer to a file offset. It only works // when the pointer is valid (i.e. just obtained from getline()). long getoff(constchar* s) { return _bufoff + (long)(s - _buf); }
}; #endif// SHARE_ADLC_FILEBUFF_HPP
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.