78 lines
2.8 KiB
C
78 lines
2.8 KiB
C
|
/***************************************************************************
|
||
|
* Copyright (C) 2005 by Christof Donat *
|
||
|
* cdonat@gmx.de *
|
||
|
* *
|
||
|
* 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. *
|
||
|
***************************************************************************/
|
||
|
|
||
|
#include "cmdlineparser.h"
|
||
|
#include "xmlparser.h"
|
||
|
|
||
|
#include <boost/shared_ptr.hpp>
|
||
|
#include <stack>
|
||
|
#include <map>
|
||
|
#include <vector>
|
||
|
#include <string>
|
||
|
|
||
|
#ifndef HSADMIN_TRANSACTION
|
||
|
#define HSADMIN_TRANSACTION
|
||
|
|
||
|
using boost::shared_ptr;
|
||
|
using std::stack;
|
||
|
using std::map;
|
||
|
using std::vector;
|
||
|
using std::string;
|
||
|
|
||
|
//! encapsulates a transaction.
|
||
|
class Transaction:
|
||
|
public abstractcommandlineparser::CmdLineParser<commandline::Parameters,commandline::parsedParameters>,
|
||
|
public xmlParser::responseParserHook {
|
||
|
public:
|
||
|
//! parses all the commandline-Parameters
|
||
|
Transaction(vector<string> options);
|
||
|
|
||
|
string& getUser() { return m_parsed->m_user; };
|
||
|
//! actually execute the transaction - just needs the config and does everything else for you
|
||
|
void operator()(shared_ptr<ConfigFileParser> cfgfile);
|
||
|
|
||
|
//! callback for XML-Parser
|
||
|
virtual bool operator()(int type, string content);
|
||
|
|
||
|
//! returns the parsed parameters
|
||
|
shared_ptr<commandline::parsedParameters> getParsed() { return m_parsed; };
|
||
|
|
||
|
private:
|
||
|
bool m_globalFault;
|
||
|
int m_currentCall;
|
||
|
stack<xmlParser::Element> m_tagstack;
|
||
|
string m_nextAttributeValue;
|
||
|
map<string,string> m_nextAttributeList;
|
||
|
|
||
|
void handleElem(xmlParser::Element * elem);
|
||
|
void handleGlobalFaultElem(xmlParser::Element * elem);
|
||
|
|
||
|
string replaceEntities(const string &input);
|
||
|
string getContent(xmlParser::Element* value);
|
||
|
xmlParser::Element* stepin(int count,xmlParser::Element* value);
|
||
|
|
||
|
public:
|
||
|
xmlParser::Element *m_docelem;
|
||
|
};
|
||
|
|
||
|
#else
|
||
|
class Transaction;
|
||
|
#endif /* HSADMIN_TRANSACTION */
|