summaryrefslogtreecommitdiffstats
path: root/kode/kwsdl/wscl
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kode/kwsdl/wscl
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kode/kwsdl/wscl')
-rw-r--r--kode/kwsdl/wscl/Makefile.am14
-rw-r--r--kode/kwsdl/wscl/conversation.cpp122
-rw-r--r--kode/kwsdl/wscl/conversation.h78
-rw-r--r--kode/kwsdl/wscl/documents.cpp107
-rw-r--r--kode/kwsdl/wscl/documents.h95
-rw-r--r--kode/kwsdl/wscl/interaction.cpp94
-rw-r--r--kode/kwsdl/wscl/interaction.h78
-rw-r--r--kode/kwsdl/wscl/parser.cpp224
-rw-r--r--kode/kwsdl/wscl/parser.h46
-rw-r--r--kode/kwsdl/wscl/transition.cpp63
-rw-r--r--kode/kwsdl/wscl/transition.h55
11 files changed, 976 insertions, 0 deletions
diff --git a/kode/kwsdl/wscl/Makefile.am b/kode/kwsdl/wscl/Makefile.am
new file mode 100644
index 000000000..9f02543f7
--- /dev/null
+++ b/kode/kwsdl/wscl/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir) -I.. -I$(top_srcdir)/libkdepim $(all_includes)
+
+lib_LTLIBRARIES = libwscl.la
+
+libwscl_la_SOURCES = conversation.cpp documents.cpp interaction.cpp parser.cpp transition.cpp
+libwscl_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -no-undefined
+libwscl_la_LIBADD = -lqt-mt
+
+#bin_PROGRAMS = wscltest
+#wscltest_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+#wscltest_SOURCES = main.cpp
+#wscltest_LDADD = libwscl.la
+
+METASOURCES = AUTO
diff --git a/kode/kwsdl/wscl/conversation.cpp b/kode/kwsdl/wscl/conversation.cpp
new file mode 100644
index 000000000..692f566fb
--- /dev/null
+++ b/kode/kwsdl/wscl/conversation.cpp
@@ -0,0 +1,122 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "conversation.h"
+
+using namespace WSCL;
+
+Conversation::Conversation()
+{
+}
+
+Conversation::~Conversation()
+{
+}
+
+void Conversation::setName( const QString &name )
+{
+ mName = name;
+}
+
+QString Conversation::name() const
+{
+ return mName;
+}
+
+void Conversation::setVersion( const QString &version )
+{
+ mVersion = version;
+}
+
+QString Conversation::version() const
+{
+ return mVersion;
+}
+
+void Conversation::setDescription( const QString &description )
+{
+ mDescription = description;
+}
+
+QString Conversation::description() const
+{
+ return mDescription;
+}
+
+void Conversation::setNameSpace( const QString &nameSpace )
+{
+ mNameSpace = nameSpace;
+}
+
+QString Conversation::nameSpace() const
+{
+ return mNameSpace;
+}
+
+void Conversation::setSchema( const QString &schema )
+{
+ mSchema = schema;
+}
+
+QString Conversation::schema() const
+{
+ return mSchema;
+}
+
+void Conversation::setInitialInteraction( const QString &initialInteraction )
+{
+ mInitialInteraction = initialInteraction;
+}
+
+QString Conversation::initialInteraction() const
+{
+ return mInitialInteraction;
+}
+
+void Conversation::setFinalInteraction( const QString &finalInteraction )
+{
+ mFinalInteraction = finalInteraction;
+}
+
+QString Conversation::finalInteraction() const
+{
+ return mFinalInteraction;
+}
+
+void Conversation::setInteractions( const Interaction::List &interactions )
+{
+ mInteractions = interactions;
+}
+
+Interaction::List Conversation::interactions() const
+{
+ return mInteractions;
+}
+
+void Conversation::setTransitions( const Transition::List &transitions )
+{
+ mTransitions = transitions;
+}
+
+Transition::List Conversation::transitions() const
+{
+ return mTransitions;
+}
diff --git a/kode/kwsdl/wscl/conversation.h b/kode/kwsdl/wscl/conversation.h
new file mode 100644
index 000000000..757edfab9
--- /dev/null
+++ b/kode/kwsdl/wscl/conversation.h
@@ -0,0 +1,78 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WSCL_CONVERSATION_H
+#define WSCL_CONVERSATION_H
+
+#include "interaction.h"
+#include "transition.h"
+
+namespace WSCL {
+
+class Conversation
+{
+ public:
+ Conversation();
+ ~Conversation();
+
+ void setName( const QString &name );
+ QString name() const;
+
+ void setVersion( const QString &version );
+ QString version() const;
+
+ void setDescription( const QString &description );
+ QString description() const;
+
+ void setNameSpace( const QString &nameSpace );
+ QString nameSpace() const;
+
+ void setSchema( const QString &schema );
+ QString schema() const;
+
+ void setInitialInteraction( const QString &initialInteraction );
+ QString initialInteraction() const;
+
+ void setFinalInteraction( const QString &finalInteraction );
+ QString finalInteraction() const;
+
+ void setInteractions( const Interaction::List &interactions );
+ Interaction::List interactions() const;
+
+ void setTransitions( const Transition::List &transitions );
+ Transition::List transitions() const;
+
+ private:
+ QString mName;
+ QString mVersion;
+ QString mDescription;
+ QString mNameSpace;
+ QString mSchema;
+ QString mInitialInteraction;
+ QString mFinalInteraction;
+
+ Interaction::List mInteractions;
+ Transition::List mTransitions;
+};
+
+}
+
+#endif
diff --git a/kode/kwsdl/wscl/documents.cpp b/kode/kwsdl/wscl/documents.cpp
new file mode 100644
index 000000000..92b7928e4
--- /dev/null
+++ b/kode/kwsdl/wscl/documents.cpp
@@ -0,0 +1,107 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "documents.h"
+
+using namespace WSCL;
+
+void XMLDocument::setId( const QString &id )
+{
+ mId = id;
+}
+
+QString XMLDocument::id() const
+{
+ return mId;
+}
+
+void XMLDocument::setSchema( const QString &schema )
+{
+ mSchema = schema;
+}
+
+QString XMLDocument::schema() const
+{
+ return mSchema;
+}
+
+
+void ReceiveSendDocument::setInputDocument( const XMLDocument &document )
+{
+ mInputDocument = document;
+}
+
+XMLDocument ReceiveSendDocument::inputDocument() const
+{
+ return mInputDocument;
+}
+
+void ReceiveSendDocument::setOutputDocuments( const XMLDocument::List &documents )
+{
+ mOutputDocuments = documents;
+}
+
+XMLDocument::List ReceiveSendDocument::outputDocuments() const
+{
+ return mOutputDocuments;
+}
+
+
+void SendReceiveDocument::setInputDocuments( const XMLDocument::List &documents )
+{
+ mInputDocuments = documents;
+}
+
+XMLDocument::List SendReceiveDocument::inputDocuments() const
+{
+ return mInputDocuments;
+}
+
+void SendReceiveDocument::setOutputDocument( const XMLDocument &document )
+{
+ mOutputDocument = document;
+}
+
+XMLDocument SendReceiveDocument::outputDocument() const
+{
+ return mOutputDocument;
+}
+
+void ReceiveDocument::setInputDocument( const XMLDocument &document )
+{
+ mInputDocument = document;
+}
+
+XMLDocument ReceiveDocument::inputDocument() const
+{
+ return mInputDocument;
+}
+
+void SendDocument::setOutputDocument( const XMLDocument &document )
+{
+ mOutputDocument = document;
+}
+
+XMLDocument SendDocument::outputDocument() const
+{
+ return mOutputDocument;
+}
+
diff --git a/kode/kwsdl/wscl/documents.h b/kode/kwsdl/wscl/documents.h
new file mode 100644
index 000000000..2bba60ad1
--- /dev/null
+++ b/kode/kwsdl/wscl/documents.h
@@ -0,0 +1,95 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WSCL_DOCUMENTS_H
+#define WSCL_DOCUMENTS_H
+
+#include <qstring.h>
+#include <qvaluelist.h>
+
+namespace WSCL {
+
+class XMLDocument
+{
+ public:
+ typedef QValueList<XMLDocument> List;
+
+ void setId( const QString &id );
+ QString id() const;
+
+ void setSchema( const QString &schema );
+ QString schema() const;
+
+ private:
+ QString mId;
+ QString mSchema;
+};
+
+class ReceiveSendDocument
+{
+ public:
+ void setInputDocument( const XMLDocument &document );
+ XMLDocument inputDocument() const;
+
+ void setOutputDocuments( const XMLDocument::List &documents );
+ XMLDocument::List outputDocuments() const;
+
+ private:
+ XMLDocument mInputDocument;
+ XMLDocument::List mOutputDocuments;
+};
+
+class SendReceiveDocument
+{
+ public:
+ void setInputDocuments( const XMLDocument::List &documents );
+ XMLDocument::List inputDocuments() const;
+
+ void setOutputDocument( const XMLDocument &document );
+ XMLDocument outputDocument() const;
+
+ private:
+ XMLDocument::List mInputDocuments;
+ XMLDocument mOutputDocument;
+};
+
+class ReceiveDocument
+{
+ public:
+ void setInputDocument( const XMLDocument &document );
+ XMLDocument inputDocument() const;
+ private:
+ XMLDocument mInputDocument;
+};
+
+class SendDocument
+{
+ public:
+ void setOutputDocument( const XMLDocument &document );
+ XMLDocument outputDocument() const;
+
+ private:
+ XMLDocument mOutputDocument;
+};
+
+}
+
+#endif
diff --git a/kode/kwsdl/wscl/interaction.cpp b/kode/kwsdl/wscl/interaction.cpp
new file mode 100644
index 000000000..ff88408a9
--- /dev/null
+++ b/kode/kwsdl/wscl/interaction.cpp
@@ -0,0 +1,94 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "interaction.h"
+
+using namespace WSCL;
+
+Interaction::Interaction()
+ : mType( Empty )
+{
+}
+
+Interaction::~Interaction()
+{
+}
+
+void Interaction::setId( const QString &id )
+{
+ mId = id;
+}
+
+QString Interaction::id() const
+{
+ return mId;
+}
+
+void Interaction::setType( Type type )
+{
+ mType = type;
+}
+
+Interaction::Type Interaction::type() const
+{
+ return mType;
+}
+
+void Interaction::setSendReceiveDocument( const SendReceiveDocument &document )
+{
+ mSendReceiveDocument = document;
+}
+
+SendReceiveDocument Interaction::sendReceiveDocument() const
+{
+ return mSendReceiveDocument;
+}
+
+void Interaction::setReceiveSendDocument( const ReceiveSendDocument &document )
+{
+ mReceiveSendDocument = document;
+}
+
+ReceiveSendDocument Interaction::receiveSendDocument() const
+{
+ return mReceiveSendDocument;
+}
+
+void Interaction::setReceiveDocument( const ReceiveDocument &document )
+{
+ mReceiveDocument = document;
+}
+
+ReceiveDocument Interaction::receiveDocument() const
+{
+ return mReceiveDocument;
+}
+
+void Interaction::setSendDocument( const SendDocument &document )
+{
+ mSendDocument = document;
+}
+
+SendDocument Interaction::sendDocument() const
+{
+ return mSendDocument;
+}
+
diff --git a/kode/kwsdl/wscl/interaction.h b/kode/kwsdl/wscl/interaction.h
new file mode 100644
index 000000000..2700d7c00
--- /dev/null
+++ b/kode/kwsdl/wscl/interaction.h
@@ -0,0 +1,78 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WSCL_INTERACTION_H
+#define WSCL_INTERACTION_H
+
+#include <qvaluelist.h>
+
+#include "documents.h"
+
+namespace WSCL {
+
+class Interaction
+{
+ public:
+ typedef QValueList<Interaction> List;
+
+ enum Type
+ {
+ ReceiveSend,
+ SendReceive,
+ Receive,
+ Send,
+ Empty
+ };
+
+ Interaction();
+ ~Interaction();
+
+ void setId( const QString &id );
+ QString id() const;
+
+ void setType( Type type );
+ Type type() const;
+
+ void setSendReceiveDocument( const SendReceiveDocument &document );
+ SendReceiveDocument sendReceiveDocument() const;
+
+ void setReceiveSendDocument( const ReceiveSendDocument &document );
+ ReceiveSendDocument receiveSendDocument() const;
+
+ void setReceiveDocument( const ReceiveDocument &document );
+ ReceiveDocument receiveDocument() const;
+
+ void setSendDocument( const SendDocument &document );
+ SendDocument sendDocument() const;
+
+ private:
+ QString mId;
+ Type mType;
+
+ SendReceiveDocument mSendReceiveDocument;
+ ReceiveSendDocument mReceiveSendDocument;
+ ReceiveDocument mReceiveDocument;
+ SendDocument mSendDocument;
+};
+
+}
+
+#endif
diff --git a/kode/kwsdl/wscl/parser.cpp b/kode/kwsdl/wscl/parser.cpp
new file mode 100644
index 000000000..129c3c3dc
--- /dev/null
+++ b/kode/kwsdl/wscl/parser.cpp
@@ -0,0 +1,224 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include <qdom.h>
+
+#include "parser.h"
+
+using namespace WSCL;
+
+Parser::Parser()
+{
+}
+
+Parser::~Parser()
+{
+}
+
+void Parser::parse( const QString &xml )
+{
+ QDomDocument doc( "kwscl" );
+ QString errorMsg;
+ int errorLine, errorColumn;
+ bool ok = doc.setContent( xml, true, &errorMsg, &errorLine, &errorColumn );
+ if ( !ok ) {
+ qDebug( "Error parsing wscl (%d:%d) %s", errorLine, errorColumn, errorMsg.latin1() );
+ return;
+ }
+
+ QDomNodeList nodes = doc.elementsByTagName( "Conversation" );
+ if ( nodes.count() <= 0 ) {
+ qDebug( "No conversation tag found in wscl data" );
+ return;
+ }
+
+ QDomElement conversationElement = nodes.item( 0 ).toElement();
+
+ mConversation.setName( conversationElement.attribute( "name" ) );
+ mConversation.setVersion( conversationElement.attribute( "version" ) );
+ mConversation.setDescription( conversationElement.attribute( "description" ) );
+ mConversation.setNameSpace( conversationElement.attribute( "targetNamespace" ) );
+ mConversation.setSchema( conversationElement.attribute( "hrefSchema" ) );
+ mConversation.setInitialInteraction( conversationElement.attribute( "initialInteraction" ) );
+ mConversation.setFinalInteraction( conversationElement.attribute( "finalInteraction" ) );
+
+ QDomNode node = conversationElement.firstChild();
+ while ( !node.isNull() ) {
+ QDomElement element = node.toElement();
+ if ( !element.isNull() ) {
+ if ( element.tagName() == "ConversationInteractions" ) {
+ Interaction::List interactions;
+
+ QDomNode interactionNode = element.firstChild();
+ while ( !interactionNode.isNull() ) {
+ QDomElement interactionElement = interactionNode.toElement();
+ if ( !interactionElement.isNull() ) {
+ if ( interactionElement.tagName() != "Interaction" ) {
+ qDebug( "Expected tag name 'Interaction', got '%s'", interactionElement.tagName().latin1() );
+ continue;
+ }
+
+ Interaction interaction;
+ interaction.setId( interactionElement.attribute( "id" ) );
+ const QString type = interactionElement.attribute( "interactionType" );
+ if ( type == "ReceiveSend" )
+ interaction.setType( Interaction::ReceiveSend );
+ else if ( type == "SendReceive" )
+ interaction.setType( Interaction::SendReceive );
+ else if ( type == "Receive" )
+ interaction.setType( Interaction::Receive );
+ else if ( type == "Send" )
+ interaction.setType( Interaction::Send );
+ else if ( type == "Empty" )
+ interaction.setType( Interaction::Empty );
+ else
+ qDebug( "Unknown interaction type '%s'", type.latin1() );
+
+ XMLDocument::List inputDocuments;
+ XMLDocument::List outputDocuments;
+ XMLDocument inputDocument;
+ XMLDocument outputDocument;
+
+ QDomNode contentNode = interactionElement.firstChild();
+ while ( !contentNode.isNull() ) {
+ QDomElement contentElement = contentNode.toElement();
+ if ( !contentElement.isNull() ) {
+ const QString tagName = contentElement.tagName();
+ if ( tagName == "InboundXMLDocument" ) {
+ XMLDocument document;
+ document.setId( contentElement.attribute( "id" ) );
+ document.setSchema( contentElement.attribute( "hrefSchema" ) );
+
+ inputDocuments.append( document );
+ inputDocument = document;
+ } else if ( tagName == "OutboundXMLDocument" ) {
+ XMLDocument document;
+ document.setId( contentElement.attribute( "id" ) );
+ document.setSchema( contentElement.attribute( "hrefSchema" ) );
+
+ outputDocuments.append( document );
+ outputDocument = document;
+ }
+ }
+
+
+ contentNode = contentNode.nextSibling();
+ }
+
+ switch ( interaction.type() ) {
+ case Interaction::ReceiveSend:
+ {
+ ReceiveSendDocument document;
+ document.setInputDocument( inputDocument );
+ document.setOutputDocuments( outputDocuments );
+ interaction.setReceiveSendDocument( document );
+ }
+ break;
+ case Interaction::SendReceive:
+ {
+ SendReceiveDocument document;
+ document.setInputDocuments( inputDocuments );
+ document.setOutputDocument( outputDocument );
+ interaction.setSendReceiveDocument( document );
+ }
+ break;
+ case Interaction::Receive:
+ {
+ ReceiveDocument document;
+ document.setInputDocument( inputDocument );
+ interaction.setReceiveDocument( document );
+ }
+ break;
+ case Interaction::Send:
+ {
+ SendDocument document;
+ document.setOutputDocument( outputDocument );
+ interaction.setSendDocument( document );
+ }
+ break;
+ case Interaction::Empty:
+ default:
+ break;
+ }
+
+ interactions.append( interaction );
+ }
+
+ interactionNode = interactionNode.nextSibling();
+ }
+
+ mConversation.setInteractions( interactions );
+
+ } else if ( element.tagName() == "ConversationTransitions" ) {
+ Transition::List transitions;
+
+ QDomNode transitionNode = element.firstChild();
+ while ( !transitionNode.isNull() ) {
+ QDomElement transitionElement = transitionNode.toElement();
+ if ( !transitionElement.isNull() ) {
+ if ( transitionElement.tagName() != "Transition" ) {
+ qDebug( "Expected tag name 'Transition', got '%s'", transitionElement.tagName().latin1() );
+ continue;
+ }
+
+ Transition transition;
+
+ QDomNode contentNode = transitionElement.firstChild();
+ while ( !contentNode.isNull() ) {
+ QDomElement contentElement = contentNode.toElement();
+ if ( !contentElement.isNull() ) {
+ const QString tagName = contentElement.tagName();
+ if ( tagName == "SourceInteraction" )
+ transition.setSourceInteraction( contentElement.attribute( "href" ) );
+ else if ( tagName == "DestinationInteraction" )
+ transition.setDestinationInteraction( contentElement.attribute( "href" ) );
+ else if ( tagName == "SourceInteractionCondition" )
+ transition.setSourceInteractionCondition( contentElement.attribute( "href" ) );
+ else
+ qDebug( "Unknown transition element %s", tagName.latin1() );
+ }
+
+ contentNode = contentNode.nextSibling();
+ }
+
+ transitions.append( transition );
+ }
+
+ transitionNode = transitionNode.nextSibling();
+ }
+
+ mConversation.setTransitions( transitions );
+ }
+ }
+
+ node = node.nextSibling();
+ }
+}
+
+void Parser::reset()
+{
+ mConversation = Conversation();
+}
+
+Conversation Parser::conversation() const
+{
+ return mConversation;
+}
diff --git a/kode/kwsdl/wscl/parser.h b/kode/kwsdl/wscl/parser.h
new file mode 100644
index 000000000..8f8824747
--- /dev/null
+++ b/kode/kwsdl/wscl/parser.h
@@ -0,0 +1,46 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WSCL_PARSER_H
+#define WSCL_PARSER_H
+
+#include "conversation.h"
+
+namespace WSCL {
+
+class Parser
+{
+ public:
+ Parser();
+ ~Parser();
+
+ void parse( const QString &xml );
+ void reset();
+
+ Conversation conversation() const;
+
+ private:
+ Conversation mConversation;
+};
+
+}
+
+#endif
diff --git a/kode/kwsdl/wscl/transition.cpp b/kode/kwsdl/wscl/transition.cpp
new file mode 100644
index 000000000..c3a088a04
--- /dev/null
+++ b/kode/kwsdl/wscl/transition.cpp
@@ -0,0 +1,63 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "transition.h"
+
+using namespace WSCL;
+
+Transition::Transition()
+{
+}
+
+Transition::~Transition()
+{
+}
+
+void Transition::setSourceInteraction( const QString &sourceInteraction )
+{
+ mSourceInteraction = sourceInteraction;
+}
+
+QString Transition::sourceInteraction() const
+{
+ return mSourceInteraction;
+}
+
+void Transition::setDestinationInteraction( const QString &destinationInteraction )
+{
+ mDestinationInteraction = destinationInteraction;
+}
+
+QString Transition::destinationInteraction() const
+{
+ return mDestinationInteraction;
+}
+
+void Transition::setSourceInteractionCondition( const QString &sourceInteractionCondition )
+{
+ mSourceInteractionCondition = sourceInteractionCondition;
+}
+
+QString Transition::sourceInteractionCondition() const
+{
+ return mSourceInteractionCondition;
+}
+
diff --git a/kode/kwsdl/wscl/transition.h b/kode/kwsdl/wscl/transition.h
new file mode 100644
index 000000000..cb6d0a563
--- /dev/null
+++ b/kode/kwsdl/wscl/transition.h
@@ -0,0 +1,55 @@
+/*
+ This file is part of KDE WSCL Parser
+
+ Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WSCL_TRANSITION_H
+#define WSCL_TRANSITION_H
+
+#include <qstring.h>
+#include <qvaluelist.h>
+
+namespace WSCL {
+
+class Transition
+{
+ public:
+ typedef QValueList<Transition> List;
+
+ Transition();
+ ~Transition();
+
+ void setSourceInteraction( const QString &sourceInteraction );
+ QString sourceInteraction() const;
+
+ void setDestinationInteraction( const QString &destinationInteraction );
+ QString destinationInteraction() const;
+
+ void setSourceInteractionCondition( const QString &sourceInteractionCondition );
+ QString sourceInteractionCondition() const;
+
+ private:
+ QString mSourceInteraction;
+ QString mDestinationInteraction;
+ QString mSourceInteractionCondition;
+};
+
+}
+
+#endif