CppCMS
Classes | Functions
cppcms::util Namespace Reference

This namespace holds various useful helper functions for we developer. More...

Classes

class  const_char_buf
 
class  const_char_istream
 
class  filterbuf
 
class  filterbuf< Filter, 0 >
 
class  stackbuf
 Very simple output stream buffer that uses stack for small chunks of text and then allocates memory of the default buffer is too small. More...
 
class  stackstream
 Fast output stream object. More...
 
class  steal_buffer
 This is a special buffer that allows to "steal" some chunk of text from the output stream. More...
 

Functions

template<typename C , typename P >
details::binder0< C, P > mem_bind (void(C::*mem)(), P obj)
 
template<typename C , typename P , typename P1 >
details::binder1< C, P, P1 > mem_bind (void(C::*mem)(P1), P obj)
 
template<typename C , typename P , typename P1 , typename P2 >
details::binder2< C, P, P1, P2 > mem_bind (void(C::*mem)(P1, P2), P obj)
 
template<typename C , typename P , typename P1 , typename P2 , typename P3 >
details::binder3< C, P, P1, P2, P3 > mem_bind (void(C::*mem)(P1, P2, P3), P obj)
 
template<typename C , typename P , typename P1 , typename P2 , typename P3 , typename P4 >
details::binder4< C, P, P1, P2, P3, P4 > mem_bind (void(C::*mem)(P1, P2, P3, P4), P obj)
 
std::string CPPCMS_API escape (std::string const &s)
 
void CPPCMS_API escape (char const *begin, char const *end, std::ostream &output)
 
int CPPCMS_API escape (char const *begin, char const *end, std::streambuf &output)
 
std::string CPPCMS_API urlencode (std::string const &s)
 
void CPPCMS_API urlencode (char const *begin, char const *end, std::ostream &output)
 
int CPPCMS_API urlencode (char const *begin, char const *end, std::streambuf &output)
 
std::string CPPCMS_API urldecode (std::string const &s)
 
std::string CPPCMS_API urldecode (char const *begin, char const *end)
 
std::string CPPCMS_API md5 (std::string const &input)
 
std::string CPPCMS_API md5hex (std::string const &input)
 

Detailed Description

This namespace holds various useful helper functions for we developer.

Function Documentation

std::string CPPCMS_API cppcms::util::escape ( std::string const &  s)

Escape string for inclusion in HTML page, i.e.

  • < - &lt;
  • > - &gt;
  • & - &amp;
  • " - &quot;
  • &#39; - &#39;

Note, this function does not deal with encodings, so it's up to you to provide valid text encoding

Referenced by cppcms::widgets::numeric< T >::render_value().

void CPPCMS_API cppcms::util::escape ( char const *  begin,
char const *  end,
std::ostream &  output 
)

Escape string for inclusion in HTML page, i.e.

  • < - &lt;
  • > - &gt;
  • & - &amp;
  • " - &quot;
  • &#39; - &#39;

Note, this function does not deal with encodings, so it's up to you to provide valid text encoding

int CPPCMS_API cppcms::util::escape ( char const *  begin,
char const *  end,
std::streambuf &  output 
)

Escape string for inclusion in HTML page, i.e.

  • < - &lt;
  • > - &gt;
  • & - &amp;
  • " - &quot;
  • &#39; - &#39;

Note, this function does not deal with encodings, so it's up to you to provide valid text encoding

if I/O operation on output fails returns -1, otherwise returns 0

std::string CPPCMS_API cppcms::util::md5 ( std::string const &  input)

Make MD5 hash of string input converting into binary string of 16 bytes

std::string CPPCMS_API cppcms::util::md5hex ( std::string const &  input)

Make MD5 hash of string input converting it into hexadecimal string representing this hash

template<typename C , typename P >
details::binder0<C,P> cppcms::util::mem_bind ( void(C::*)()  mem,
obj 
)

Bind a member function mem of object referenced by a pointer obj creating a functional object that has an member function void operator()() const and calls obj->mem()

template<typename C , typename P , typename P1 >
details::binder1<C,P,P1> cppcms::util::mem_bind ( void(C::*)(P1)  mem,
obj 
)

Bind a member function mem of object referenced by a pointer obj creating a functional object that has an member function void operator()(P1 p) const and calls obj->mem(p)

template<typename C , typename P , typename P1 , typename P2 >
details::binder2<C,P,P1,P2> cppcms::util::mem_bind ( void(C::*)(P1, P2)  mem,
obj 
)

Bind a member function mem of object referenced by a pointer obj creating a functional object that has an member function void operator()(P1 p1,P2 p2) const and calls obj->mem(p1,p2)

template<typename C , typename P , typename P1 , typename P2 , typename P3 >
details::binder3<C,P,P1,P2,P3> cppcms::util::mem_bind ( void(C::*)(P1, P2, P3)  mem,
obj 
)

Bind a member function mem of object referenced by a pointer obj creating a functional object that has an member function void operator()(P1 p1,P2 p2,P3 p3) const and calls obj->mem(p1,p2,p3)

template<typename C , typename P , typename P1 , typename P2 , typename P3 , typename P4 >
details::binder4<C,P,P1,P2,P3,P4> cppcms::util::mem_bind ( void(C::*)(P1, P2, P3, P4)  mem,
obj 
)

Bind a member function mem of object referenced by a pointer obj creating a functional object that has an member function void operator()(P1 p1,P2 p2,P3 p3,P4 ) const and calls obj->mem(p1,p2,p3,p4)

std::string CPPCMS_API cppcms::util::urldecode ( std::string const &  s)

Decode string from URL-encoding (percent-encoding)

std::string CPPCMS_API cppcms::util::urldecode ( char const *  begin,
char const *  end 
)

Decode text in range [begin,end) from URL-encoding (percent-encoding)

std::string CPPCMS_API cppcms::util::urlencode ( std::string const &  s)

Encode string for URL (percent encoding)

void CPPCMS_API cppcms::util::urlencode ( char const *  begin,
char const *  end,
std::ostream &  output 
)

Encode string for URL (percent encoding)

int CPPCMS_API cppcms::util::urlencode ( char const *  begin,
char const *  end,
std::streambuf &  output 
)

Encode string for URL (percent encoding), returns -1 in case of IO failure, and 0 on success