Classes | Functions

arma_boost Namespace Reference
[Format_wrap]

namespace for functions and classes which partially emulate Boost functionality More...

Classes

class  format
class  basic_format
struct  format_metaprog
struct  format_metaprog< basic_format< T1, T2 > >
struct  string_only
struct  string_only< std::string >
struct  char_only
struct  char_only< char >
struct  basic_format_only
struct  basic_format_only< basic_format< T > >
struct  basic_format_only< basic_format< T1, T2 > >

Functions

int arma_snprintf (char *out, size_t size, const char *fmt,...)
template<typename T2 >
basic_format< format, T2 > operator% (const format &X, const T2 &arg)
template<typename T1 , typename T2 , typename T3 >
basic_format< basic_format< T1,
T2 >, T3 > 
operator% (const basic_format< T1, T2 > &X, const T3 &arg)
template<typename T2 >
std::string str (const basic_format< format, T2 > &X)
template<typename T2 , typename T3 >
std::string str (const basic_format< basic_format< format, T2 >, T3 > &X)
template<typename T2 , typename T3 , typename T4 >
std::string str (const basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 > &X)
template<typename T2 , typename T3 , typename T4 , typename T5 >
std::string str (const basic_format< basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 >, T5 > &X)
template<typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
std::string str (const basic_format< basic_format< basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 >, T5 >, T6 > &X)
template<typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
std::string str (const basic_format< basic_format< basic_format< basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 >, T5 >, T6 >, T7 > &X)
template<typename T1 , typename T2 >
std::string str (const basic_format< T1, T2 > &X)
template<typename T1 , typename T2 >
std::ostream & operator<< (std::ostream &o, const basic_format< T1, T2 > &X)
template<typename T1 >
static const T1 & str_wrapper (const T1 &x, const typename string_only< T1 >::result *junk=0)
template<typename T1 >
static const T1 * str_wrapper (const T1 *x, const typename char_only< T1 >::result *junk=0)
template<typename T1 >
static std::string str_wrapper (const T1 &x, const typename basic_format_only< T1 >::result *junk=0)

Detailed Description

namespace for functions and classes which partially emulate Boost functionality


Function Documentation

int arma_boost::arma_snprintf ( char *  out,
size_t  size,
const char *  fmt,
  ... 
) [inline]

Definition at line 45 of file format_wrap.hpp.

Referenced by str().

        {
        size_t i;
        
        for(i=0; i<size; ++i)
          {
          out[i] = fmt[i];
          if(fmt[i] == char(0))
            break;
          }
        
        if(size > 0)
          out[size-1] = char(0);
        
        return int(i);
        }

template<typename T2 >
basic_format< format, T2 > arma_boost::operator% ( const format &  X,
const T2 &  arg 
) [inline]

Definition at line 110 of file format_wrap.hpp.

      {
      return basic_format< format, T2 >(X, arg);
      }

template<typename T1 , typename T2 , typename T3 >
basic_format< basic_format<T1,T2>, T3 > arma_boost::operator% ( const basic_format< T1, T2 > &  X,
const T3 &  arg 
) [inline]

Definition at line 120 of file format_wrap.hpp.

      {
      return basic_format< basic_format<T1,T2>, T3 >(X, arg);
      }

template<typename T2 >
std::string arma_boost::str ( const basic_format< format, T2 > &  X  )  [inline]

Definition at line 130 of file format_wrap.hpp.

References arma_boost::format::A, arma_boost::basic_format< T1, T2 >::A, arma_snprintf(), and arma_boost::basic_format< T1, T2 >::B.

Referenced by operator<<(), and str_wrapper().

      {
      char  local_buffer[1024];
      char* buffer = local_buffer;
      
      int buffer_size   = 1024;
      int required_size = buffer_size;
   
      bool using_local_buffer = true;
      
      std::string out;
      
      do
        {
        if(using_local_buffer == false)
          {
          buffer = new char[buffer_size];
          }
        
        required_size = arma_snprintf(buffer, buffer_size, X.A.A.c_str(), X.B);
        
        if(required_size < buffer_size)
          {
          if(required_size > 0)
            {
            out = buffer;
            }
          }
        else
          {
          buffer_size *= 2;
          }
        
        if(using_local_buffer == true)
          {
          using_local_buffer = false;
          }
        else
          {
          delete[] buffer;
          }
        
        } while( (required_size >= buffer_size) );

      return out;
      }

template<typename T2 , typename T3 >
std::string arma_boost::str ( const basic_format< basic_format< format, T2 >, T3 > &  X  )  [inline]

Definition at line 182 of file format_wrap.hpp.

References arma_snprintf().

      {
      char  local_buffer[1024];
      char* buffer = local_buffer;
      
      int buffer_size   = 1024;
      int required_size = buffer_size;
   
      bool using_local_buffer = true;
      
      std::string out;
      
      do
        {
        if(using_local_buffer == false)
          {
          buffer = new char[buffer_size];
          }
        
        required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.c_str(), X.A.B, X.B);
        
        if(required_size < buffer_size)
          {
          if(required_size > 0)
            {
            out = buffer;
            }
          }
        else
          {
          buffer_size *= 2;
          }
        
        if(using_local_buffer == true)
          {
          using_local_buffer = false;
          }
        else
          {
          delete[] buffer;
          }
        
        } while( (required_size >= buffer_size) );

      return out;
      }

