00001 // Filename: typeManager.h 00002 // Created by: drose (14Aug00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef TYPEMANAGER_H 00020 #define TYPEMANAGER_H 00021 00022 #include <dtoolbase.h> 00023 00024 class CPPFunctionGroup; 00025 class CPPInstance; 00026 class CPPType; 00027 class CPPSimpleType; 00028 class CPPPointerType; 00029 class CPPConstType; 00030 class CPPExtensionType; 00031 class CPPStructType; 00032 class CPPEnumType; 00033 class CPPFunctionType; 00034 class CPPScope; 00035 class CPPIdentifier; 00036 class CPPNameComponent; 00037 class CPPManifest; 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Class : TypeManager 00041 // Description : This is just a collection of static methods that 00042 // perform useful operations on CPPTypes for 00043 // interrogate. The class is really just a namespace 00044 // that groups these functions together. 00045 //////////////////////////////////////////////////////////////////// 00046 class TypeManager { 00047 public: 00048 00049 static CPPType *resolve_type(CPPType *type, CPPScope *scope = (CPPScope *)NULL); 00050 00051 static bool is_assignable(CPPType *type); 00052 00053 static bool is_reference(CPPType *type); 00054 static bool is_ref_to_anything(CPPType *type); 00055 static bool is_const_ref_to_anything(CPPType *type); 00056 static bool is_pointer(CPPType *type); 00057 static bool is_const(CPPType *type); 00058 static bool is_struct(CPPType *type); 00059 static bool is_enum(CPPType *type); 00060 static bool is_const_enum(CPPType *type); 00061 static bool is_const_ref_to_enum(CPPType *type); 00062 static bool is_simple(CPPType *type); 00063 static bool is_const_simple(CPPType *type); 00064 static bool is_const_ref_to_simple(CPPType *type); 00065 static bool is_pointable(CPPType *type); 00066 static bool is_char(CPPType *type); 00067 static bool is_char_pointer(CPPType *type); 00068 static bool is_basic_string_char(CPPType *type); 00069 static bool is_const_basic_string_char(CPPType *type); 00070 static bool is_const_ref_to_basic_string_char(CPPType *type); 00071 static bool is_bool(CPPType *type); 00072 static bool is_integer(CPPType *type); 00073 static bool is_float(CPPType *type); 00074 static bool is_void(CPPType *type); 00075 static bool is_reference_count(CPPType *type); 00076 static bool is_reference_count_pointer(CPPType *type); 00077 static bool is_pointer_to_base(CPPType *type); 00078 static bool is_const_pointer_to_base(CPPType *type); 00079 static bool is_const_ref_to_pointer_to_base(CPPType *type); 00080 static bool involves_unpublished(CPPType *type); 00081 static bool involves_protected(CPPType *type); 00082 00083 static CPPType *unwrap_pointer(CPPType *type); 00084 static CPPType *unwrap_reference(CPPType *type); 00085 static CPPType *unwrap_const(CPPType *type); 00086 static CPPType *unwrap_const_reference(CPPType *type); 00087 static CPPType *unwrap(CPPType *type); 00088 00089 static CPPType *get_pointer_type(CPPStructType *pt_type); 00090 00091 static CPPType *wrap_pointer(CPPType *type); 00092 static CPPType *wrap_const_pointer(CPPType *type); 00093 static CPPType *wrap_const_reference(CPPType *type); 00094 00095 static CPPType *get_basic_string_char_type(); 00096 static CPPType *get_reference_count_type(); 00097 static CPPType *get_void_type(); 00098 static CPPType *get_int_type(); 00099 00100 static string get_function_signature(CPPInstance *function, 00101 int num_default_parameters = 0); 00102 00103 static string get_function_name(CPPInstance *function); 00104 00105 static bool has_protected_destructor(CPPType *type); 00106 }; 00107 00108 #endif 00109