Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

strmsize.h File Reference

This file contains stream_size_of functions for basic types and *STREAMABLE macros. stream_size_of functions return the size of the object's data that is written or read from a stream. More...


Namespaces

namespace  ustl

Defines

#define NOT_STREAMABLE(T)
 Declares that T is not written to istream/ostream.
#define INTEGRAL_STREAMABLE(T)
 Declares that T is to be written as is into binary streams.
#define STD_STREAMABLE(T)
 Declares that T contains read, write, and stream_size methods.
#define CAST_STREAMABLE(T, TSUB)
 Declares that T is to be cast into TSUB for streaming.
#define DECLARE_STD_STREAMABLE
 Placed into a class it declares the methods required by STD_STREAMABLE. Syntactic sugar.
#define TEXT_STREAMABLE(T)
 Declares T to be writable to text streams. Reading is not implemented because you should not do it.
#define LOOKUP_TEXT_STREAMABLE(T, Names, nNames)

Functions

template<typename T>
size_t stream_size_of (T *)
 Returns the size of the given object. Overloads for standard types are available.
size_t stream_size_of (int8_t)
size_t stream_size_of (uint8_t)
size_t stream_size_of (int16_t)
size_t stream_size_of (uint16_t)
size_t stream_size_of (int32_t)
size_t stream_size_of (uint32_t)
size_t stream_size_of (float)
size_t stream_size_of (double)
size_t stream_size_of (bool)
size_t stream_size_of (wchar_t)
size_t stream_size_of (long v)
size_t stream_size_of (unsigned long v)


Detailed Description

This file contains stream_size_of functions for basic types and *STREAMABLE macros. stream_size_of functions return the size of the object's data that is written or read from a stream.


Define Documentation

#define CAST_STREAMABLE T,
TSUB   ) 
 

Value:

namespace ustl {                \
        inline istream& operator>> (istream& is, T& v)          { TSUB sv; is >> sv; v = (T)(sv); return (is); }        \
        inline ostream& operator<< (ostream& os, const T& v)    { os << TSUB(v); return (os); }                 \
        inline size_t stream_size_of (const T& v)               { return (sizeof(TSUB(v))); }                           \
    }
Declares that T is to be cast into TSUB for streaming.

#define DECLARE_STD_STREAMABLE
 

Value:

public:                                 \
        void    read (istream& is);             \
        void    write (ostream& os) const;      \
        size_t  stream_size (void) const
Placed into a class it declares the methods required by STD_STREAMABLE. Syntactic sugar.

#define INTEGRAL_STREAMABLE  ) 
 

Value:

namespace ustl {                \
        inline istream& operator>> (istream& is, T& v)          { is.iread(v);  return (is); }  \
        inline ostream& operator<< (ostream& os, const T& v)    { os.iwrite(v); return (os); }  \
        inline ostream& operator<< (ostream& os, T& v)          { os.iwrite(v); return (os); }  \
        inline size_t stream_size_of (const T& v)               { return (sizeof(v)); }         \
        inline size_t stream_size_of (T& v)                     { return (sizeof(v)); }         \
    }
Declares that T is to be written as is into binary streams.

#define LOOKUP_TEXT_STREAMABLE T,
Names,
nNames   ) 
 

Value:

namespace ustl {                \
        inline ostringstream& operator<< (ostringstream& os, const T& v)        \
        {                               \
            if (uoff_t(v) < (nNames))   \
                os << Names[v];         \
            else                        \
                os << uoff_t(v);        \
            return (os);                \
        }                               \
    }

#define NOT_STREAMABLE  ) 
 

Value:

namespace ustl {                \
        inline istream& operator>> (istream& is, T&)            { return (is); }        \
        inline ostream& operator<< (ostream& os, const T&)      { return (os); }        \
        inline size_t stream_size_of (const T&)                 { return (0); }         \
    }
Declares that T is not written to istream/ostream.

#define STD_STREAMABLE  ) 
 

Value:

namespace ustl {                \
        inline istream& operator>> (istream& is, T& v)          { v.read (is);  return (is); }  \
        inline ostream& operator<< (ostream& os, const T& v)    { v.write (os); return (os); }  \
        inline size_t stream_size_of (const T& v)               { return (v.stream_size()); }   \
    }
Declares that T contains read, write, and stream_size methods.

#define TEXT_STREAMABLE  ) 
 

Value:

namespace ustl {                \
        inline ostringstream& operator<< (ostringstream& os, const T& v)        \
            { v.text_write (os); return (os); } \
    }
Declares T to be writable to text streams. Reading is not implemented because you should not do it.


Generated on Mon Jan 17 14:35:02 2005 for uSTL by 1.3.9 Doxygen Hosted on SourceForge.net