typeident.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2008 The FLWOR Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef ZORBA_TYPES_TYPEIDENT_H
17 #define ZORBA_TYPES_TYPEIDENT_H
18 
19 #include <zorba/config.h>
20 #include <zorba/api_shared_types.h>
21 #include <zorba/identtypes.h>
22 #include <zorba/zorba_string.h>
23 #include <iostream>
24 
25 namespace zorba {
26 
27 /** \brief Type identifiers
28  *
29  * The type identifiers are not used, yet.
30  *
31  * Note: This class is reference counted. When writing multi-threaded clients,
32  * it is the responibility of the client code to synchronize assignments to the
33  * SmartPtr holding this object.
34  */
35 class ZORBA_DLL_PUBLIC TypeIdentifier : public SmartObject {
36  public:
37  /** \brief Destructor
38  */
39  ~TypeIdentifier();
40 
41  static
43  createNamedType(
44  const String& uri,
45  const String& localName,
47  );
48 
49  static
51  createElementType(
52  const String& uri,
53  bool uriWildcard,
54  const String& localName,
55  bool localNameWildcard,
56  TypeIdentifier_t contentType,
58  );
59 
60  static
62  createAttributeType(
63  const String& uri,
64  bool uriWildcard,
65  const String& localName,
66  bool localNameWildcard,
67  TypeIdentifier_t contentType,
69  );
70 
71  static
73  createDocumentType(
74  TypeIdentifier_t contentType,
76  );
77 
78  static
80  createPIType(
82  );
83 
84  static
86  createTextType(
88  );
89 
90  static
92  createCommentType(
94  );
95 
96  static
98  createAnyNodeType(
100  );
101 
102  static
104  createItemType(
106  );
107 
108  static
110  createEmptyType();
111 
112  static
114  createSchemaElementType(
115  const String& uri,
116  const String& localName,
118  );
119 
120  static
122  createSchemaAttributeType(
123  const String& uri,
124  const String& localName,
126  );
127 
129  getKind() const;
130 
132  getQuantifier() const;
133 
134  const String&
135  getUri() const;
136 
137  bool
138  isUriWildcard() const;
139 
140  const String&
141  getLocalName() const;
142 
143  bool
144  isLocalNameWildcard() const;
145 
147  getContentType() const;
148 
149  std::ostream&
150  emit(std::ostream&) const;
151 
152  private:
153  TypeIdentifier();
154 
155  std::ostream&
156  emitItemType(std::ostream&) const;
157 
158  std::ostream&
159  emitName(std::ostream&) const;
160 
161  IdentTypes::kind_t m_kind;
162  IdentTypes::quantifier_t m_quantifier;
163  String m_uri;
164  bool m_uriWildcard;
165  String m_localName;
166  bool m_localNameWildcard;
167  TypeIdentifier_t m_contentType;
168 };
169 
170 #ifdef WIN32
171  template class ZORBA_DLL_PUBLIC zorba::SmartPtr<TypeIdentifier>;
172 #endif
173 
174 
175 } /* namespace zorba */
176 
177 namespace std {
178 
179 ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::TypeIdentifier& ti);
180 ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::TypeIdentifier_t ti);
181 
182 }
183 
184 #endif /* ZORBA_TYPES_TYPEIDENT_H */
185 /* vim:set et sw=2 ts=2: */
blog comments powered by Disqus