Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Enumerations | Functions
rpihw::utils Namespace Reference

Namespace of the utils functions. More...

Enumerations

enum  TextFlags {
  ALIGN_LEFT = 0x01, ALIGN_CENTER = 0x02, ALIGN_RIGHT = 0x04, WORD_WRAP = 0x08,
  WORD_BREAK = 0x10
}
 Parameters of text.
 

Functions

template<typename T >
void set_bit (T &buffer, size_t offset, uint8_t index, bool value=1)
 Sets a bit in a variable. More...
 
template<typename T >
void clear_bit (T &buffer, size_t offset, uint8_t index)
 Clears a bit in a variable. More...
 
template<typename T >
void flip_bit (T &buffer, size_t offset, uint8_t index)
 Flips a bit value in a variable. More...
 
template<typename T >
bool get_bit (T &buffer, size_t offset, uint8_t index)
 Retuns a bit value in a variable. More...
 
template<typename T >
std::basic_string< T > align (const std::basic_string< T > &text, size_t width, uint8_t flags=ALIGN_LEFT)
 Aligns a text. More...
 
std::string format (const char *format,...)
 Returns a formatted string like printf.
 

Detailed Description

Namespace of the utils functions.

Function Documentation

template<typename T >
std::basic_string< T > rpihw::utils::align ( const std::basic_string< T > &  text,
size_t  width,
uint8_t  flags = ALIGN_LEFT 
)

Aligns a text.

Parameters
[in]textThe string to align.
[in]widthThe width of the text.
[in]flagsThe parameters of the text.
Returns
The aligned text.

Definition at line 66 of file utils-inl.hpp.

template<typename T >
void rpihw::utils::clear_bit ( T &  buffer,
size_t  offset,
uint8_t  index 
)
inline

Clears a bit in a variable.

Parameters
[in]bufferThe buffer containing the data.
[in]offsetThe offset position in the buffer.
[in]indexThe bit position.

Definition at line 42 of file utils-inl.hpp.

template<typename T >
void rpihw::utils::flip_bit ( T &  buffer,
size_t  offset,
uint8_t  index 
)
inline

Flips a bit value in a variable.

Parameters
[in]bufferThe buffer containing the data.
[in]offsetThe offset position in the buffer.
[in]indexThe bit position.

Definition at line 50 of file utils-inl.hpp.

template<typename T >
bool rpihw::utils::get_bit ( T &  buffer,
size_t  offset,
uint8_t  index 
)
inline

Retuns a bit value in a variable.

Parameters
[in]bufferThe buffer containing the data.
[in]offsetThe offset position in the buffer.
[in]indexThe bit position.
Returns
The bit value.

Definition at line 58 of file utils-inl.hpp.

template<typename T >
void rpihw::utils::set_bit ( T &  buffer,
size_t  offset,
uint8_t  index,
bool  value = 1 
)
inline

Sets a bit in a variable.

Parameters
[in]bufferThe buffer containing the data.
[in]offsetThe offset position in the buffer.
[in]indexThe bit position.
[in]valueThe bit value.

Definition at line 31 of file utils-inl.hpp.