1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef ARY_CPP_CS_TYPE_HXX 29 #define ARY_CPP_CS_TYPE_HXX 30 31 32 33 // USED SERVICES 34 // BASE CLASSES 35 #include <store/s_storage.hxx> 36 // COMPONENTS 37 // PARAMETERS 38 #include <ary/cpp/c_type.hxx> 39 #include <ary/cpp/c_traits.hxx> 40 #include <ary/cpp/usedtype.hxx> 41 #include <sortedids.hxx> 42 43 44 45 namespace ary 46 { 47 namespace cpp 48 { 49 50 51 52 /** The data base for all ->ary::cpp::Type objects. 53 */ 54 class Type_Storage : public ::ary::stg::Storage<Type> 55 { 56 public: 57 typedef SortedIds<UsedType_Compare> UT_Index; 58 59 Type_Storage(); 60 virtual ~Type_Storage(); 61 62 const UT_Index & UsedTypeIndex() const; 63 64 UT_Index & UsedTypeIndex(); 65 Type_id Search_BuiltInType( 66 const String & i_specializedName ) const; 67 68 static Type_Storage & 69 Instance_() { csv_assert(pInstance_ != 0); 70 return *pInstance_; } 71 private: 72 // Locals 73 void Setup_BuiltInTypes(); 74 void Set_BuiltInType( 75 Rid i_nId, 76 const char * i_sName, 77 ary::cpp::E_TypeSpecialisation 78 i_eSpecialisation = TYSP_none ); 79 // DATA 80 UT_Index aUsedTypes; 81 std::map<String,Type_id> 82 aBuiltInTypes; 83 84 85 static Type_Storage * 86 pInstance_; 87 }; 88 89 90 91 92 namespace predefined 93 { 94 95 enum E_Type 96 { 97 // 0 is always unused with repository storages. 98 t_void = 1, 99 t_bool, 100 t_char, 101 t_signed_char, 102 t_unsigned_char, 103 t_short, 104 t_unsigned_short, 105 t_int, 106 t_unsigned_int, 107 t_long, 108 t_unsigned_long, 109 t_float, 110 t_double, 111 t_size_t, 112 t_wchar_t, 113 t_ptrdiff_t, 114 t_ellipse, 115 t_MAX 116 }; 117 118 } // namespace predefined 119 120 121 122 // IMPLEMENTATION 123 inline const Type_Storage::UT_Index & 124 Type_Storage::UsedTypeIndex() const 125 { 126 return aUsedTypes; 127 } 128 129 inline Type_Storage::UT_Index & 130 Type_Storage::UsedTypeIndex() 131 { 132 return aUsedTypes; 133 } 134 135 136 } // namespace cpp 137 } // namespace ary 138 #endif 139