Thread: [complement-svn] SF.net SVN: complement: [1795] trunk/complement/explore/include/misc
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-11-30 15:28:28
|
Revision: 1795 http://complement.svn.sourceforge.net/complement/?rev=1795&view=rev Author: complement Date: 2007-11-30 07:28:18 -0800 (Fri, 30 Nov 2007) Log Message: ----------- obsolete and incomplete implementation, replaced by boost Modified Paths: -------------- trunk/complement/explore/include/misc/type_traits.h Removed Paths: ------------- trunk/complement/explore/include/misc/dir_utils.h trunk/complement/explore/include/misc/directory.h trunk/complement/explore/include/misc/regexp.h Deleted: trunk/complement/explore/include/misc/dir_utils.h =================================================================== --- trunk/complement/explore/include/misc/dir_utils.h 2007-11-23 12:29:50 UTC (rev 1794) +++ trunk/complement/explore/include/misc/dir_utils.h 2007-11-30 15:28:18 UTC (rev 1795) @@ -1,43 +0,0 @@ -// -*- C++ -*- Time-stamp: <01/03/19 16:32:47 ptr> - -/* - * - * Copyright (c) 1997 - * Petr Ovchenkov - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. - */ - -#ifndef __dir_utils_h - -#ifdef __unix -# ifdef __HP_aCC -#pragma VERSIONID "$SunId$" -# else -#pragma ident "$SunId$" -# endif -#endif - -#ifndef __config_feature_h -#include <config/feature.h> -#endif - -#include <string> - -#ifndef _UNISTD_H -#include <unistd.h> -#endif - -std::string mkunique_dir( const std::string& base, const std::string& prefix ); - -inline void rm_dir( const std::string& d ) { ::rmdir( d.c_str() ); } -void rm_dir_all( const std::string& d ); - -#endif // __dir_utils_h Deleted: trunk/complement/explore/include/misc/directory.h =================================================================== --- trunk/complement/explore/include/misc/directory.h 2007-11-23 12:29:50 UTC (rev 1794) +++ trunk/complement/explore/include/misc/directory.h 2007-11-30 15:28:18 UTC (rev 1795) @@ -1,77 +0,0 @@ -// <!!-*-C++-*- file: directory.h ---> -// <!!--------------------------------------------------------------------------> -// <!! Copyright (C) 1997 Dietmar Kuehl > -// <!! Universitaet Konstanz, Germany, Lehrstuhl fuer praktische Informatik I > -// <!!> -// <!! Permission to use, copy, modify, distribute and sell this > -// <!! software for any purpose is hereby granted without fee, provided > -// <!! that the above copyright notice appears in all copies and that > -// <!! both that copyright notice and this permission notice appear in > -// <!! supporting documentation. The Universitaet Konstanz and the > -// <!! Lehrstuhl fuer praktische Informatik I make no representations > -// <!! about the suitability of this software for any purpose. It is > -// <!! provided "as is" without express or implied warranty. > -// <!!--------------------------------------------------------------------------> - -// Author: Dietmar K\xFChl die...@un... www.informatik.uni-konstanz.de/~kuehl -// Title: Declaration for an iterator traversing the entries of a directory - -//------------------------------------------------------------------------------ - -#if !defined(DIRECTORY_H) -#define DIRECTORY_H - -#ifndef __config_feature_h -#include <config/feature.h> -#endif - -#include <string> -#include <iterator> - -// #ifdef __STL_USE_NAMESPACES -using namespace std; -// #endif - -// ----------------------------------------------------------------------------- -// The basic building block: An input iterator used to iterate over -// the entries of a directory. This iterator only provides access to -// the names of the entries which are returned from code(operator*)() -// as code(string)s. - -class dir_it_rep; - -class dir_it : -//#ifndef __STL_USE_NAMESPACES -// public input_iterator<string, int> -//#else - public iterator<input_iterator_tag,string,int,string*,string&> -//#endif -{ - public: - // -------------------------------------------------------------------- - // default ctor: creates an iterator suitable as past the end indicator - dir_it() : - i_rep(0) - { } - explicit dir_it( const string &); - dir_it(const dir_it& it); - ~dir_it(); - - dir_it &operator= (const dir_it& it); - - string operator* () const { return i_value; } - - dir_it& operator++ (); - dir_it operator++ (int) { dir_it rc(*this); operator++(); return rc; } - - bool operator== (const dir_it& it) const; - bool operator!= (const dir_it& it) const { return !operator== (it); } - - private: - dir_it_rep *i_rep; // representation for the next value - string i_value; // the current value -}; - -//-------------------------------------------------------------------------- - -#endif /* DIRECTORY_H */ Deleted: trunk/complement/explore/include/misc/regexp.h =================================================================== --- trunk/complement/explore/include/misc/regexp.h 2007-11-23 12:29:50 UTC (rev 1794) +++ trunk/complement/explore/include/misc/regexp.h 2007-11-30 15:28:18 UTC (rev 1795) @@ -1,176 +0,0 @@ -// -*- C++ -*- Time-stamp: <00/10/03 15:00:06 ptr> - -/* - * - * Copyright (c) 2000 - * Petr Ovchenkov - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. - */ - -#ifndef __regexp_h -#define __regexp_h - -#ifdef __unix -# ifdef __HP_aCC -#pragma VERSIONID "$SunId$" -# else -#pragma ident "$SunId$" -# endif -#endif - -#ifndef __config_feature_h -#include <config/feature.h> -#endif - -#include <string> -#include <stdexcept> -#include <sys/types.h> -#include <regex.h> - -class RegExp -{ - private: - regex_t preg; - regmatch_t *pmatch; - bool _status; - - public: - enum cflags { - basic = 0, - extended = REG_EXTENDED, - icase = REG_ICASE, - nosub = REG_NOSUB, - newline = REG_NEWLINE - }; - - enum eflags { - beol = 0, - nbol = REG_NOTBOL, // begin of line forbidden(^ sign) - neol = REG_NOTEOL // end of line forbidden ($ sign) - }; - - typedef std::string::size_type size_type; - typedef std::pair<size_type,size_type> match_range_type; - - RegExp() : - pmatch( 0 ), - _status( false ) - { } - - RegExp( const char *pattern, cflags f = basic ) : - _status( false ) - { regexp( pattern, f ); } - - RegExp( const std::string& pattern, cflags f = basic ) : - _status( false ) - { regexp( pattern.c_str(), f ); } - - ~RegExp() - { RegExp::clear(); } - - void regexp( const char *pattern, cflags f = basic ) - { - RegExp::clear(); - int err = regcomp( &preg, pattern, (int)f ); - if ( err ) { - size_t n = regerror( err, &preg, 0, 0 ); - std::string err_str; - err_str.resize( n ); - regerror( err, &preg, (char *)err_str.c_str(), n ); - throw std::runtime_error( err_str ); - } - pmatch = (f & nosub) ? 0 : new regmatch_t[preg.re_nsub + 1]; - _status = true; - } - - void regexp( const std::string& pattern, cflags f = basic ) - { RegExp::regexp( pattern.c_str(), f ); } - - void clear() - { - if ( _status ) { - regfree( &preg ); - if ( pmatch ) { - delete [] pmatch; - pmatch = 0; - } - _status = false; - } - } - - bool find( const char *str, eflags f = beol ) - { - if ( !_status ) { // no regular expression - return false; // REG_NOMATCH; - } - int err; - if ( pmatch ) { - for ( size_t i = 0; i <= preg.re_nsub; ++i ) { - pmatch[i].rm_so = -1; - pmatch[i].rm_eo = -1; - } - err = regexec( &preg, str, preg.re_nsub + 1, pmatch, (int)f ); - } else { // nosub in force - err = regexec( &preg, str, 0, 0, (int)f ); - } - - return err == 0; - } - - bool find( const char *str, size_type b, eflags f = beol ) - { - if ( !_status ) { // no regular expression - return false; // REG_NOMATCH; - } - int err; - if ( pmatch ) { - for ( size_t i = 0; i <= preg.re_nsub; ++i ) { - pmatch[i].rm_so = -1; - pmatch[i].rm_eo = -1; - } - err = regexec( &preg, str + b, preg.re_nsub + 1, pmatch, (int)f ); - for ( size_t i = 0; i <= preg.re_nsub; ++i ) { - if ( pmatch[i].rm_so != -1 ) { - pmatch[i].rm_so += b; - } - if ( pmatch[i].rm_eo = -1 ) { - pmatch[i].rm_eo += b; - } - } - } else { // nosub in force - err = regexec( &preg, str + b, 0, 0, (int)f ); - } - - return err == 0; - } - - bool find( const std::string& str, eflags f = beol ) - { return RegExp::find( str.c_str(), f ); } - - bool find( const std::string& str, size_type b, eflags f = beol ) - { return RegExp::find( str.c_str(), b, f ); } - - match_range_type operator []( size_t i ) - { - if ( (pmatch == 0) || (i > preg.re_nsub) ) { - throw std::out_of_range( "RegExp" ); - } - regmatch_t& m = pmatch[i]; - return match_range_type( static_cast<size_type>(m.rm_so), - static_cast<size_type>(m.rm_eo) ); - } - -// private: -// regex_t preg; -// regmatch_t *pmatch; -}; - -#endif // __regexp_h Modified: trunk/complement/explore/include/misc/type_traits.h =================================================================== --- trunk/complement/explore/include/misc/type_traits.h 2007-11-23 12:29:50 UTC (rev 1794) +++ trunk/complement/explore/include/misc/type_traits.h 2007-11-30 15:28:18 UTC (rev 1795) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/08/21 10:42:14 ptr> +// -*- C++ -*- Time-stamp: <07/11/24 00:28:34 ptr> /* * Copyright (c) 2007 @@ -52,14 +52,14 @@ #ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION static const bool __value; #else - static const bool __value = sizeof(__test<_Tp>(0)) == 1; + static const bool __value = sizeof(__test<_Tp>(0)) == sizeof(__select_types::__t1); #endif }; #ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION template <class _Tp> -const bool __instance<_Tp>::__value = sizeof(__instance<_Tp>::__test<_Tp>(0)) == 1; +const bool __instance<_Tp>::__value = sizeof(__instance<_Tp>::__test<_Tp>(0)) == sizeof(__select_types::__t1); #endif template <class T> @@ -77,19 +77,50 @@ #ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION static const bool __value; #else - static const bool __value = sizeof(__test<T>(0)) == 1; + static const bool __value = sizeof(__test<T>(0)) == sizeof(__select_types::__t1); #endif }; #ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION template <class T> -const bool __uoc_aux<T>::__value = sizeof(__uoc_aux<T>::__test<T>(0)) == 1; +const bool __uoc_aux<T>::__value = sizeof(__uoc_aux<T>::__test<T>(0)) == sizeof(__select_types::__t1); #endif template <class T> class __empty { }; +template <class T, bool B> +class __inheritance_aux +{}; + +template <class T> +class __inheritance_aux<T,true> : + public T +{ + public: + virtual ~__inheritance_aux() + { } +}; + +#if 0 +template <class T, bool B> +struct __virtual_aux +{ + public: +#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION + static const bool __value; +#else + static const bool __value = B ? (sizeof(__inheritance_aux<T,B>) == sizeof(T)) : false; +#endif +}; + +#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION +template <class T, bool B> +const bool __virtual_aux<T,B>::__value = B ? (sizeof(__inheritance_aux<T,B>) == sizeof(T)) : false; +#endif +#endif + } // namespace detail template <class _Tp, _Tp __v> @@ -107,11 +138,23 @@ namespace detail { -template<typename _Tp> +template <typename _Tp> struct __is_union_or_class : public integral_constant<bool, __uoc_aux<_Tp>::__value> { }; +#if 0 +template<typename _Tp> +struct __is_vtbl : // has virtual table? + public integral_constant<bool, __virtual_aux<_Tp,__is_union_or_class<_Tp>::value >::__value> +{ }; +#endif + +template <typename _Tp> +struct __is_vtbl : // has virtual table? + public integral_constant<bool, __is_union_or_class<_Tp>::value ? (sizeof(__inheritance_aux<_Tp,__is_union_or_class<_Tp>::value>) == sizeof(_Tp)) : false > +{ }; + } // namespace detail #define __SPEC_(C,T,B) \ @@ -120,7 +163,7 @@ public integral_constant<bool, B> \ { } -#define __SPEC_FULL(C,T,B) \ +#define __CV_SPEC(C,T,B) \ __SPEC_(C,T,B); \ __SPEC_(C,const T,B); \ __SPEC_(C,volatile T,B); \ @@ -132,7 +175,7 @@ public integral_constant<bool, B> \ { } -#define __SPEC_FULL1(C,T,B) \ +#define __CV_SPEC_1(C,T,B) \ __SPEC_1(C,T,B); \ __SPEC_1(C,T const,B); \ __SPEC_1(C,T volatile,B); \ @@ -144,7 +187,7 @@ public integral_constant<bool, B> \ { } -#define __SPEC_FULL2(C,T,B) \ +#define __CV_SPEC_2(C,T,B) \ __SPEC_2(C,T,B); \ __SPEC_2(C,T const,B); \ __SPEC_2(C,T volatile,B); \ @@ -154,38 +197,41 @@ template <class _Tp> struct is_void : - public false_type + public false_type { }; -__SPEC_FULL(is_void,bool,true); +template <> +struct is_void<void> : + public true_type +{ }; template <class _Tp> struct is_integral : public false_type { }; -__SPEC_FULL(is_integral,bool,true); -__SPEC_FULL(is_integral,char,true); -__SPEC_FULL(is_integral,signed char,true); -__SPEC_FULL(is_integral,unsigned char,true); -__SPEC_FULL(is_integral,wchar_t,true); -__SPEC_FULL(is_integral,short,true); -__SPEC_FULL(is_integral,unsigned short,true); -__SPEC_FULL(is_integral,int,true); -__SPEC_FULL(is_integral,unsigned int,true); -__SPEC_FULL(is_integral,long,true); -__SPEC_FULL(is_integral,unsigned long,true); -__SPEC_FULL(is_integral,long long,true); -__SPEC_FULL(is_integral,unsigned long long,true); +__CV_SPEC(is_integral,bool,true); +__CV_SPEC(is_integral,char,true); +__CV_SPEC(is_integral,signed char,true); +__CV_SPEC(is_integral,unsigned char,true); +__CV_SPEC(is_integral,wchar_t,true); +__CV_SPEC(is_integral,short,true); +__CV_SPEC(is_integral,unsigned short,true); +__CV_SPEC(is_integral,int,true); +__CV_SPEC(is_integral,unsigned int,true); +__CV_SPEC(is_integral,long,true); +__CV_SPEC(is_integral,unsigned long,true); +__CV_SPEC(is_integral,long long,true); +__CV_SPEC(is_integral,unsigned long long,true); template <class _Tp> struct is_floating_point : public false_type { }; -__SPEC_FULL(is_floating_point,float,true); -__SPEC_FULL(is_floating_point,double,true); -__SPEC_FULL(is_floating_point,long double,true); +__CV_SPEC(is_floating_point,float,true); +__CV_SPEC(is_floating_point,double,true); +__CV_SPEC(is_floating_point,long double,true); template <class _Tp> struct is_array : @@ -207,7 +253,7 @@ public false_type { }; -__SPEC_FULL1(is_pointer,_Tp *,true); +__CV_SPEC_1(is_pointer,_Tp *,true); template <class _Tp> struct is_reference : @@ -411,6 +457,18 @@ // 4.5.3 type properties (continued): template <class _Tp> +struct is_trivial : + public integral_constant<bool, (is_void<_Tp>::value + || is_scalar<typename remove_all_extents<_Tp>::type>::value)> +{ }; + +template <class _Tp> +struct is_standard_layout : + public integral_constant<bool, (is_void<_Tp>::value + || is_scalar<typename remove_all_extents<_Tp>::type>::value)> +{ }; + +template <class _Tp> struct is_pod : public integral_constant<bool, (is_void<_Tp>::value || is_scalar<typename remove_all_extents<_Tp>::type>::value)> @@ -470,22 +528,22 @@ public false_type { }; -__SPEC_FULL(is_signed,signed char,true); -__SPEC_FULL(is_signed,short,true); -__SPEC_FULL(is_signed,int,true); -__SPEC_FULL(is_signed,long,true); -__SPEC_FULL(is_signed,long long,true); +__CV_SPEC(is_signed,signed char,true); +__CV_SPEC(is_signed,short,true); +__CV_SPEC(is_signed,int,true); +__CV_SPEC(is_signed,long,true); +__CV_SPEC(is_signed,long long,true); template <class _Tp> struct is_unsigned : public false_type { }; -__SPEC_FULL(is_unsigned,unsigned char,true); -__SPEC_FULL(is_unsigned,unsigned short,true); -__SPEC_FULL(is_unsigned,unsigned int,true); -__SPEC_FULL(is_unsigned,unsigned long,true); -__SPEC_FULL(is_unsigned,unsigned long long,true); +__CV_SPEC(is_unsigned,unsigned char,true); +__CV_SPEC(is_unsigned,unsigned short,true); +__CV_SPEC(is_unsigned,unsigned int,true); +__CV_SPEC(is_unsigned,unsigned long,true); +__CV_SPEC(is_unsigned,unsigned long long,true); // alignment_of // rank @@ -626,11 +684,11 @@ // aligned_storage -#undef __SPEC_FULL +#undef __CV_SPEC #undef __SPEC_ -#undef __SPEC_FULL1 +#undef __CV_SPEC_1 #undef __SPEC_1 -#undef __SPEC_FULL2 +#undef __CV_SPEC_2 #undef __SPEC_2 } // namespace tr1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |