store_consts.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_STORE_STORE_CONSTS_H
17 #define ZORBA_STORE_STORE_CONSTS_H
18 
19 #include <iostream>
20 #include <string>
21 #include <zorba/config.h>
22 
23 namespace zorba { namespace store {
24 
25 /*******************************************************************************
26  !!! ATTENTION: The order of the enum values within SchemaTypeCode is important.
27  !!! DO NOT change this order!!!! DO NOT insert in the middle!!!!
28 ********************************************************************************/
30 {
32 
33  XS_STRING = 1,
35  XS_TOKEN = 3,
38  XS_NAME = 6,
39  XS_NCNAME = 7,
40  XS_ID = 8,
41  XS_IDREF = 9,
42  XS_ENTITY = 10,
43 
45 
47  XS_DATE = 13,
48  XS_TIME = 14,
49 
53 
54  XS_FLOAT = 18,
55  XS_DOUBLE = 19,
56 
57  XS_DECIMAL = 20,
58  XS_INTEGER = 21,
61  XS_LONG = 24,
62  XS_INT = 25,
63  XS_SHORT = 26,
64  XS_BYTE = 27,
71 
73  XS_GYEAR = 35,
75  XS_GDAY = 37,
76  XS_GMONTH = 38,
77 
78  XS_BOOLEAN = 39,
79 
82 
83  XS_ANY_URI = 42,
84 
85  XS_QNAME = 43,
87 
88  JS_NULL = 45,
90 
92 };
93 
94 std::ostream& operator<<( std::ostream&, SchemaTypeCode );
95 
96 
97 class ZORBA_DLL_PUBLIC StoreConsts
98 {
99  public:
100 
102  {
105  ONLY_PARENT_NAMESPACES
106  };
107 
108  enum NodeKind
109  {
110  anyNode = 0,
111  documentNode = 1,
112  elementNode = 2,
113  attributeNode = 3,
114  textNode = 4,
115  piNode = 5,
116  commentNode = 6,
117  namespaceNode = 7
118  };
119 
120  static std::string toString(NodeKind k)
121  {
122  switch(k)
123  {
124  case anyNode:
125  return "anyNode";
126 
127  case documentNode:
128  return "documentNode";
129 
130  case elementNode:
131  return "elementNode";
132 
133  case attributeNode:
134  return "attributeNode";
135 
136  case textNode:
137  return "textNode";
138 
139  case piNode:
140  return "piNode";
141 
142  case commentNode:
143  return "commentNode";
144 
145  case namespaceNode:
146  return "namespaceNode";
147 
148  default:
149  return "<unknown NodeKind>";
150  }
151  }
152 
153  static std::string toSchemaString(NodeKind k)
154  {
155  switch(k)
156  {
157  case anyNode:
158  return "node";
159 
160  case documentNode:
161  return "document-node";
162 
163  case elementNode:
164  return "element";
165 
166  case attributeNode:
167  return "attribute";
168 
169  case textNode:
170  return "text";
171 
172  case piNode:
173  return "processing-instruction";
174 
175  case commentNode:
176  return "comment";
177 
178  case namespaceNode:
179  return "namespace-node";
180 
181  default:
182  return "<unknown NodeKind>";
183  }
184  }
185 
186 
187  /* ATTENTION: the ordering of the enum values is important. Do NOT change it! */
189  {
190  jsonItem = 0,
191  jsonObject = 1,
192  jsonArray = 2
193  };
194 
195 
196  static std::string toString(JSONItemKind k)
197  {
198  switch(k)
199  {
200  case jsonItem:
201  return "json-item";
202 
203  case jsonObject:
204  return "object";
205 
206  case jsonArray:
207  return "array";
208 
209  default:
210  return "<unknown JSONItemKind>";
211  }
212  }
213 };
214 
215 } // namespace store
216 } // namespace zorba
217 #endif
218 /* vim:set et sw=2 ts=2: */
static std::string toSchemaString(NodeKind k)
Definition: store_consts.h:153
std::ostream & operator<<(std::ostream &, SchemaTypeCode)
static std::string toString(NodeKind k)
Definition: store_consts.h:120
static std::string toString(JSONItemKind k)
Definition: store_consts.h:196