Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
str_funcs.h File Reference
#include <stdint.h>
#include <string>
#include <list>
#include <vector>
#include <stdarg.h>
Include dependency graph for str_funcs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PVAR(v)   " "#v" = " << (v)
 
#define PVARX(v)   " "#v" = 0x" << std::hex << (v) << std::dec
 
#define PLOC   __FILE__ << ":" << __LINE__ << " "
 

Functions

void str_replace (std::string &s1, const std::string &s2, const std::string &s3)
 
void str_remove (std::string &s1, const std::string &s2)
 
void str_length_trim (std::string &s1, int maxlen)
 
void str_pad (std::string &s1, int len, char cc)
 
uint32_t str_to_uint32 (const std::string &s1, int base=10)
 
void str_toupper (std::string &s1)
 
void str_tolower (std::string &s1)
 
void str_vsprintf (std::string &s1, const char *fmt, va_list args)
 
void str_sprintf (std::string &s1, const char *fmt,...)
 
std::string str_sprintf (const char *fmt,...)
 
void str_split (std::vector< std::string > &list, const std::string &s1, const std::string &s2, bool keep_empty=true)
 
void str_strcpy (char *destination, const std::string &source, size_t dest_buf_size)
 
template<size_t dest_buf_size>
void str_strcpy (char(&destination)[dest_buf_size], const std::string &source)
 
void str_from_ip (std::string &s1, uint32_t ip)
 
std::string format_ipaddr (uint32_t ip)
 
uint32_t ip_from_str (const char *s1)
 
uint32_t ip_from_str (const std::string &s1)
 
void parse_macaddr (const std::string &s1, uint8_t *macaddr)
 
std::string format_macaddr (const uint8_t *macaddr)
 
std::string xml_escape (const char *str)
 
std::string xml_escape (std::string str)
 
void split_ip (uint32_t ip, uint8_t *octets)
 Converts a uint32 IP address into four octets. More...
 
void form_ip (uint32_t &ip, uint8_t *octets)
 Converts four octets into a uint32 IP address. More...
 
std::string fileToString (const char *filename)
 
std::string getcwd_string ()
 Get the cwd as a string object. More...
 
void hexdump (void *ptr, int buflen)
 simple hex dump routine More...
 

Macro Definition Documentation

◆ PLOC

#define PLOC   __FILE__ << ":" << __LINE__ << " "

◆ PVAR

#define PVAR (   v)    " "#v" = " << (v)

◆ PVARX

#define PVARX (   v)    " "#v" = 0x" << std::hex << (v) << std::dec

Function Documentation

◆ fileToString()

std::string fileToString ( const char *  filename)

◆ form_ip()

void form_ip ( uint32_t &  ip,
uint8_t *  octets 
)

Converts four octets into a uint32 IP address.

◆ format_ipaddr()

std::string format_ipaddr ( uint32_t  ip)

◆ format_macaddr()

std::string format_macaddr ( const uint8_t *  macaddr)

◆ getcwd_string()

std::string getcwd_string ( )

Get the cwd as a string object.

Returns
std::string

◆ hexdump()

void hexdump ( void *  ptr,
int  buflen 
)

simple hex dump routine

Parameters
ptrmemory to print
buflennumber of bytes

◆ ip_from_str() [1/2]

uint32_t ip_from_str ( const char *  s1)

◆ ip_from_str() [2/2]

uint32_t ip_from_str ( const std::string &  s1)

◆ parse_macaddr()

void parse_macaddr ( const std::string &  s1,
uint8_t *  macaddr 
)

◆ split_ip()

void split_ip ( uint32_t  ip,
uint8_t *  octets 
)

Converts a uint32 IP address into four octets.

◆ str_from_ip()

void str_from_ip ( std::string &  s1,
uint32_t  ip 
)

◆ str_length_trim()

void str_length_trim ( std::string &  s1,
int  maxlen 
)

◆ str_pad()

void str_pad ( std::string &  s1,
int  len,
char  cc 
)

◆ str_remove()

void str_remove ( std::string &  s1,
const std::string &  s2 
)

◆ str_replace()

void str_replace ( std::string &  s1,
const std::string &  s2,
const std::string &  s3 
)

◆ str_split()

void str_split ( std::vector< std::string > &  list,
const std::string &  s1,
const std::string &  s2,
bool  keep_empty = true 
)

◆ str_sprintf() [1/2]

std::string str_sprintf ( const char *  fmt,
  ... 
)

◆ str_sprintf() [2/2]

void str_sprintf ( std::string &  s1,
const char *  fmt,
  ... 
)

◆ str_strcpy() [1/2]

void str_strcpy ( char *  destination,
const std::string &  source,
size_t  dest_buf_size 
)

◆ str_strcpy() [2/2]

template<size_t dest_buf_size>
void str_strcpy ( char(&)  destination[dest_buf_size],
const std::string &  source 
)

◆ str_to_uint32()

uint32_t str_to_uint32 ( const std::string &  s1,
int  base = 10 
)

◆ str_tolower()

void str_tolower ( std::string &  s1)

◆ str_toupper()

void str_toupper ( std::string &  s1)

◆ str_vsprintf()

void str_vsprintf ( std::string &  s1,
const char *  fmt,
va_list  args 
)

◆ xml_escape() [1/2]

std::string xml_escape ( const char *  str)

◆ xml_escape() [2/2]

std::string xml_escape ( std::string  str)