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!!!!
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,
89 
91 };
92 
93 std::ostream& operator<<( std::ostream&, SchemaTypeCode );
94 
95 
96 class ZORBA_DLL_PUBLIC StoreConsts
97 {
98  public:
99 
100  enum NsScoping
101  {
104  ONLY_PARENT_NAMESPACES
105  };
106 
107  enum NodeKind
108  {
109  anyNode = 0,
110  documentNode = 1,
111  elementNode = 2,
112  attributeNode = 3,
113  textNode = 4,
114  piNode = 5,
115  commentNode = 6
116  };
117 
118  static std::string toString(NodeKind k)
119  {
120  switch(k)
121  {
122  case anyNode:
123  return "anyNode";
124 
125  case documentNode:
126  return "documentNode";
127 
128  case elementNode:
129  return "elementNode";
130 
131  case attributeNode:
132  return "attributeNode";
133 
134  case textNode:
135  return "textNode";
136 
137  case piNode:
138  return "piNode";
139 
140  case commentNode:
141  return "commentNode";
142 
143  default:
144  return "<unknown NodeKind>";
145  }
146  }
147 
148  static std::string toSchemaString(NodeKind k)
149  {
150  switch(k)
151  {
152  case anyNode:
153  return "node";
154 
155  case documentNode:
156  return "document-node";
157 
158  case elementNode:
159  return "element";
160 
161  case attributeNode:
162  return "attribute";
163 
164  case textNode:
165  return "text";
166 
167  case piNode:
168  return "processing-instruction";
169 
170  case commentNode:
171  return "comment";
172 
173  default:
174  return "<unknown NodeKind>";
175  }
176  }
177 
178 
179  /* ATTENTION: the ordering of the enum values is important. Do NOT change it! */
181  {
182  jsonItem = 0,
183  jsonObject = 1,
184  jsonArray = 2
185  };
186 
187 
188  static std::string toString(JSONItemKind k)
189  {
190  switch(k)
191  {
192  case jsonItem:
193  return "json-item";
194 
195  case jsonObject:
196  return "object";
197 
198  case jsonArray:
199  return "array";
200 
201  default:
202  return "<unknown JSONItemKind>";
203  }
204  }
205 };
206 
207 } // namespace store
208 } // namespace zorba
209 #endif
210 /* vim:set et sw=2 ts=2: */
blog comments powered by Disqus