diff options
| author | MenTaLguY <mental@rydia.net> | 2006-01-16 02:36:01 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2006-01-16 02:36:01 +0000 |
| commit | 179fa413b047bede6e32109e2ce82437c5fb8d34 (patch) | |
| tree | a5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/traits | |
| download | inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip | |
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/traits')
| -rw-r--r-- | src/traits/.cvsignore | 2 | ||||
| -rw-r--r-- | src/traits/Makefile_insert | 5 | ||||
| -rw-r--r-- | src/traits/copy.h | 48 | ||||
| -rw-r--r-- | src/traits/function.h | 122 | ||||
| -rw-r--r-- | src/traits/list-copy.h | 45 | ||||
| -rw-r--r-- | src/traits/makefile.in | 17 | ||||
| -rw-r--r-- | src/traits/reference.h | 49 |
7 files changed, 288 insertions, 0 deletions
diff --git a/src/traits/.cvsignore b/src/traits/.cvsignore new file mode 100644 index 000000000..b4fcd8525 --- /dev/null +++ b/src/traits/.cvsignore @@ -0,0 +1,2 @@ +makefile + diff --git a/src/traits/Makefile_insert b/src/traits/Makefile_insert new file mode 100644 index 000000000..4290ac2dd --- /dev/null +++ b/src/traits/Makefile_insert @@ -0,0 +1,5 @@ + +traits/all: + +traits/clean: + diff --git a/src/traits/copy.h b/src/traits/copy.h new file mode 100644 index 000000000..27038ff2d --- /dev/null +++ b/src/traits/copy.h @@ -0,0 +1,48 @@ +/* + * Inkscape::Traits::Copy - traits class to determine types to use when copying + * + * Authors: + * MenTaLguY <mental@rydia.net> + * + * Copyright (C) 2004 MenTaLguY + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_TRAITS_COPY_H +#define SEEN_INKSCAPE_TRAITS_COPY_H + +namespace Inkscape { + +namespace Traits { + +template <typename T> +struct Copy { + typedef T Type; +}; + +template <typename T> +struct Copy<T const> { + typedef T Type; +}; + +template <typename T> +struct Copy<T &> { + typedef T &Type; +}; + +} + +} + +#endif +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/traits/function.h b/src/traits/function.h new file mode 100644 index 000000000..d0dd5d87c --- /dev/null +++ b/src/traits/function.h @@ -0,0 +1,122 @@ +/* + * Inkscape::Traits::Function - traits class for C++ "functors" + * + * Authors: + * MenTaLguY <mental@rydia.net> + * + * Copyright (C) 2004 MenTaLguY + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_TRAITS_FUNCTION_H +#define SEEN_INKSCAPE_TRAITS_FUNCTION_H + +namespace Inkscape { + +namespace Traits { + +template <typename F> struct Function; + +template <typename R> +struct Function<R (*)()> { + typedef R Result; + + typedef void Arg0; + typedef void Arg1; + typedef void Arg2; + typedef void Arg3; + typedef void Arg4; + typedef void Arg5; +}; + +template <typename R, typename A0> +struct Function<R (*)(A0)> { + typedef R Result; + + typedef A0 Arg0; + typedef void Arg1; + typedef void Arg2; + typedef void Arg3; + typedef void Arg4; + typedef void Arg5; +}; + +template <typename R, typename A0, typename A1> +struct Function<R (*)(A0, A1)> { + typedef R Result; + + typedef A0 Arg0; + typedef A1 Arg1; + typedef void Arg2; + typedef void Arg3; + typedef void Arg4; + typedef void Arg5; +}; + +template <typename R, typename A0, typename A1, typename A2> +struct Function<R (*)(A0, A1, A2)> { + typedef R Result; + + typedef A0 Arg0; + typedef A1 Arg1; + typedef A2 Arg2; + typedef void Arg3; + typedef void Arg4; + typedef void Arg5; +}; + +template <typename R, typename A0, typename A1, typename A2, + typename A3> +struct Function<R (*)(A0, A1, A2, A3)> { + typedef R Result; + + typedef A0 Arg0; + typedef A1 Arg1; + typedef A2 Arg2; + typedef A3 Arg3; + typedef void Arg4; + typedef void Arg5; +}; + +template <typename R, typename A0, typename A1, typename A2, + typename A3, typename A4> +struct Function<R (*)(A0, A1, A2, A3, A4)> { + typedef R Result; + + typedef A0 Arg0; + typedef A1 Arg1; + typedef A2 Arg2; + typedef A3 Arg3; + typedef A4 Arg4; + typedef void Arg5; +}; + +template <typename R, typename A0, typename A1, typename A2, + typename A3, typename A4, typename A5> +struct Function<R (*)(A0, A1, A2, A3, A4, A5)> { + typedef R Result; + + typedef A0 Arg0; + typedef A1 Arg1; + typedef A2 Arg2; + typedef A3 Arg3; + typedef A4 Arg4; + typedef A5 Arg5; +}; + +} + +} + +#endif +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/traits/list-copy.h b/src/traits/list-copy.h new file mode 100644 index 000000000..9d99c4f29 --- /dev/null +++ b/src/traits/list-copy.h @@ -0,0 +1,45 @@ +/* + * Inkscape::Traits::ListCopy - helper traits class for copying lists + * + * Authors: + * MenTaLguY <mental@rydia.net> + * + * Copyright (C) 2004 MenTaLguY + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_TRAITS_LIST_COPY_H +#define SEEN_INKSCAPE_TRAITS_LIST_COPY_H + +#include <iterator> +#include "traits/copy.h" +#include "util/list.h" + +namespace Inkscape { + +namespace Traits { + +template <typename InputIterator> +struct ListCopy { + typedef typename Copy< + typename std::iterator_traits<InputIterator>::value_type + >::Type ResultValue; + typedef typename Util::MutableList<ResultValue> ResultList; +}; + +} + +} + +#endif +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/traits/makefile.in b/src/traits/makefile.in new file mode 100644 index 000000000..0c3b55dc2 --- /dev/null +++ b/src/traits/makefile.in @@ -0,0 +1,17 @@ +# Convenience stub makefile to call the real Makefile. + +@SET_MAKE@ + +# Explicit so that it's the default rule. +all: + cd .. && $(MAKE) traits/all + +clean %.a %.o: + cd .. && $(MAKE) traits/$@ + +.PHONY: all clean + +OBJEXT = @OBJEXT@ + +.SUFFIXES: +.SUFFIXES: .a .$(OBJEXT) diff --git a/src/traits/reference.h b/src/traits/reference.h new file mode 100644 index 000000000..199ae8929 --- /dev/null +++ b/src/traits/reference.h @@ -0,0 +1,49 @@ +/* + * Inkscape::Traits::Reference - traits class for dealing with reference types + * + * Authors: + * MenTaLguY <mental@rydia.net> + * + * Copyright (C) 2004 MenTaLguY + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_TRAITS_REFERENCE_H +#define SEEN_INKSCAPE_TRAITS_REFERENCE_H + +namespace Inkscape { + +namespace Traits { + +template <typename T> +struct Reference { + typedef T const &RValue; + typedef T &LValue; + typedef T *Pointer; + typedef T const *ConstPointer; +}; + +template <typename T> +struct Reference<T &> { + typedef T &RValue; + typedef T &LValue; + typedef T *Pointer; + typedef T const *ConstPointer; +}; + +} + +} + +#endif +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
