xref: /aoo4110/main/autodoc/source/ary/cpp/cs_type.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ARY_CPP_CS_TYPE_HXX
25 #define ARY_CPP_CS_TYPE_HXX
26 
27 
28 
29 // USED SERVICES
30     // BASE CLASSES
31 #include <store/s_storage.hxx>
32     // COMPONENTS
33     // PARAMETERS
34 #include <ary/cpp/c_type.hxx>
35 #include <ary/cpp/c_traits.hxx>
36 #include <ary/cpp/usedtype.hxx>
37 #include <sortedids.hxx>
38 
39 
40 
41 namespace ary
42 {
43 namespace cpp
44 {
45 
46 
47 
48 /** The data base for all ->ary::cpp::Type objects.
49 */
50 class Type_Storage : public ::ary::stg::Storage<Type>
51 {
52   public:
53     typedef SortedIds<UsedType_Compare>     UT_Index;
54 
55                         Type_Storage();
56     virtual             ~Type_Storage();
57 
58     const UT_Index &    UsedTypeIndex() const;
59 
60     UT_Index &          UsedTypeIndex();
61     Type_id             Search_BuiltInType(
62                             const String &      i_specializedName ) const;
63 
64     static Type_Storage &
Instance_()65                         Instance_()             { csv_assert(pInstance_ != 0);
66                                                   return *pInstance_; }
67   private:
68     // Locals
69     void                Setup_BuiltInTypes();
70     void                Set_BuiltInType(
71                             Rid                 i_nId,
72 							const char *		i_sName,
73 							ary::cpp::E_TypeSpecialisation
74 							                    i_eSpecialisation = TYSP_none );
75     // DATA
76     UT_Index            aUsedTypes;
77     std::map<String,Type_id>
78                         aBuiltInTypes;
79 
80 
81     static Type_Storage *
82                         pInstance_;
83 };
84 
85 
86 
87 
88 namespace predefined
89 {
90 
91 enum E_Type
92 {
93     // 0 is always unused with repository storages.
94     t_void = 1,
95 	t_bool,
96 	t_char,
97 	t_signed_char,
98 	t_unsigned_char,
99 	t_short,
100 	t_unsigned_short,
101 	t_int,
102 	t_unsigned_int,
103 	t_long,
104 	t_unsigned_long,
105 	t_float,
106 	t_double,
107 	t_size_t,
108 	t_wchar_t,
109 	t_ptrdiff_t,
110 	t_ellipse,
111     t_MAX
112 };
113 
114 }   // namespace predefined
115 
116 
117 
118 // IMPLEMENTATION
119 inline const Type_Storage::UT_Index &
UsedTypeIndex() const120 Type_Storage::UsedTypeIndex() const
121 {
122     return aUsedTypes;
123 }
124 
125 inline Type_Storage::UT_Index &
UsedTypeIndex()126 Type_Storage::UsedTypeIndex()
127 {
128     return aUsedTypes;
129 }
130 
131 
132 }   // namespace cpp
133 }   // namespace ary
134 #endif
135