diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a372bf98 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "library/XmlParser-CPP"] + path = library/XmlParser-CPP + url = https://github.com/olcaytaner/XmlParser-CPP.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 10b5994d..5ecaadfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,17 @@ cmake_minimum_required(VERSION 3.12) + project(PropBank) + set(CMAKE_CXX_STANDARD 17) -include_directories(include) -link_directories(library) + +add_subdirectory(library/XmlParser-CPP) + +include_directories(library/XmlParser-CPP) + add_library(PropBank Argument.cpp Argument.h ArgumentType.h Role.cpp Role.h RoleSet.cpp RoleSet.h FramesetArgument.cpp FramesetArgument.h Frameset.cpp Frameset.h Predicate.cpp Predicate.h PredicateList.cpp PredicateList.h FramesetList.cpp FramesetList.h) + target_link_libraries(PropBank XmlParser) + add_executable(TestPropBank Argument.cpp Argument.h ArgumentType.h Role.cpp Role.h RoleSet.cpp RoleSet.h FramesetArgument.cpp FramesetArgument.h Frameset.cpp Frameset.h Predicate.cpp Predicate.h PredicateList.cpp PredicateList.h FramesetList.cpp FramesetList.h TestPropBank.cpp) + target_link_libraries(TestPropBank XmlParser) diff --git a/Role.cpp b/Role.cpp index f9a240f0..6434efca 100644 --- a/Role.cpp +++ b/Role.cpp @@ -1,4 +1,5 @@ #include +#include // // Created by Olcay Taner Yıldız on 6.10.2018. diff --git a/include/XmlAttribute.h b/include/XmlAttribute.h deleted file mode 100644 index 4d9ab6a9..00000000 --- a/include/XmlAttribute.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Created by Olcay Taner Yıldız on 12.10.2018. -// - -#ifndef XMLPARSER_XMLATTRIBUTE_H -#define XMLPARSER_XMLATTRIBUTE_H -#include - -using namespace std; - -class XmlAttribute { -private: - string name; - string value; -public: - XmlAttribute(); - XmlAttribute(string name); - string getName(); - string getValue(); - void setValue(string value); - string to_String(); -}; - - -#endif //XMLPARSER_XMLATTRIBUTE_H diff --git a/include/XmlDocument.h b/include/XmlDocument.h deleted file mode 100644 index a1df9e0f..00000000 --- a/include/XmlDocument.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Created by Olcay Taner Yıldız on 12.10.2018. -// - -#ifndef XMLPARSER_XMLDOCUMENT_H -#define XMLPARSER_XMLDOCUMENT_H -#include -#include -#include "XmlElement.h" -#include "XmlTokenType.h" - -using namespace std; - -class XmlDocument { -private: - string fileName; - ifstream inputStream; - XmlTokenType lastReadTokenType; - XmlElement* root; - string readToken(char previousChar, char* nextChar, bool extraAllowed); - string parseTag(); - string parseAttributeValue(); - string parseEmptyTag(); - string getNextToken(); -public: - XmlDocument(string fileName); - ~XmlDocument(); - void print(string fileName); - void parse(); - XmlElement* getFirstChild(); -}; - - -#endif //XMLPARSER_XMLDOCUMENT_H diff --git a/include/XmlElement.h b/include/XmlElement.h deleted file mode 100644 index 28e47754..00000000 --- a/include/XmlElement.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// Created by Olcay Taner Yıldız on 12.10.2018. -// - -#ifndef XMLPARSER_XMLELEMENT_H -#define XMLPARSER_XMLELEMENT_H -#include -#include -#include "XmlAttribute.h" - -using namespace std; - -class XmlElement { -private: - string name = ""; - string pcData = ""; - vector attributes; - XmlElement* parent; - XmlElement* firstChild; - XmlElement* nextSibling; -public: - XmlElement(string name, XmlElement* parent); - ~XmlElement(); - string getName(); - string getPcData(); - XmlElement* getFirstChild(); - XmlElement* getNextSibling(); - XmlElement* getParent(); - void setAttributeValue(string attributeName, string attributeValue); - string getAttributeValue(string attributeName); - void print(ofstream& outputStream, int level); - void setNextSibling(XmlElement* nextSibling); - void setFirstChild(XmlElement* firstChild); - void addAttribute(XmlAttribute xmlAttribute); - void setPcData(string pcData); - bool hasAttributes(); -}; - - -#endif //XMLPARSER_XMLELEMENT_H diff --git a/include/XmlTextType.h b/include/XmlTextType.h deleted file mode 100644 index 380b7f77..00000000 --- a/include/XmlTextType.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// Created by Olcay Taner Yıldız on 12.10.2018. -// - -#ifndef XMLPARSER_XMLTEXTTYPE_H -#define XMLPARSER_XMLTEXTTYPE_H - -enum class XmlTextType{ - XML_TEXT_ATTRIBUTE = 0, - XML_TEXT_VALUE, - XML_TEXT_NOT_AVAILABLE -}; -#endif //XMLPARSER_XMLTEXTTYPE_H diff --git a/include/XmlTokenType.h b/include/XmlTokenType.h deleted file mode 100644 index 1b273e5b..00000000 --- a/include/XmlTokenType.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Created by Olcay Taner Yıldız on 12.10.2018. -// - -#ifndef XMLPARSER_XMLTOKENTYPE_H -#define XMLPARSER_XMLTOKENTYPE_H - -enum class XmlTokenType{ - XML_OPENING_TAG_WITH_ATTRIBUTES = 0, - XML_OPENING_TAG_WITHOUT_ATTRIBUTES, - XML_OPENING_TAG_FINISH, - XML_CLOSING_TAG_WITH_ATTRIBUTES, - XML_CLOSING_TAG_WITHOUT_ATTRIBUTES, - XML_ATTRIBUTE_VALUE, - XML_EQUAL, - XML_TEXT, - XML_END -}; -#endif //XMLPARSER_XMLTOKENTYPE_H diff --git a/library/XmlParser-CPP b/library/XmlParser-CPP new file mode 160000 index 00000000..6f6b2a8e --- /dev/null +++ b/library/XmlParser-CPP @@ -0,0 +1 @@ +Subproject commit 6f6b2a8e9d888cec3f7b19686a724304acb67edb diff --git a/library/libXmlParser.a b/library/libXmlParser.a deleted file mode 100644 index f426211f..00000000 Binary files a/library/libXmlParser.a and /dev/null differ