foobar2000 SDK  2015-08-03
Public Member Functions | Private Attributes
pfc::format_hex

#include <string_base.h>

Public Member Functions

 format_hex (t_uint64 p_val, unsigned p_width=0)
 
 format_hex (const format_hex &p_source)
 
const char * get_ptr () const
 
 operator const char * () const
 
const char * toString () const
 

Private Attributes

char m_buffer [17]
 

Detailed Description

Definition at line 587 of file string_base.h.

Constructor & Destructor Documentation

pfc::format_hex::format_hex ( t_uint64  p_val,
unsigned  p_width = 0 
)

Definition at line 519 of file string_base.cpp.

520 {
521  if (p_width > 16) p_width = 16;
522  else if (p_width == 0) p_width = 1;
523  char temp[16];
524  unsigned n;
525  for(n=0;n<16;n++)
526  {
527  temp[15-n] = format_hex_char((unsigned)(p_val & 0xF));
528  p_val >>= 4;
529  }
530 
531  for(n=0;n<16 && temp[n] == '0';n++) {}
532 
533  if (n > 16 - p_width) n = 16 - p_width;
534 
535  char * out = m_buffer;
536  for(;n<16;n++)
537  *(out++) = temp[n];
538  *out = 0;
539 }
char m_buffer[17]
Definition: string_base.h:596
char format_hex_char(unsigned p_val)
pfc::format_hex::format_hex ( const format_hex p_source)
inline

Definition at line 591 of file string_base.h.

591 {*this = p_source;}

Member Function Documentation

const char* pfc::format_hex::get_ptr ( ) const
inline

Definition at line 592 of file string_base.h.

592 {return m_buffer;}
char m_buffer[17]
Definition: string_base.h:596
pfc::format_hex::operator const char * ( ) const
inline

Definition at line 594 of file string_base.h.

594 {return m_buffer;}
char m_buffer[17]
Definition: string_base.h:596
const char* pfc::format_hex::toString ( ) const
inline

Definition at line 593 of file string_base.h.

593 {return m_buffer;}
char m_buffer[17]
Definition: string_base.h:596

Field Documentation

char pfc::format_hex::m_buffer[17]
private

Definition at line 596 of file string_base.h.


The documentation for this class was generated from the following files: