changes
This commit is contained in:
46
PostfixPolicyProtocol.cpp
Normal file
46
PostfixPolicyProtocol.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* PostfixPolicyProtocol.cpp
|
||||
*
|
||||
* Created on: 27.03.2013
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "PostfixPolicyProtocol.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
PostfixPolicyProtocol::PostfixPolicyProtocol() {
|
||||
sender = "";
|
||||
recipient = "";
|
||||
}
|
||||
|
||||
void PostfixPolicyProtocol::processInput() {
|
||||
while (1) {
|
||||
string buffer;
|
||||
getline(cin, buffer);
|
||||
if (0 == buffer.length())
|
||||
break;
|
||||
string::size_type equalsIdx = buffer.find('=');
|
||||
if (string::npos != equalsIdx) {
|
||||
string key = buffer.substr(0, equalsIdx);
|
||||
string value = buffer.substr(equalsIdx+1);
|
||||
if ("sender" == key)
|
||||
sender = value;
|
||||
if ("recipient" ==key)
|
||||
recipient = value;
|
||||
}
|
||||
}
|
||||
|
||||
if ((0 == sender.length()) || (0 == recipient.length()))
|
||||
throw InvalidAddressTuple();
|
||||
}
|
||||
|
||||
void PostfixPolicyProtocol::sendResult(string const& result) {
|
||||
cout << "action=" << result << endl << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user