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