stlab.adobe.com Adobe Systems Incorporated

type_inspection.hpp File Reference

Go to the source code of this file.

Classes

struct  has_type_type< T >
 is T::type a valid type (or a compile error?) More...
struct  type_or_default< T, Default >::if_has_type< condition, IFtype, ELSEtype >
struct  type_or_default< T, Default >::if_has_type< false, IFtype, ELSEtype >
struct  no_struct
struct  type_or_default< T, Default >
struct  yes_struct

Namespaces

namespace  adobe
namespace  adobe::detail

Defines

#define ADOBE_HAS_MEMBER(C, MemberInQuestion)
#define ADOBE_HAS_MEMBER_IMPL(Member)
#define ADOBE_HAS_TEMPLATE1(C, TemplateInQuestion)
#define ADOBE_HAS_TEMPLATE1_IMPL(TemplateInQuestion)
#define ADOBE_HAS_TEMPLATE2(C, TemplateInQuestion)
#define ADOBE_HAS_TEMPLATE2_IMPL(TemplateInQuestion)
#define ADOBE_HAS_TEMPLATE3(C, TemplateInQuestion)
#define ADOBE_HAS_TEMPLATE3_IMPL(TemplateInQuestion)
#define ADOBE_HAS_TYPE(C, TypeInQuestion)
#define ADOBE_HAS_TYPE_IMPL(TypeInQuestion)

Define Documentation

#define ADOBE_HAS_MEMBER (   C,
  MemberInQuestion 
)

returns true iff C has an internal member named 'MemberInQuestion'.

Unfortunately C++ doesn't have full inspection (yet) so we need to use macros to implement ADOBE_HAS_MEMBER. In order to use this macro, you also need to declare its implementation (for each MemberInQuestion) using ADOBE_HAS_MEMBER_IMPL. eg:
    ADOBE_HAS_MEMBER_IMPL(first);  // defines a template, thus must be outside of any function, may be in a class

    assert(ADOBE_HAS_MEMBER(std::pair<char, int>, first));
    assert(!ADOBE_HAS_MEMBER(int, first));
Also, make sure the 2 macros are in the same namespace!

Definition at line 168 of file type_inspection.hpp.

#define ADOBE_HAS_MEMBER_IMPL (   Member )

Implementation part of ADOBE_HAS_MEMBER macro. Required before using ADOBE_HAS_MEMBER.

Unfortunately C++ doesn't have full inspection (yet) so we need to use 2 macros to implement ADOBE_HAS_MEMBER. This macro sets up the implementation for the other. You need to use this macro for each member that you want to inspect for. Internally it defines a template class, thus it must be used only at global, namespace, or class scope. See ADOBE_HAS_MEMBER Visual Studio 8.0 and lower can't handle the template version not sure about 9.0 (yet)

Definition at line 117 of file type_inspection.hpp.

#define ADOBE_HAS_TEMPLATE1 (   C,
  TemplateInQuestion 
)

returns true iff C has an internal template named 'TemplateInQuestion' with 1 (nondefault) template param. ie returns true iff "C::template TemplateInQuestion<someType>" is a syntactically correct.

Unfortunately C++ doesn't have full inspection (yet) so we need to use macros to implement ADOBE_HAS_TEMPLATE1. In order to use this macro, you also need to declare its implementation (for each TemplateInQuestion) using ADOBE_HAS_TEMPLATE1_IMPL. eg:
    ADOBE_HAS_TEMPLATE_IMPL(value_type);

    assert(ADOBE_HAS_TEMPLATE1(std::string<char>, value_type));
    assert(!ADOBE_HAS_TEMPLATE1(int, value_type));
Note, this only works for templates over types, not templates over constant values. ie template mytemplate<typename T> { ... } not template mytemplate<bool test> { ... } we could make even more macros for the constant value case(s), and all the permutations... if need be Also, make sure the 2 macros are in the same namespace!

Definition at line 217 of file type_inspection.hpp.

#define ADOBE_HAS_TEMPLATE1_IMPL (   TemplateInQuestion )

Implementation part of ADOBE_HAS_TEMPLATE1 macro. Required before using ADOBE_HAS_TEMPLATE1.

Unfortunately C++ doesn't have full inspection (yet) so we need to use 2 macros to implement ADOBE_HAS_TEMPLATE1. This macro sets up the implementation for the other. You need to use this macro for each internal template that you want to inspect for. Internally it defines a template class, thus it must be used only at global, namespace, or class scope. See ADOBE_HAS_TEMPLATE1.

Definition at line 184 of file type_inspection.hpp.

#define ADOBE_HAS_TEMPLATE2 (   C,
  TemplateInQuestion 
)

Definition at line 236 of file type_inspection.hpp.

#define ADOBE_HAS_TEMPLATE2_IMPL (   TemplateInQuestion )

Definition at line 224 of file type_inspection.hpp.

#define ADOBE_HAS_TEMPLATE3 (   C,
  TemplateInQuestion 
)

Definition at line 251 of file type_inspection.hpp.

#define ADOBE_HAS_TEMPLATE3_IMPL (   TemplateInQuestion )

Definition at line 239 of file type_inspection.hpp.

#define ADOBE_HAS_TYPE (   C,
  TypeInQuestion 
)

returns true iff C has an internal type named 'TypeInQuestion'. ie returns true iff C::TypeInQuestion is a type.

Unfortunately C++ doesn't have full inspection (yet) so we need to use macros to implement ADOBE_HAS_TYPE. In order to use this macro, you also need to declare its implementation (for each TypeInQuestion) using ADOBE_HAS_TYPE_IMPL. eg:
    ADOBE_HAS_TYPE_IMPL(value_type);

    assert(ADOBE_HAS_TYPE(std::string<char>, value_type));
    assert(!ADOBE_HAS_TYPE(int, value_type));
Also, make sure the 2 macros are in the same namespace!

Definition at line 65 of file type_inspection.hpp.

#define ADOBE_HAS_TYPE_IMPL (   TypeInQuestion )

Implementation part of ADOBE_HAS_TYPE macro. Required before using ADOBE_HAS_TYPE.

Unfortunately C++ doesn't have full inspection (yet) so we need to use 2 macros to implement ADOBE_HAS_TYPE. This macro sets up the implementation for the other. You need to use this macro for each type/typedef that you want to inspect for. Internally it defines a template class, thus it must be used only at global, namespace, or class scope. See ADOBE_HAS_TYPE.

Definition at line 37 of file type_inspection.hpp.

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google