Beispiel #1
0
octet_string mac_addr::address() const
{
	octet_string str;

	for (size_t i = 0; i < _addr.size(); ++i) {
		str += to_string_hex(&_addr[i], 1);
		str += ':';
	}
	if (str.length())
		str.erase(str.length() - 1);

	return str;
}
Beispiel #2
0
void DebugRFFC5072RegistersWidget::draw_legend(Painter& painter) {
	for(size_t i=0; i<registers_count; i+=registers_per_row) {
		const Point offset {
			0, static_cast<Coord>((i / registers_per_row) * row_height)
		};

		const auto text = to_string_hex(i, legend_length);
		painter.draw_string(
			screen_pos() + offset,
			style(),
			text
		);
	}
}
Beispiel #3
0
void RegistersWidget::draw_legend(const Coord left, Painter& painter) {
	const auto pos = screen_pos();

	for(int i=0; i<config.registers_count; i+=config.registers_per_row) {
		const Point offset {
			left, (i / config.registers_per_row) * row_height
		};

		const auto text = to_string_hex(i, config.legend_length);
		painter.draw_string(
			pos + offset,
			style().invert(),
			text
		);
	}
}
Beispiel #4
0
//================[ ASCII format return ]=============================
const char  * OctetStr::to_string()
{
  for ( unsigned long i=0; i < smival.value.string.len; i++) {
    if (( smival.value.string.ptr[i] != '\r')&&
                ( smival.value.string.ptr[i] != '\n')&&
                (ACE_OS::ace_isprint((int) (smival.value.string.ptr[i]))==0))
         return(to_string_hex());
  }

  if ( output_buffer != 0)
          delete [] output_buffer;

  ACE_NEW_RETURN(output_buffer, char[smival.value.string.len + 1], "");
  if (smival.value.string.len)
    ACE_OS::memcpy(output_buffer, smival.value.string.ptr,
                   (int) smival.value.string.len);
  output_buffer[smival.value.string.len] = '\0';
  return output_buffer;
}
Beispiel #5
0
void DebugRFFC5072RegistersWidget::draw_values(
	Painter& painter,
	const rffc507x::RegisterMap registers
) {
	for(size_t i=0; i<registers_count; i++) {
		const Point offset = {
			static_cast<Coord>(legend_width + 8 + (i % registers_per_row) * (value_width + 8)),
			static_cast<Coord>((i / registers_per_row) * row_height)
		};

		const uint16_t value = registers.w[i];

		const auto text = to_string_hex(value, value_length);
		painter.draw_string(
			screen_pos() + offset,
			style(),
			text
		);
	}
}
Beispiel #6
0
void RegistersWidget::draw_values(
	const Coord left,
	Painter& painter
) {
	const auto pos = screen_pos();

	for(int i=0; i<config.registers_count; i++) {
		const Point offset = {
			left + config.legend_width() + 8 + (i % config.registers_per_row) * (config.value_width() + 8),
			(i / config.registers_per_row) * row_height
		};

		const auto value = reader(i);

		const auto text = to_string_hex(value, config.value_length);
		painter.draw_string(
			pos + offset,
			style(),
			text
		);
	}
}
Beispiel #7
0
inline std::string to_string_hex(const T& v)
{
	return to_string_hex(&v, sizeof(T));
}
Beispiel #8
0
std::string flags(Flags flags) {
	return to_string_hex(flags, 2);
}
Beispiel #9
0
std::string id(TransponderID id) {
	return to_string_hex(id.value(), 8);
}