template<typename T2 , typename T3 , typename T4 >
std::string arma_boost::str ( const basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 > &  X  )  [inline]

Definition at line 234 of file format_wrap.hpp.

References arma_snprintf().

      {
      char  local_buffer[1024];
      char* buffer = local_buffer;
      
      int buffer_size   = 1024;
      int required_size = buffer_size;
   
      bool using_local_buffer = true;
      
      std::string out;
      
      do
        {
        if(using_local_buffer == false)
          {
          buffer = new char[buffer_size];
          }
        
        required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.c_str(), X.A.A.B, X.A.B, X.B);
        
        if(required_size < buffer_size)
          {
          if(required_size > 0)
            {
            out = buffer;
            }
          }
        else
          {
          buffer_size *= 2;
          }
        
        if(using_local_buffer == true)
          {
          using_local_buffer = false;
          }
        else
          {
          delete[] buffer;
          }
        
        } while( (required_size >= buffer_size) );

      return out;
      }

template<typename T2 , typename T3 , typename T4 , typename T5 >
std::string arma_boost::str ( const basic_format< basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 >, T5 > &  X  )  [inline]

Definition at line 286 of file format_wrap.hpp.

References arma_snprintf().

      {
      char  local_buffer[1024];
      char* buffer = local_buffer;
      
      int buffer_size   = 1024;
      int required_size = buffer_size;
   
      bool using_local_buffer = true;
      
      std::string out;
      
      do
        {
        if(using_local_buffer == false)
          {
          buffer = new char[buffer_size];
          }
        
        required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.A.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
        
        if(required_size < buffer_size)
          {
          if(required_size > 0)
            {
            out = buffer;
            }
          }
        else
          {
          buffer_size *= 2;
          }
        
        if(using_local_buffer == true)
          {
          using_local_buffer = false;
          }
        else
          {
          delete[] buffer;
          }
        
        } while( (required_size >= buffer_size) );

      return out;
      }

template<typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
std::string arma_boost::str ( const basic_format< basic_format< basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 >, T5 >, T6 > &  X  )  [inline]

Definition at line 338 of file format_wrap.hpp.

References arma_snprintf().

      {
      char  local_buffer[1024];
      char* buffer = local_buffer;
      
      int buffer_size   = 1024;
      int required_size = buffer_size;
   
      bool using_local_buffer = true;
      
      std::string out;
      
      do
        {
        if(using_local_buffer == false)
          {
          buffer = new char[buffer_size];
          }
        
        required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.A.A.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
        
        if(required_size < buffer_size)
          {
          if(required_size > 0)
            {
            out = buffer;
            }
          }
        else
          {
          buffer_size *= 2;
          }
        
        if(using_local_buffer == true)
          {
          using_local_buffer = false;
          }
        else
          {
          delete[] buffer;
          }
        
        } while( (required_size >= buffer_size) );

      return out;
      }

template<typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
std::string arma_boost::str ( const basic_format< basic_format< basic_format< basic_format< basic_format< basic_format< format, T2 >, T3 >, T4 >, T5 >, T6 >, T7 > &  X  )  [inline]

Definition at line 390 of file format_wrap.hpp.

References arma_snprintf().

      {
      char  local_buffer[1024];
      char* buffer = local_buffer;
      
      int buffer_size   = 1024;
      int required_size = buffer_size;
   
      bool using_local_buffer = true;
      
      std::string out;
      
      do
        {
        if(using_local_buffer == false)
          {
          buffer = new char[buffer_size];
          }
        
        required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.A.A.A.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
        
        if(required_size < buffer_size)
          {
          if(required_size > 0)
            {
            out = buffer;
            }
          }
        else
          {
          buffer_size *= 2;
          }
        
        if(using_local_buffer == true)
          {
          using_local_buffer = false;
          }
        else
          {
          delete[] buffer;
          }
        
        } while( (required_size >= buffer_size) );

      return out;
      }

template<typename T1 , typename T2 >
std::string arma_boost::str ( const basic_format< T1, T2 > &  X  )  [inline]

Definition at line 476 of file format_wrap.hpp.

References arma_boost::basic_format< T1, T2 >::A.

      {
      return format_metaprog< basic_format<T1,T2> >::get_fmt(X.A);
      }

template<typename T1 , typename T2 >
std::ostream& arma_boost::operator<< ( std::ostream &  o,
const basic_format< T1, T2 > &  X 
) [inline]

Definition at line 486 of file format_wrap.hpp.

References str().

      {
      o << str(X);
      return o;
      }

template<typename T1 >
static const T1& arma_boost::str_wrapper ( const T1 &  x,
const typename string_only< T1 >::result *  junk = 0 
) [inline, static]

Definition at line 519 of file format_wrap.hpp.

Referenced by arma_check().

    {
    return x;
    }

template<typename T1 >
static const T1* arma_boost::str_wrapper ( const T1 *  x,
const typename char_only< T1 >::result *  junk = 0 
) [inline, static]

Definition at line 530 of file format_wrap.hpp.

    {
    return x;
    }

template<typename T1 >
static std::string arma_boost::str_wrapper ( const T1 &  x,
const typename basic_format_only< T1 >::result *  junk = 0 
) [inline, static]

Definition at line 541 of file format_wrap.hpp.

References str().

    {
    return str(x);
    }