Mirror reflection library - Puddle compile-time layer 0.5.13

puddle/doc/concepts.hpp

Go to the documentation of this file.
00001 
00010 #ifndef PUDDLE_DOC_CONCEPTS_1104071043_HPP
00011 #define PUDDLE_DOC_CONCEPTS_1104071043_HPP
00012 
00013 #include <puddle/config.hpp>
00014 
00015 // This section is here for documentation purposes only
00016 #ifdef MIRROR_DOCUMENTATION_ONLY
00017 
00025 PUDDLE_NAMESPACE_BEGIN
00026 
00027 struct Integer;
00028 struct Boolean;
00029 struct MetaObject;
00030 struct MetaNamedObject;
00031 struct MetaScopedObject;
00032 struct MetaNamedScopedObject;
00033 struct MetaScope;
00034 struct MetaNamespace;
00035 struct MetaType;
00036 struct MetaClass;
00037 struct MetaEnum;
00038 struct MetaVariable;
00039 struct MetaClassMember;
00040 struct MetaConstructor;
00041 struct MetaContainer;
00042 
00044 template <typename IntType>
00045 struct IntConst
00046 {
00048     IntType value(void) const;
00049 
00051 
00054     operator IntType (void) const;
00055 
00057     friend Boolean operator == (IntConst, IntConst);
00058 
00060     friend Boolean operator != (IntConst, IntConst);
00061 
00063     friend Boolean operator <= (IntConst, IntConst);
00064 
00066     friend Boolean operator >= (IntConst, IntConst);
00067 
00069     friend Boolean operator <  (IntConst, IntConst);
00070 
00072     friend Boolean operator >  (IntConst, IntConst);
00073 
00075     IntConst operator ! (void) const;
00076 
00078     friend IntConst operator + (IntConst, IntConst);
00079 
00081     friend IntConst operator - (IntConst, IntConst);
00082 
00084     friend IntConst operator * (IntConst, IntConst);
00085 
00087     friend IntConst operator / (IntConst, IntConst);
00088 
00090     friend IntConst operator & (IntConst, IntConst);
00091 
00093     friend IntConst operator | (IntConst, IntConst);
00094 
00096     friend IntConst operator && (IntConst, IntConst);
00097 
00099     friend IntConst operator || (IntConst, IntConst);
00100 };
00101 
00103 struct Integer : IntConst<int> { };
00104 
00106 struct Boolean : IntConst<bool> { };
00107 
00109 struct Character : IntConst<char> { };
00110 
00111 
00113 
00117 struct CompileTimeString
00118 {
00120     const char* c_str(void) const;
00121 
00123     friend Boolean operator == (CompileTimeString, CompileTimeString);
00124 
00126     friend Boolean operator != (CompileTimeString, CompileTimeString);
00127 
00129     friend CompileTimeString operator + (
00130         CompileTimeString,
00131         CompileTimeString
00132     );
00133 
00135     Boolean empty(void) const;
00136 
00138     Integer size(void) const;
00139 
00141     Character front(void) const;
00142 
00144     Character at(Integer index) const;
00145 
00147     template <int Index>
00148     Character at_c(void) const;
00149 
00151     Boolean starts_with(CompileTimeString str) const;
00152 
00154     Boolean ends_with(CompileTimeString str) const;
00155 
00157     Boolean contains(CompileTimeString str) const;
00158 
00160     CompileTimeString step_front(void) const;
00161 
00163     CompileTimeString skip_front(Integer n) const;
00164 
00166     template <int N>
00167     CompileTimeString skip_front_c(void) const;
00168 
00170     CompileTimeString head(Integer n) const;
00171 
00173     template <int N>
00174     CompileTimeString head_c(void) const;
00175 
00177     CompileTimeString tail(Integer n) const;
00178 
00180     template <int N>
00181     CompileTimeString tail_c(void) const;
00182 
00184     CompileTimeString find(CompileTimeString str) const;
00185 };
00186 
00188 
00191 template <typename Element>
00192 struct Range
00193 {
00195     Boolean empty(void) const;
00196 
00198     Integer size(void) const;
00199 
00201 
00203     Range step_front(void) const;
00204 
00206     Element front(void) const;
00207 
00209     Element at(Index) const;
00210 
00212     template <int Index>
00213     Element at_c(void) const;
00214 
00216     template <class UnaryPredicate>
00217     Range only_if(UnaryPredicate pred) const;
00218 
00220 
00228     template <class Functor>
00229     void for_each(Functor func) const;
00230 
00232 
00243     template <typename ResultType, class Functor, typename ValueType>
00244     ResultType accumulate(Functor func, ValueType init=ResultType()) const;
00245 };
00246 
00248 struct Tag
00249 {
00251     friend Boolean operator == (Specifier, Specifier);
00252 
00254     friend Boolean operator != (Specifier, Specifier);
00255 
00257     friend Boolean operator <= (Specifier, Specifier);
00258 
00260     friend Boolean operator >= (Specifier, Specifier);
00261 
00263     friend Boolean operator <  (Specifier, Specifier);
00264 
00266     friend Boolean operator >  (Specifier, Specifier);
00267 
00269     operator bool (void) const;
00270 
00272     bool operator ! (void) const;
00273 };
00274 
00276 struct Specifier : Tag
00277 {
00279     std::string keyword(void) const;
00280 };
00281 
00283 
00286 struct ContainerKind : Tag
00287 {
00288 };
00289 
00290 
00292 
00296 struct MetaInstance
00297 {
00299 
00302     MetaVariable variable(void) const;
00303 
00305 
00310     Range<MetaInstance> attributes(void) const;
00311 
00313     Type get(void) const;
00314 
00316     void set(Type value) const;
00317 
00319 
00323     meta_instance_tag category(void) const;
00324 
00326 
00336     template <typename Category>
00337     Boolean is_a(Category) const;
00338 };
00339 
00341 
00345 struct MetaPlainInstance
00346 {
00348     Type* address(void) const;
00349 
00354     meta_plain_instance_tag category(void) const;
00355 };
00356 
00358 
00363 struct MetaObject
00364 {
00366     friend Boolean operator == (MetaObject, MetaObject);
00367 
00369     friend Boolean operator != (MetaObject, MetaObject);
00370 
00372 
00376     mirror::meta_object_tag category(void) const;
00377 
00379 
00386     template <typename Category>
00387     Boolean is_a(Category) const;
00388 
00389 };
00390 
00392 
00403 struct MetaNamedObject
00404  : virtual public MetaObject
00405 {
00407 
00411     std::string base_name(void) const;
00412 
00414     CompileTimeString static_name(void) const;
00415 
00420     mirror::meta_named_object_tag category(void) const;
00421 };
00422 
00424 
00430 struct MetaMetaObject
00431  : virtual public MetaNamedObject
00432 {
00434 
00438     std::string construct_name(void) const;
00439 
00441 
00445     Range<MetaMetaObject> generalizations(void) const;
00446 
00451     mirror::meta_meta_object_tag category(void) const;
00452 };
00453 
00454 
00456 
00462 struct MetaScopedObject
00463  : virtual public MetaObject
00464 {
00466 
00471     MetaScope scope(void) const;
00472 
00477     mirror::meta_scoped_object_tag category(void) const;
00478 };
00479 
00481 
00487 struct MetaNamedScopedObject
00488  : virtual public MetaNamedObject
00489  , virtual public MetaScopedObject
00490 {
00492 
00496     std::string full_name(void) const;
00497 
00499 
00510     std::string local_name(void) const;
00511 
00516     mirror::meta_named_scoped_object_tag category(void) const;
00517 };
00518 
00520 
00526 struct MetaScope
00527  : virtual public MetaNamedScopedObject
00528 {
00530     Range<MetaNamedScopedObject> members(void) const;
00531 
00536     mirror::meta_scope_tag category(void) const;
00537 };
00538 
00540 
00547 struct MetaNamespace
00548  : virtual public MetaScope
00549 {
00551 
00556     Range<MetaNamespace> namespaces(void) const;
00557 
00559 
00564     Range<MetaFreeVariable> free_variables(void) const;
00565 
00567 
00572     unspecified free_variables_by_name(void) const;
00573 
00575 
00577     unspecified* operator -> (void) const;
00578 
00580 
00585     Range<MetaOverloadedFunctions> free_functions(void) const;
00586 
00591     mirror::meta_namespace_tag category(void) const;
00592 };
00593 
00595 
00601 struct MetaType
00602  : virtual public MetaNamedScopedObject
00603 {
00605 
00607     static unspecified original_type(void);
00608 
00610 
00615     Range<MetaConstructor> constructors(void) const;
00616 
00618 
00620     ContainerKind container_kind(void) const;
00621 
00623 
00626     Range<MetaContainer> containers(void) const;
00627 
00629     template <template <class> class UnaryTrait>
00630     unspecified apply(void) const;
00631 
00636     mirror::meta_type_tag category(void) const;
00637 };
00638 
00640 
00645 struct MetaTypedef
00646  : virtual public MetaType
00647 {
00649     MetaType type(void) const;
00650 
00655     mirror::meta_typedef_tag category(void) const;
00656 };
00657 
00659 
00665 struct MetaTemplatedType
00666  : virtual public MetaType
00667 {
00668     typedef MetaTypeTemplate type_template;
00669 
00671 
00677     MetaTemplatedType type_template(void) const;
00678 
00680 
00686     Range<MetaType> template_parameters(void) const;
00687 
00692     mirror::meta_templated_type_tag category(void) const;
00693 };
00694 
00696 
00702 struct MetaTypeTemplate
00703  : virtual public MetaNamedScopedObject
00704 {
00705 
00710     mirror::meta_type_template_tag category(void) const;
00711 };
00712 
00714 
00719 struct MetaClass
00720  : virtual public MetaType
00721  , virtual public MetaScope
00722 {
00724 
00728     Specifier elaborated_type(void) const;
00729 
00731 
00734     Range<MetaInheritance> base_classes(void) const;
00735 
00737 
00741     Range<MetaMemberVariable> member_variables(void) const;
00742 
00744 
00748     Range<MetaMemberVariable> all_member_variables(void) const;
00749 
00751 
00756     unspecified member_variables_by_name(void) const;
00757 
00759 
00761     unspecified* operator -> (void) const;
00762 
00764 
00768     Range<MetaContainer> all_containers(void) const;
00769 
00774     mirror::meta_class_tag category(void) const;
00775 };
00776 
00778 
00783 struct MetaClassMember
00784  : virtual public MetaNamedScopedObject
00785 {
00787     MetaClass scope(void) const;
00788 
00790 
00793     Specifier access_type(void) const;
00794 
00799     mirror::meta_class_member_tag category(void) const;
00800 };
00801 
00803 
00808 struct MetaTemplatedClass
00809  : virtual public MetaTemplatedType
00810  , virtual public MetaClass
00811 {
00812 
00817     mirror::meta_templated_class_tag category(void) const;
00818 };
00819 
00821 
00826 struct MetaEnum
00827  : virtual public MetaType
00828  , virtual public MetaScope
00829 {
00831     Integer size(void) const;
00832 
00834 
00837     Range<MetaEnumValue> enum_values(void) const;
00838 
00840     UnspecifiedEnumType value(Integer index) const;
00841 
00843     UnspecifiedEnumType value(int index) const;
00844 
00846     std::string value_name(Integer index) const;
00847 
00849     std::string value_name(int index) const;
00850 
00852     std::string name_by_value(Enum x) const;
00853 
00858     mirror::meta_enum_tag category(void) const;
00859 };
00860 
00862 
00867 struct MetaEnumValue
00868  : virtual public MetaNamedScopedObject
00869 {
00871     MetaEnum scope(void) const;
00872 
00874     Integer value(void) const;
00875 
00880     mirror::meta_enum_value_tag category(void) const;
00881 };
00882 
00884 
00889 struct MetaInheritance
00890  : virtual public MetaObject
00891 {
00893     MetaClass derived_class(void) const;
00894 
00896 
00899     Specifier inheritance_type(void) const;
00900 
00902 
00905     Specifier access_type(void) const;
00906 
00908     MetaClass base_class(void) const;
00909 
00914     mirror::meta_inheritance_tag category(void) const;
00915 };
00916 
00917 
00919 
00924 struct MetaVariable
00925  : virtual public MetaNamedScopedObject
00926 {
00928 
00931     Specifier storage_class(void) const;
00932 
00934     MetaType type(void) const;
00935 
00940     mirror::meta_variable_tag category(void) const;
00941 };
00942 
00944 
00949 struct MetaFreeVariable
00950  : virtual public MetaVariable
00951 {
00953     MetaNamespace scope(void) const;
00954 
00956 
00961     Type get(void) const;
00962 
00964 
00973     void set(Type new_value) const;
00974 
00979     mirror::meta_free_variable_tag category(void) const;
00980 };
00981 
00983 
00988 struct MetaPlainFreeVariable
00989  : virtual public MetaFreeVariable
00990 {
00992 
00997     Type* address(void);
00998 
01003     mirror::meta_plain_free_variable_tag category(void) const;
01004 };
01005 
01007 
01012 struct MetaMemberVariable
01013  : virtual public MetaClassMember
01014  , virtual public MetaVariable
01015 {
01017 
01026     Type get(const Class& instance) const;
01027 
01029 
01043     void set(Class& instance, Type new_value) const;
01044 
01049     mirror::meta_member_variable_tag category(void) const;
01050 };
01051 
01053 
01058 struct MetaPlainMemberVariable
01059  : virtual public MetaMemberVariable
01060 {
01062     ptrdiff_t offset(void) const;
01063 
01065 
01073     Type* address(Class& instance) const;
01074 
01075     const Type* address(const Class& instance) const;
01076 
01078     MemberVariablePointer member_pointer(void) const;
01079 
01084     mirror::meta_plain_member_variable_tag category(void) const;
01085 };
01086 
01088 
01093 struct MetaParameter
01094  : virtual public MetaVariable
01095 {
01097     Integer position(void) const;
01098 
01103     mirror::meta_parameter_tag category(void) const;
01104 };
01105 
01107 
01112 struct MetaFunction
01113  : virtual public MetaScope
01114 {
01116     MetaType result_type(void) const;
01117 
01119 
01122     Specifier storage_class(void) const;
01123 
01125     Specifier linkage(void) const;
01126 
01128     Range<MetaParameter> parameters(void) const;
01129 
01134     mirror::meta_function_tag category(void) const;
01135 };
01136 
01138 
01143 struct MetaMemberFunction
01144  : virtual public MetaClassMember
01145  , virtual public MetaFunction
01146 {
01148     Specifier constness(void) const;
01149 
01154     mirror::meta_member_function_tag category(void) const;
01155 };
01156 
01158 
01163 struct MetaConstructor
01164  : virtual public MetaFunction
01165  , virtual public MetaClassMember
01166 {
01171     mirror::meta_constructor_tag category(void) const;
01172 };
01173 
01175 
01180 struct MetaConversionOperator
01181  : virtual public MetaMemberFunction
01182 {
01187     mirror::meta_conversion_operator_tag category(void) const;
01188 };
01189 
01191 
01196 struct MetaOverloadedFunctions
01197  : virtual public MetaNamedScopedObject
01198 {
01200     Range<MetaFunction> overloads(void) const;
01201 
01206     mirror::meta_overloaded_functions_tag category(void) const;
01207 };
01208 
01210 
01215 struct MetaTraversal
01216  : virtual public MetaNamedObject
01217 {
01219     MetaContainer container(void) const;
01220 
01222     mirror::Traversal start(Container container) const;
01223 
01228     mirror::meta_traversal_tag category(void) const;
01229 };
01230 
01232 
01237 struct MetaLocator
01238  : virtual public MetaNamedObject
01239 {
01241     MetaContainer container(void) const;
01242 
01243     // TODO: signature
01245     mirror::Locator go_to(Container container, ...) const;
01246 
01251     mirror::meta_traversal_tag category(void) const;
01252 };
01253 
01255 
01260 struct MetaInserter
01261  : virtual public MetaNamedObject
01262 {
01264     MetaContainer container(void) const;
01265 
01266     // TODO: signature, insert
01267 
01272     mirror::meta_inserter_tag category(void) const;
01273 };
01274 
01276 
01281 struct MetaEraser
01282  : virtual public MetaNamedObject
01283 {
01285     MetaContainer container(void) const;
01286 
01287     // TODO: signature, erase
01288 
01293     mirror::meta_eraser_tag category(void) const;
01294 };
01295 
01297 
01302 struct MetaContainer
01303  : virtual public MetaScopedObject
01304 {
01306 
01309     MetaScope scope(void) const;
01310 
01312     MetaType element_type(void) const;
01313 
01315     MetaTraversal default_traversal(void) const;
01316 
01318     Range<MetaTraversal> traversals(void) const;
01319 
01321     Range<MetaInserter> inserters(void) const;
01322 
01324     Range<MetaEraser> erasers(void) const;
01325 
01330     mirror::meta_container_tag category(void) const;
01331 };
01332 
01333 PUDDLE_NAMESPACE_END
01334 
01335 #endif // MIRROR_DOCUMENTATION_ONLY
01336 
01337 #endif //include guard
01338 

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.