FileReader: fix num_lines()
This commit is contained in:
parent
bebd7df072
commit
eb1474bd84
@ -22,7 +22,17 @@ namespace jes
|
|||||||
FileReader();
|
FileReader();
|
||||||
~FileReader();
|
~FileReader();
|
||||||
bool load(const char * fname);
|
bool load(const char * fname);
|
||||||
unsigned int num_lines() { return m_num_lines; }
|
unsigned int num_lines()
|
||||||
|
{
|
||||||
|
if (m_lines.is_null())
|
||||||
|
{
|
||||||
|
return 0u;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return m_lines->size();
|
||||||
|
}
|
||||||
|
}
|
||||||
TextRef get_line(unsigned int line_no);
|
TextRef get_line(unsigned int line_no);
|
||||||
int get_line_endings() { return m_line_endings; }
|
int get_line_endings() { return m_line_endings; }
|
||||||
protected:
|
protected:
|
||||||
@ -31,7 +41,6 @@ namespace jes
|
|||||||
typedef Ref<LineIndexPairVector> LineIndexPairVectorRef;
|
typedef Ref<LineIndexPairVector> LineIndexPairVectorRef;
|
||||||
void load_buf(size_t size);
|
void load_buf(size_t size);
|
||||||
int m_fd;
|
int m_fd;
|
||||||
unsigned int m_num_lines;
|
|
||||||
uint8_t * m_buf;
|
uint8_t * m_buf;
|
||||||
int m_line_endings;
|
int m_line_endings;
|
||||||
LineIndexPairVectorRef m_lines;
|
LineIndexPairVectorRef m_lines;
|
||||||
|
@ -11,7 +11,6 @@ namespace jes
|
|||||||
FileReader::FileReader()
|
FileReader::FileReader()
|
||||||
{
|
{
|
||||||
m_fd = 0;
|
m_fd = 0;
|
||||||
m_num_lines = 0u;
|
|
||||||
m_buf = NULL;
|
m_buf = NULL;
|
||||||
m_line_endings = LINE_ENDING_COUNT;
|
m_line_endings = LINE_ENDING_COUNT;
|
||||||
m_lines = NULL;
|
m_lines = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user