- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

NUMToken.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libetonyek project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef NUMTOKEN_H_INCLUDED
11 #define NUMTOKEN_H_INCLUDED
12
13 namespace libetonyek
14 {
15
16 namespace NUMToken
17 {
18
19 namespace detail
20 {
21
22 template<unsigned N, unsigned P>
23 struct log_impl
24 {
25 static const unsigned value = log_impl<(N >> 1), P + 1>::value;
26 };
27
28 template<unsigned P>
29 struct log_impl<1, P>
30 {
31 static const unsigned value = P;
32 };
33
34 template<unsigned P>
35 struct log_impl<0, P>
36 {
37 };
38
39 template<unsigned N>
40 struct log
41 {
42 static const unsigned value = log_impl<N, 0>::value;
43 };
44
45 }
46
47 enum
48 {
49 INVALID_TOKEN = 0,
50
51 // elements
52
53 // attributes
54
55 // attribute values
56
57 LAST_TOKEN
58 };
59
60 // namespaces
61 enum
62 {
63 TOKEN_RANGE = 2 << (detail::log<LAST_TOKEN + 1>::value + 1),
64 NS_NONE = TOKEN_RANGE,
65 NS_URI_LS = NS_NONE + TOKEN_RANGE,
66 NS_URI_SF = NS_URI_LS + TOKEN_RANGE,
67 NS_URI_SFA = NS_URI_SF + TOKEN_RANGE,
68 NS_URI_XSI = NS_URI_SFA + TOKEN_RANGE
69 };
70
71 }
72
73 struct NUMTokenizer
74 {
75 int operator()(const char *str) const;
76 };
77
78 }
79
80 #endif // NUMTOKEN_H_INCLUDED
81
82 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek::NUMToken::NS_NONE
Definition: NUMToken.h:64
libetonyek::NUMToken::LAST_TOKEN
Definition: NUMToken.h:57
libetonyek::NUMToken::detail::log_impl
Definition: NUMToken.h:23
libetonyek::NUMToken::INVALID_TOKEN
Definition: NUMToken.h:49
libetonyek::NUMToken::NS_URI_LS
Definition: NUMToken.h:65
libetonyek::NUMToken::NS_URI_SFA
Definition: NUMToken.h:67
libetonyek::NUMToken::TOKEN_RANGE
Definition: NUMToken.h:63
libetonyek::NUMToken::detail::log_impl::value
static const unsigned value
Definition: NUMToken.h:25
libetonyek::NUMToken::NS_URI_XSI
Definition: NUMToken.h:68
libetonyek::NUMToken::NS_URI_SF
Definition: NUMToken.h:66
libetonyek::NUMTokenizer
Definition: NUMToken.h:73
libetonyek::NUMToken::detail::log::value
static const unsigned value
Definition: NUMToken.h:42
libetonyek::NUMToken::detail::log
Definition: NUMToken.h:40