示例#1
0
wxString FileAnalysis::GetNextLine()
{
  if ( HasMoreLines() )
  {
    wxString LineOfFile = m_LinesOfFile.Item(m_CurrentLine);
    m_CurrentLine++;
    return LineOfFile;
  }

  return wxEmptyString;
}
示例#2
0
	bool HasLines() {
		if (HasMoreLines()) {
			return true;
		}
		// Don't say yes if it's a blank line.
		for (int i = 0; i < valid_; ++i) {
			if (!buffer_[i].empty()) {
				return true;
			}
		}
		return false;
	}
wxString CSVLineTokenizer::GetNextLine(bool & partial)
{
    wxString token;
    partial = true;

    if ( !HasMoreLines() )
        return token;

    // find the end of this line.  CSV lines end in "\n", but 
    // CSV lines may have "\n" chars inside double-quoted strings, so we need to find that out.

    bool inquote = false;
    for (size_t pos = m_pos; pos < m_string.length(); pos++)
    {
        if (m_string[pos] == wxT('\"'))
            inquote = !inquote;

        if (m_string[pos] == wxT('\n') && !inquote)
        {
            // Good, we found a complete log line terminated 
            // by "\n", and the "\n" wasn't in a quoted string.

            size_t len = pos - m_pos + 1;   // return the line, including the trailing "\n"
            token.assign(m_string, m_pos, len);
            m_pos = pos + 1;                // point to next line.
            partial = false;
            return token;
        }
    }

    // no more delimiters, so the line is everything till the end of
    // string, but we don't have all of the CSV the line... Some must still be coming.
     
    token.assign(m_string, m_pos, wxString::npos);
    partial = true;

    m_pos = m_string.length();
  
    return token;
}
示例#4
0
	void Fill() {
		while (valid_ < MAX_BUFFER && HasMoreLines()) {
			buffer_[valid_++] = TrimNewlines(ReadLine());
		}
	}