forked from ebu/MXFTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathebucoreParser.hpp
89 lines (75 loc) · 2.41 KB
/
ebucoreParser.hpp
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
#ifndef CPP_EBUCOREPARSER_CLASS_H
#define CPP_EBUCOREPARSER_CLASS_H
/*!
* \project_name EBU Player
* \file EBUCoreParser.hpp
* \brief EBUCore Schema Parser specifications
* \details This class is used to parse and load the EBUCore Schema
* \authors Marco Dos Santos Oliveira
* \version 0.1
* \dateOfCreation 20 august 2012
* \dateOfUpdate 26 september 2012
* \copyright GNU GPLv3
*
*/
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <list>
#include <xercesc/dom/DOM.hpp>
/*! \class ebucoreParser
* \brief this class represent the ebucore parser
*
* This class parses and loads the ebucore elements and their attributes
*/
class ebucoreParser {
public:
ebucoreParser(void);
~ebucoreParser(void);
protected:
struct AttributeStruct {
std::string name;
std::string type;
bool hasDefaultValue;
std::string defaultValue;
bool hasEnumeration;
std::vector<std::string> Enumeration;
};
struct ElementStruct {
std::string name;
std::string type;
std::list<AttributeStruct> attribute;
std::list<ElementStruct> children;
int minCardinality;
int maxCardinality;
bool leaf;
};
std::vector<ElementStruct> ebucoremodel; // ebucore model
std::vector<std::string> ebucoreStack; //ebucore stack
int getSchemas (std::string dir, std::vector<std::string> &files);
bool isExtension(std::string str, std::string extension);
bool isDCSimpleType(std::string str);
bool isStandardType(std::string str);
bool isEBUCoreType(std::string str);
int isUnbounded(std::string max);
bool groupExist(std::string str);
std::string removePrefix(std::string str, std::string prefix);
void extractSchema(std::string pathtofile);
AttributeStruct DCAttribute(void);
std::list<AttributeStruct> DCAttr;
std::string DCType(void);
AttributeStruct packAttribute(xercesc::DOMElement * el);
std::list<AttributeStruct> generateAttributes(std::string father, xercesc::DOMElement * el);
std::list<ElementStruct> generateChildren(std::string father, xercesc::DOMElement * el, int level);
void generateGroupChildren(std::list<ElementStruct> children, std::string father, xercesc::DOMElement * el);
std::vector<std::string> listEnumeration(xercesc::DOMElement * el);
ElementStruct constructSchema(xercesc::DOMElement * el);
void generateSkeletonElement(ElementStruct skeleton);
void generateSkeleton(void);
std::ofstream out;
};
#endif