Author: sebor
Date: Thu Feb 2 17:28:19 2006
New Revision: 374555
URL: http://svn.apache.org/viewcvs?rev=374555&view=rev
Log:
2006-02-02 Martin Sebor <[EMAIL PROTECTED]>
* any.h: Added declarations for const and volatile overloads
of ctors taking a pointer argument.
* any.cpp: Added definitions of the same.
Modified:
incubator/stdcxx/trunk/tests/include/any.h
incubator/stdcxx/trunk/tests/src/any.cpp
Modified: incubator/stdcxx/trunk/tests/include/any.h
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/any.h?rev=374555&r1=374554&r2=374555&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/any.h (original)
+++ incubator/stdcxx/trunk/tests/include/any.h Thu Feb 2 17:28:19 2006
@@ -1,21 +1,28 @@
+// -*- C++ -*-
/***************************************************************************
*
- * any.h - definition of the rw_any_t class
+ * any.h - definition of utility class rw_any_t
*
* $Id$
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Copyright 2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
**************************************************************************/
@@ -59,15 +66,25 @@
rw_any_t (long double);
#endif // _RWSTD_NO_LONG_DOUBLE
+ rw_any_t (void*);
+ rw_any_t (volatile void*);
rw_any_t (const void*);
+ rw_any_t (const volatile void*);
+
+ rw_any_t (char*);
rw_any_t (const char*);
+ rw_any_t (volatile char*);
+ rw_any_t (const volatile char*);
#ifndef _RWSTD_NO_NATIVE_WCHAR_T
rw_any_t (wchar_t);
#endif // _RWSTD_NO_NATIVE_WCHAR_T
#ifndef _RWSTD_NO_WCHAR_T
+ rw_any_t (wchar_t*);
rw_any_t (const wchar_t*);
+ rw_any_t (volatile wchar_t*);
+ rw_any_t (const volatile wchar_t*);
#endif // _RWSTD_NO_WCHAR_T
rw_any_t (const rw_any_t&);
@@ -86,9 +103,9 @@
t_sllong, t_ullong,
t_flt, t_dbl, t_ldbl,
t_wchar,
- t_pvoid,
- t_str,
- t_wstr
+ t_pvoid, t_c_pvoid, t_v_pvoid, t_cv_pvoid,
+ t_str, t_c_str, t_v_str, t_cv_str,
+ t_wstr, t_c_wstr, t_v_wstr, t_cv_wstr
};
private:
@@ -98,7 +115,7 @@
#ifndef _RWSTD_NO_LONG_DOUBLE
long double ldbl_;
#endif // _RWSTD_NO_LONG_DOUBLE
- const void *pvoid_;
+ const volatile void *pvoid_;
double dbl_;
#ifdef _RWSTD_LONG_LONG
signed _RWSTD_LONG_LONG sllong_;
Modified: incubator/stdcxx/trunk/tests/src/any.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/any.cpp?rev=374555&r1=374554&r2=374555&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/any.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/any.cpp Thu Feb 2 17:28:19 2006
@@ -1,6 +1,6 @@
/************************************************************************
*
- * any.cpp - definitions of the rw_any_t class members
+ * any.cpp - definitions of class any members
*
* $Id$
*
@@ -16,7 +16,7 @@
* CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under
* the License.
- *
+ *
**************************************************************************/
// expand _TEST_EXPORT macros
@@ -24,9 +24,9 @@
#include <any.h>
-#include <printf.h> // for rw_sprintfa()
-#include <stdlib.h> // for free()
-#include <string.h> // for memset()
+#include <printf.h> // for rw_sprintfa()
+#include <stdlib.h> // for free()
+#include <string.h> // for memset()
#ifndef _RWSTD_NO_BOOL
@@ -166,21 +166,62 @@
#endif // _RWSTD_NO_LONG_DOUBLE
-rw_any_t::rw_any_t (const void* value)
+rw_any_t::rw_any_t (void* value)
: str_ (0), tid_ (t_pvoid)
{
memset (&val_, 0, sizeof val_);
val_.pvoid_ = value;
}
+rw_any_t::rw_any_t (const void* value)
+ : str_ (0), tid_ (t_c_pvoid)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
-rw_any_t::rw_any_t (const char* value)
+rw_any_t::rw_any_t (volatile void* value)
+ : str_ (0), tid_ (t_v_pvoid)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
+rw_any_t::rw_any_t (const volatile void* value)
+ : str_ (0), tid_ (t_cv_pvoid)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
+
+rw_any_t::rw_any_t (char* value)
: str_ (0), tid_ (t_str)
{
memset (&val_, 0, sizeof val_);
val_.pvoid_ = value;
}
+rw_any_t::rw_any_t (const char* value)
+ : str_ (0), tid_ (t_c_str)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
+rw_any_t::rw_any_t (volatile char* value)
+ : str_ (0), tid_ (t_v_str)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
+rw_any_t::rw_any_t (const volatile char* value)
+ : str_ (0), tid_ (t_cv_str)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
#ifndef _RWSTD_NO_NATIVE_WCHAR_T
@@ -196,13 +237,34 @@
#ifndef _RWSTD_NO_WCHAR_T
-rw_any_t::rw_any_t (const wchar_t* value)
+rw_any_t::rw_any_t (wchar_t* value)
: str_ (0), tid_ (t_wstr)
{
memset (&val_, 0, sizeof val_);
val_.pvoid_ = value;
}
+rw_any_t::rw_any_t (const wchar_t* value)
+ : str_ (0), tid_ (t_c_wstr)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
+rw_any_t::rw_any_t (volatile wchar_t* value)
+ : str_ (0), tid_ (t_v_wstr)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
+rw_any_t::rw_any_t (const volatile wchar_t* value)
+ : str_ (0), tid_ (t_cv_wstr)
+{
+ memset (&val_, 0, sizeof val_);
+ val_.pvoid_ = value;
+}
+
#endif // _RWSTD_NO_WCHAR_T
@@ -247,8 +309,11 @@
"long", "unsigned long",
"long long", "unsigned long long",
"float", "double", "long double",
- "wchar_t", "void*",
- "const char*", "const wchar_t*"
+ "wchar_t",
+ "void*", "const void*", "volatile void*", "const volatile void*",
+ "char*", "const char*", "volatile char*", "const volatile char*",
+ "wchar_t*", "const wchar_t*", "volatile wchar_t*",
+ "const volatile wchar_t*"
};
// the liftime of the returned string must extend
@@ -364,6 +429,9 @@
#endif // _RWSTD_NO_LONG_DOUBLE
case t_pvoid:
+ case t_c_pvoid:
+ case t_v_pvoid:
+ case t_cv_pvoid:
if (0 == fmt)
fmt = "%p";
str_ = rw_sprintfa (fmt, val_.pvoid_);
@@ -380,6 +448,9 @@
#endif // _RWSTD_NO_NATIVE_WCHAR_T
case t_str:
+ case t_c_str:
+ case t_v_str:
+ case t_cv_str:
if (0 == fmt)
fmt = "%s";
str_ = rw_sprintfa (fmt, val_.pvoid_);
@@ -388,6 +459,9 @@
#ifndef _RWSTD_NO_WCHAR_T
case t_wstr:
+ case t_c_wstr:
+ case t_v_wstr:
+ case t_cv_wstr:
if (0 == fmt)
fmt = "%ls";
str_ = rw_sprintfa (fmt, val_.pvoid_);