os/ossrv/stdcpp/tsrc/Stdcpp_test/stdcxx/include/any.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/***************************************************************************
sl@0
     2
 *
sl@0
     3
 * any.h - definition of the rw_any_t class
sl@0
     4
 *
sl@0
     5
 * $Id: any.h 290028 2005-09-19 00:25:26Z sebor $
sl@0
     6
 *
sl@0
     7
 ***************************************************************************
sl@0
     8
 *
sl@0
     9
 * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
sl@0
    10
 * Software division. Licensed under the Apache License, Version 2.0 (the
sl@0
    11
 * "License");  you may  not use this file except  in compliance with the
sl@0
    12
 * License.    You    may   obtain   a   copy   of    the   License    at
sl@0
    13
 * http://www.apache.org/licenses/LICENSE-2.0.    Unless   required    by
sl@0
    14
 * applicable law  or agreed to  in writing,  software  distributed under
sl@0
    15
 * the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR
sl@0
    16
 * CONDITIONS OF  ANY KIND, either  express or implied.  See  the License
sl@0
    17
 * for the specific language governing permissions  and limitations under
sl@0
    18
 * the License.
sl@0
    19
 * 
sl@0
    20
 **************************************************************************/
sl@0
    21
sl@0
    22
#ifndef RW_ANY_H_INCLUDED
sl@0
    23
#define RW_ANY_H_INCLUDED
sl@0
    24
sl@0
    25
sl@0
    26
#include <testdefs.h>
sl@0
    27
#ifdef __SYMBIAN32__
sl@0
    28
#include<wchar.h>
sl@0
    29
#endif //__SYMBIAN32__
sl@0
    30
sl@0
    31
class rw_any_t
sl@0
    32
{
sl@0
    33
public:
sl@0
    34
sl@0
    35
#ifndef _RWSTD_NO_BOOL
sl@0
    36
    _TEST_EXPORT rw_any_t (bool);
sl@0
    37
#endif   // _RWSTD_NO_BOOL
sl@0
    38
sl@0
    39
    _TEST_EXPORT rw_any_t (char);
sl@0
    40
    _TEST_EXPORT rw_any_t (signed char);
sl@0
    41
    _TEST_EXPORT rw_any_t (unsigned char);
sl@0
    42
sl@0
    43
    _TEST_EXPORT rw_any_t (signed short);
sl@0
    44
    _TEST_EXPORT rw_any_t (unsigned short);
sl@0
    45
sl@0
    46
    _TEST_EXPORT rw_any_t (signed int);
sl@0
    47
    _TEST_EXPORT rw_any_t (unsigned int);
sl@0
    48
sl@0
    49
    _TEST_EXPORT rw_any_t (signed long);
sl@0
    50
    _TEST_EXPORT rw_any_t (unsigned long);
sl@0
    51
sl@0
    52
#ifdef _RWSTD_LONG_LONG
sl@0
    53
    _TEST_EXPORT rw_any_t (signed _RWSTD_LONG_LONG);
sl@0
    54
    _TEST_EXPORT rw_any_t (unsigned _RWSTD_LONG_LONG);
sl@0
    55
#endif   // _RWSTD_LONG_LONG
sl@0
    56
sl@0
    57
    _TEST_EXPORT rw_any_t (float);
sl@0
    58
    _TEST_EXPORT rw_any_t (double);
sl@0
    59
sl@0
    60
#ifndef _RWSTD_NO_LONG_DOUBLE
sl@0
    61
    _TEST_EXPORT rw_any_t (long double);
sl@0
    62
#endif   // _RWSTD_NO_LONG_DOUBLE
sl@0
    63
sl@0
    64
    _TEST_EXPORT rw_any_t (const void*);
sl@0
    65
    _TEST_EXPORT  rw_any_t (const char*);
sl@0
    66
sl@0
    67
#ifndef _RWSTD_NO_NATIVE_WCHAR_T
sl@0
    68
    _TEST_EXPORT rw_any_t (wchar_t);
sl@0
    69
#endif   // _RWSTD_NO_NATIVE_WCHAR_T
sl@0
    70
sl@0
    71
#ifndef _RWSTD_NO_WCHAR_T
sl@0
    72
    _TEST_EXPORT rw_any_t (const wchar_t*);
sl@0
    73
#endif   // _RWSTD_NO_WCHAR_T
sl@0
    74
sl@0
    75
    _TEST_EXPORT rw_any_t (const rw_any_t&);
sl@0
    76
sl@0
    77
    _TEST_EXPORT ~rw_any_t ();
sl@0
    78
sl@0
    79
    _TEST_EXPORT rw_any_t& operator= (const rw_any_t&);
sl@0
    80
sl@0
    81
    _TEST_EXPORT const char* tostr (const char* = 0);
sl@0
    82
    _TEST_EXPORT const char* type_name () const;
sl@0
    83
sl@0
    84
    enum type_id_t {
sl@0
    85
        t_none,
sl@0
    86
        t_bool, t_schar, t_uchar, t_char,
sl@0
    87
        t_sshrt, t_ushrt, t_sint, t_uint, t_slong, t_ulong,
sl@0
    88
        t_sllong, t_ullong,
sl@0
    89
        t_flt, t_dbl, t_ldbl,
sl@0
    90
        t_wchar,
sl@0
    91
        t_pvoid,
sl@0
    92
        t_str,
sl@0
    93
        t_wstr
sl@0
    94
    };
sl@0
    95
sl@0
    96
private:
sl@0
    97
sl@0
    98
    union uval_t {
sl@0
    99
sl@0
   100
#ifndef _RWSTD_NO_LONG_DOUBLE
sl@0
   101
        long double ldbl_;
sl@0
   102
#endif   // _RWSTD_NO_LONG_DOUBLE
sl@0
   103
        const void *pvoid_;
sl@0
   104
        double      dbl_;
sl@0
   105
#ifdef _RWSTD_LONG_LONG
sl@0
   106
        signed _RWSTD_LONG_LONG   sllong_;
sl@0
   107
        unsigned _RWSTD_LONG_LONG ullong_;
sl@0
   108
#endif   // _RWSTD_LONG_LONG
sl@0
   109
        float          flt_;
sl@0
   110
#ifndef _RWSTD_NO_NATIVE_WCHAR_T
sl@0
   111
        wchar_t        wchar_;
sl@0
   112
#endif   // _RWSTD_NO_NATIVE_WCHAR_T
sl@0
   113
        signed long    slong_;
sl@0
   114
        unsigned long  ulong_;
sl@0
   115
        signed int     sint_;
sl@0
   116
        unsigned int   uint_;
sl@0
   117
        signed short   sshrt_;
sl@0
   118
        unsigned short ushrt_;
sl@0
   119
        signed char    schar_;
sl@0
   120
        unsigned char  uchar_;
sl@0
   121
        char           char_;
sl@0
   122
#ifndef _RWSTD_NO_BOOL
sl@0
   123
        bool           bool_;
sl@0
   124
#endif   // _RWSTD_NO_BOOL
sl@0
   125
    } val_;
sl@0
   126
sl@0
   127
    char      *str_;
sl@0
   128
    type_id_t  tid_;
sl@0
   129
};
sl@0
   130
sl@0
   131
sl@0
   132
#define TOSTR(x)   rw_any_t (x).tostr ()
sl@0
   133
sl@0
   134
sl@0
   135
#endif   // RW_ANY_H_INCLUDED