chxavnextline.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:1k
- /*============================================================================*
- *
- * (c) 1995-2002 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- *============================================================================*/
-
- #ifndef _NEXT_LINE_H
- #define _NEXT_LINE_H
- #include "hxstring.h"
- #include "chxavbuffer.h"
- #include "chxbody.h"
- #include "chxsmartptr.h"
- #include "chxmakesmartptr.h"
- class CHXAvNextLine : public CHXBody {
- public:
- CHXAvNextLine(const CHXString& name="");
- ~CHXAvNextLine();
- bool Open(); // Open file
- void Close(); // Close file
- bool IsOpen() const; // Return true if open
- bool Reset(); // If file rewindable seek to beginning
- bool GetLine(CHXString& line); // Get next line
- bool End() const; // return true if at end of file
- int LineNum() const; // Current line number
- protected:
- // replacement for system fgets that
- // looks for r in addtion to n
- char* FGetS(CHXAvBuffer& buf, FILE* fp);
- private:
- CHXString m_name; // File name: if "" then use stdin
- FILE* m_pFile; // Use stdio for now
- CHXAvBuffer m_buf; // Buffer for reading lines
- int m_lineNum; // Current line number
- };
- inline
- int CHXAvNextLine::LineNum() const
- {
- return m_lineNum;
- }
- #endif // _NEXT_LINE_H