Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Forstner, Matyas | |
11 | * Raduly, Csaba | |
12 | * | |
13 | ******************************************************************************/ | |
970ed795 EL |
14 | #ifndef _Asn_OCSV_HH |
15 | #define _Asn_OCSV_HH | |
16 | ||
17 | #include "Object.hh" | |
18 | #include "Block.hh" | |
19 | ||
20 | namespace Asn { | |
21 | ||
22 | using namespace Common; | |
23 | ||
24 | class OCSV_Builder; | |
25 | class OCSV_Parser; | |
26 | ||
27 | /** | |
28 | * OCS visitor to build the OCS. :) It's clear and simple, isn't it? | |
29 | */ | |
30 | class OCSV_Builder : public OCS_Visitor { | |
31 | private: | |
32 | TokenBuf *tb; | |
33 | FieldSpecs *fss; // ref. | |
34 | ||
35 | OCSV_Builder(const OCSV_Builder& p); | |
36 | void visit0(OCS_Node& p); | |
37 | public: | |
38 | OCSV_Builder(TokenBuf *p_tb, FieldSpecs *p_fss); | |
39 | virtual ~OCSV_Builder(); | |
40 | virtual void visit_root(OCS_root& p); | |
41 | virtual void visit_seq(OCS_seq& p); | |
42 | virtual void visit_literal(OCS_literal& p); | |
43 | virtual void visit_setting(OCS_setting& p); | |
44 | }; | |
45 | ||
46 | /** | |
47 | * OCS visitor to parse an object definition. | |
48 | */ | |
49 | class OCSV_Parser : public OCS_Visitor { | |
50 | private: | |
51 | TokenBuf *tb; | |
52 | Obj_defn *my_obj; | |
53 | /** Stores whether the parsing was successful. If it is false, the | |
54 | * parsing cannot be continued. */ | |
55 | bool success; | |
56 | /** Stores whether the previous parsing was successful. */ | |
57 | bool prev_success; | |
58 | ||
59 | OCSV_Parser(const OCSV_Parser& p); | |
60 | public: | |
61 | OCSV_Parser(TokenBuf *p_tb, Obj_defn *p_my_obj); | |
62 | virtual ~OCSV_Parser(); | |
63 | virtual void visit_root(OCS_root& p); | |
64 | virtual void visit_seq(OCS_seq& p); | |
65 | virtual void visit_literal(OCS_literal& p); | |
66 | virtual void visit_setting(OCS_setting& p); | |
67 | private: | |
68 | size_t is_ref(size_t pos); | |
69 | size_t is_tag(size_t pos); | |
70 | size_t is_constraint(size_t pos); | |
71 | size_t is_constraints(size_t pos); | |
72 | size_t is_nakedtype(size_t pos); | |
73 | size_t is_type(size_t pos); | |
74 | size_t is_value(size_t pos); | |
75 | size_t is_object(size_t pos); | |
76 | size_t is_objectset(size_t pos); | |
77 | Block* get_first_n(size_t n); | |
78 | Type* parse_type(); | |
79 | Value* parse_value(); | |
80 | Object* parse_object(); | |
81 | ObjectSet* parse_objectset(); | |
82 | }; | |
83 | ||
84 | } // namespace Asn | |
85 | ||
86 | #endif // _Asn_OCSV_HH |