bool command_line_params::get_value_as_string(const char* pKey, uint index, dynamic_string& value, uint value_index) const { param_map_const_iterator it = get_param(pKey, index); if ((it == end()) || (value_index >= it->second.m_values.size())) { value.empty(); return false; } value = it->second.m_values[value_index]; return true; }
bool data_stream::read_line(dynamic_string &str) { str.empty(); for (;;) { const int c = read_byte(); const bool prev_got_cr = m_got_cr; m_got_cr = false; if (c < 0) { if (!str.is_empty()) break; return false; } // ignores DOS EOF, assumes it's at the very end of the file else if ((26 == c) || (!c)) continue; else if (13 == c) { m_got_cr = true; break; } else if (10 == c) { if (prev_got_cr) continue; break; } str.append_char(static_cast<char>(c)); } return true; }
bool data_stream::read_line(dynamic_string &str) { str.empty(); for (;;) { // Can't be const--need to deal with Mac OS9 style line endings via substition const int c = read_byte(); if (c < 0) { if (!str.is_empty()) break; return false; } // ignores DOS EOF, assumes it's at the very end of the file else if ((26 == c) || (!c)) continue; else if (c_CR == c) { // This path handles OS9 and Windows style line endings. // Check to see if the next character is a LF, if so eat that one too. if (c_LF == peek_byte()) { read_byte(); } break; } else if (c_LF == c) { // UNIX style line endings. break; } str.append_char(static_cast<char>(c)); } return true; }