Remove dynamic exceptions
[anna.git] / include / anna / xml / Binary.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #ifndef anna_xml_Binary_hpp
10 #define anna_xml_Binary_hpp
11
12 #include <anna/core/RuntimeException.hpp>
13 #include <anna/core/util/Recycler.hpp>
14
15 namespace anna {
16
17 namespace xml {
18
19 class Binary {
20 protected:
21   typedef unsigned int Offset;
22   typedef Recycler <std::string> string_pool;
23
24   struct Addressing { enum _v { Offset8 = 8, Offset16 = 16, Offset32 = 32 }; };
25   struct ItemCode {
26     enum _v {
27       Node = 0xff, Attribute = 0xfe, Text = 0xfd, Namespace = 0xfc, NodeWithNamespace = 0xfb, AttributeWithNamespace = 0xfa,
28       TextValue = 0xe0, IntegerValue = 0xe1, LongValue = 0xe2
29     };
30   };
31
32   static const char Version = 0x10;
33   static const Offset IndexVersion = 0;
34   static const Offset IndexAddressing = 1;
35   static const Offset IndexBodyBegin = 2;
36
37   string_pool a_strings;
38
39   static int sizeOf(const Addressing::_v v) { return v >> 3; }
40 };
41
42 }
43 }
44
45 #endif
46