File: XmlModelReader.h

package info (click to toggle)
aspectc%2B%2B 1%3A2.1-2~bpo8.0
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 16,212 kB
  • sloc: cpp: 107,361; ansic: 7,644; sh: 2,188; makefile: 1,290; pascal: 634; python: 402; xml: 349
file content (90 lines) | stat: -rw-r--r-- 3,710 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

#ifndef __XmlModelReader_h__
#define __XmlModelReader_h__

#include <map>
#include "Elements.h"

class XmlModelReader {

  ProjectModel *model_;
  xmlNodePtr curr_;
  ModelNode **node_map_;
  int ids_;
  typedef std::map<string, xmlNodePtr> ChildMap;
  ChildMap *child_map_;
  
  // initialize a node and its children from an XML node (tree)
  ModelNode *from_xml (ACM_Node &node);
  ModelNode *from_xml (ACM_File &node);
  ModelNode *from_xml (ACM_TUnit &node);
  ModelNode *from_xml (ACM_Header &node);
  ModelNode *from_xml (ACM_Source &node);
  ModelNode *from_xml (ACM_MemberIntro &node);
  ModelNode *from_xml (ACM_BaseIntro &node);
  ModelNode *from_xml (ACM_ClassPlan &node);
  ModelNode *from_xml (ACM_CodeAdvice &node);
  ModelNode *from_xml (ACM_CodePlan &node);
  ModelNode *from_xml (ACM_Any &node);
  ModelNode *from_xml (ACM_Type &node);
  ModelNode *from_xml (ACM_Arg &node);
  ModelNode *from_xml (ACM_Name &node);
  ModelNode *from_xml (ACM_Namespace &node);
  ModelNode *from_xml (ACM_Function &node);
  ModelNode *from_xml (ACM_Variable &node);
  ModelNode *from_xml (ACM_Class &node);
  ModelNode *from_xml (ACM_ClassSlice &node);
  ModelNode *from_xml (ACM_Code &node);
  ModelNode *from_xml (ACM_Access &node);
  ModelNode *from_xml (ACM_Get &node);
  ModelNode *from_xml (ACM_Set &node);
  ModelNode *from_xml (ACM_Call &node);
  ModelNode *from_xml (ACM_Builtin &node);
  ModelNode *from_xml (ACM_Ref &node);
  ModelNode *from_xml (ACM_GetRef &node);
  ModelNode *from_xml (ACM_SetRef &node);
  ModelNode *from_xml (ACM_CallRef &node);
  ModelNode *from_xml (ACM_Execution &node);
  ModelNode *from_xml (ACM_Construction &node);
  ModelNode *from_xml (ACM_Destruction &node);
  ModelNode *from_xml (ACM_Pointcut &node);
  ModelNode *from_xml (ACM_Attribute &node);
  ModelNode *from_xml (ACM_Advice &node);
  ModelNode *from_xml (ACM_AdviceCode &node);
  ModelNode *from_xml (ACM_Introduction &node);
  ModelNode *from_xml (ACM_Order &node);
  ModelNode *from_xml (ACM_Aspect &node);
  ModelNode *from_xml (ACM_Speculation &node);
  ModelNode *from_xml (ACM_Model &node);

  // helper functions
  bool alloc_nodes_with_id (xmlNodePtr node); 
  ModelNode *alloc_node (xmlNodePtr node);
  ModelNode *initialize_node (xmlNodePtr node);
  ChildMap *set_child_map (ChildMap &cm, xmlNodePtr node);
  void unset_child_map (ChildMap *cm);
  xmlNodePtr find_child (string name);
  
public:
  // clear model and load the contents of an XML project file into it
  bool read (ProjectModel &model, const char *filename, int fd = -1);
};

#endif // __XmlModelReader_h__