Commit 5cf8f0c6 authored by jpbl's avatar jpbl

replaced every possible std::string with QString

parent 2c4cef2a
......@@ -22,24 +22,24 @@
#include "Requester.hpp"
#include "Call.hpp"
Account::Account(const std::string &sessionId,
const std::string &name)
Account::Account(const QString &sessionId,
const QString &name)
: mSessionId(sessionId)
, mId(name)
{}
std::string
QString
Account::registerAccount()
{
std::list< std::string > args;
std::list< QString > args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "register", args);
}
std::string
QString
Account::unregisterAccount()
{
std::list< std::string > args;
std::list< QString > args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "unregister", args);
}
......
......@@ -21,20 +21,20 @@
#ifndef SFLPHONEGUI_ACCOUNT_H
#define SFLPHONEGUI_ACCOUNT_H
#include <string>
#include <QString>
class Call;
class Account {
public:
Account(const std::string &sessionId,
const std::string &name);
Account(const QString &sessionId,
const QString &name);
/**
* This will generate a call ready to be used.
*/
std::string registerAccount();
std::string unregisterAccount();
QString registerAccount();
QString unregisterAccount();
private:
Account();
......@@ -42,12 +42,12 @@ class Account {
/**
* This is the session id that we are related to.
*/
std::string mSessionId;
QString mSessionId;
/**
* This is the account id that we are related to.
*/
std::string mId;
QString mId;
};
......
......@@ -18,7 +18,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string>
#include <QString>
#include <list>
#include "Call.hpp"
......@@ -26,8 +26,8 @@
#include "Requester.hpp"
Call::Call(const std::string &sessionId,
const std::string &callId,
Call::Call(const QString &sessionId,
const QString &callId,
bool incomming)
: mSessionId(sessionId)
, mId(callId)
......@@ -35,7 +35,7 @@ Call::Call(const std::string &sessionId,
{}
Call::Call(const Session &session,
const std::string &callId,
const QString &callId,
bool incomming)
: mSessionId(session.id())
, mId(callId)
......@@ -46,80 +46,80 @@ bool
Call::isIncomming()
{return mIsIncomming;}
std::string
Call::call(const std::string &to)
QString
Call::call(const QString &to)
{
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
args.push_back(to);
return Requester::instance().send(mSessionId, "call", args);
}
std::string
QString
Call::answer()
{
mIsIncomming = false;
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "answer", args);
}
std::string
QString
Call::hangup()
{
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "hangup", args);
}
std::string
QString
Call::cancel()
{
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "cancel", args);
}
std::string
QString
Call::hold()
{
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "hold", args);
}
std::string
QString
Call::unhold()
{
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "unhold", args);
}
std::string
QString
Call::refuse()
{
mIsIncomming = false;
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "refuse", args);
}
std::string
QString
Call::notAvailable()
{
mIsIncomming = false;
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
return Requester::instance().send(mSessionId, "notavailable", args);
}
std::string
QString
Call::sendDtmf(char c)
{
std::list< std::string> args;
std::list< QString> args;
args.push_back(mId);
std::string s;
QString s;
s += c;
args.push_back(s);
return Requester::instance().send(mSessionId, "senddtmf", args);
......
......@@ -21,18 +21,18 @@
#ifndef SFLPHONEGUI_CALL_H
#define SFLPHONEGUI_CALL_H
#include <string>
#include <QString>
class Session;
class Call
{
public:
Call(const std::string &sessionId,
const std::string &callId,
Call(const QString &sessionId,
const QString &callId,
bool incomming = false);
Call(const Session &session,
const std::string &callId,
const QString &callId,
bool incomming = false);
/**
......@@ -41,44 +41,44 @@ class Call
*/
bool isIncomming();
std::string id() const
QString id() const
{return mId;}
std::string call(const std::string &to);
QString call(const QString &to);
/**
* This function will answer the call.
*/
std::string answer();
QString answer();
/**
* This function will hangup on a call.
*/
std::string hangup();
QString hangup();
/**
* ///TODO need to clarify this function.
*/
std::string cancel();
QString cancel();
/**
* This function will put the call on hold.
* This *should* stop temporarly the streaming.
*/
std::string hold();
QString hold();
/**
* This function will unhold a holding call.
* This *should* restart a stopped streaming.
*/
std::string unhold();
QString unhold();
/**
* This function refuse and incomming call.
* It means that the phone is ringing but we
* don't want to answer.
*/
std::string refuse();
QString refuse();
/**
* This function will set this client to be
......@@ -86,7 +86,7 @@ class Call
* the phone can still ring. But if every client
* sent notavailable, then it will be refused.
*/
std::string notAvailable();
QString notAvailable();
/**
......@@ -94,19 +94,19 @@ class Call
* This is used if you make a choice when you
* have a voice menu.
*/
std::string sendDtmf(char c);
QString sendDtmf(char c);
private:
/**
* This is the session id that we belong to.
*/
std::string mSessionId;
QString mSessionId;
/**
* This is the unique identifier of the call.
*/
std::string mId;
QString mId;
bool mIsIncomming;
};
......
......@@ -3,11 +3,11 @@
#include "CallStatus.hpp"
#include "PhoneLineManager.hpp"
CallStatus::CallStatus(const std::string &code,
const std::list< std::string > &args)
CallStatus::CallStatus(const QString &code,
const std::list< QString > &args)
: CallRelatedEvent(code, args)
{
std::list< std::string > l = getUnusedArgs();
std::list< QString > l = getUnusedArgs();
if(l.size() >= 3) {
mAccountId = *l.begin();
l.pop_front();
......@@ -22,15 +22,15 @@ CallStatus::CallStatus(const std::string &code,
void
CallStatus::execute()
{
std::string id = getCallId();
QString id = getCallId();
if(id.size() > 0) {
_debug("%s status received for call ID: %s.\n",
mStatus.c_str(),
id.c_str());
mStatus.toStdString().c_str(),
id.toStdString().c_str());
PhoneLineManager::instance().addCall(mAccountId, getCallId(), mDestination, mStatus);
}
else {
_debug("Status invalid: %s\n", toString().c_str());
_debug("Status invalid: %s\n", toString().toStdString().c_str());
}
}
......@@ -26,15 +26,15 @@
class CallStatus : public CallRelatedEvent
{
public:
CallStatus(const std::string &code,
const std::list< std::string > &args);
CallStatus(const QString &code,
const std::list< QString > &args);
void execute();
protected:
std::string mAccountId;
std::string mDestination;
std::string mStatus;
QString mAccountId;
QString mDestination;
QString mStatus;
};
#endif
......
......@@ -3,8 +3,8 @@
#include "Call.hpp"
#include "Event.hpp"
Event::Event(const std::string &code,
const std::list< std::string > &args)
Event::Event(const QString &code,
const std::list< QString > &args)
: mCode(code)
, mUnusedArgs(args)
, mArgs(args)
......@@ -14,14 +14,14 @@ Event::Event(const std::string &code,
void
Event::execute()
{
_debug("Received: %s\n", toString().c_str());
_debug("Received: %s\n", toString().toStdString().c_str());
}
std::string
QString
Event::toString()
{
std::string output(mCode);
for(std::list< std::string >::iterator pos = mArgs.begin();
QString output(mCode);
for(std::list< QString >::iterator pos = mArgs.begin();
pos != mArgs.end();
pos++) {
output += *pos;
......@@ -30,11 +30,11 @@ Event::toString()
return output;
}
CallRelatedEvent::CallRelatedEvent(const std::string &code,
const std::list< std::string > &args)
CallRelatedEvent::CallRelatedEvent(const QString &code,
const std::list< QString > &args)
: Event(code, args)
{
std::list< std::string > l(getUnusedArgs());
std::list< QString > l(getUnusedArgs());
if(l.size() != 0) {
mCallId = *l.begin();
l.pop_front();
......@@ -42,7 +42,7 @@ CallRelatedEvent::CallRelatedEvent(const std::string &code,
}
}
std::string
QString
CallRelatedEvent::getCallId()
{
return mCallId;
......
......@@ -22,41 +22,41 @@
#define __EVENT_HPP__
#include <list>
#include <string>
#include <QString>
class Event
{
public:
Event(const std::string &code,
const std::list< std::string > &args);
Event(const QString &code,
const std::list< QString > &args);
virtual ~Event(){}
virtual void execute();
virtual std::string toString();
virtual QString toString();
std::list< std::string > getUnusedArgs()
std::list< QString > getUnusedArgs()
{return mUnusedArgs;}
void setUnusedArgs(const std::list< std::string > &args)
void setUnusedArgs(const std::list< QString > &args)
{mUnusedArgs = args;}
private:
std::string mCode;
std::list< std::string > mUnusedArgs;
std::list< std::string > mArgs;
QString mCode;
std::list< QString > mUnusedArgs;
std::list< QString > mArgs;
};
class CallRelatedEvent : public Event
{
public:
CallRelatedEvent(const std::string &code,
const std::list< std::string > &args);
CallRelatedEvent(const QString &code,
const std::list< QString > &args);
std::string getCallId();
QString getCallId();
private:
std::string mCallId;
QString mCallId;
};
......
......@@ -23,7 +23,7 @@
#include <list>
#include <map>
#include <string>
#include <QString>
#include "Event.hpp"
......@@ -36,8 +36,8 @@ class EventCreatorBase
{
public:
virtual ~EventCreatorBase(){}
virtual Base *create(const std::string &code,
const std::list< std::string > &args) = 0;
virtual Base *create(const QString &code,
const std::list< QString > &args) = 0;
virtual EventCreatorBase *clone() = 0;
};
......@@ -50,8 +50,8 @@ template< typename Base, typename Actual >
class EventCreator : public EventCreatorBase< Base >
{
public:
virtual Actual *create(const std::string &code,
const std::list< std::string > &args);
virtual Actual *create(const QString &code,
const std::list< QString > &args);
virtual EventCreatorBase< Base > *clone();
};
......@@ -69,17 +69,17 @@ public:
/**
* Ask for a new object linked to the string.
*/
Base *create(const std::string &code,
const std::list< std::string > &args);
Base *create(const QString &code,
const std::list< QString > &args);
/**
* Register the string to return a Actual type.
*/
template< typename Actual >
void registerEvent(const std::string &code);
void registerEvent(const QString &code);
private:
std::map< std::string, EventCreatorBase< Base > * > mEventCreators;
std::map< QString, EventCreatorBase< Base > * > mEventCreators;
};
#include "EventFactory.inl"
......
......@@ -27,8 +27,8 @@
template< typename Base, typename Actual >
Actual *
EventCreator< Base, Actual >::create(const std::string &code,
const std::list< std::string > &args)
EventCreator< Base, Actual >::create(const QString &code,
const std::list< QString > &args)
{
return new Actual(code, args);
}
......@@ -42,12 +42,12 @@ EventCreator< Base, Actual >::clone()
template< typename Base >
Base *
EventFactoryImpl< Base >::create(const std::string &code,
const std::list< std::string > &args)
EventFactoryImpl< Base >::create(const QString &code,
const std::list< QString > &args)
{
typename std::map< std::string, EventCreatorBase< Base > * >::iterator pos = mEventCreators.find(code);
typename std::map< QString, EventCreatorBase< Base > * >::iterator pos = mEventCreators.find(code);
if(pos == mEventCreators.end()) {
_debug("The code %s has no creator registered.", code.c_str());
_debug("The code %s has no creator registered.", code.toStdString().c_str());
}
return pos->second->create(code, args);
......@@ -56,7 +56,7 @@ EventFactoryImpl< Base >::create(const std::string &code,
template< typename Base >
template< typename Actual >
void
EventFactoryImpl< Base >::registerEvent(const std::string &code)
EventFactoryImpl< Base >::registerEvent(const QString &code)
{
if(mEventCreators.find(code) != mEventCreators.end()) {
delete mEventCreators[code];
......
......@@ -23,7 +23,7 @@
#include <list>
#include <map>
#include <string>
#include <QString>
/**
* This is the base class that we will use to
......@@ -34,9 +34,9 @@ class ObjectCreatorBase
{
public:
virtual ~ObjectCreatorBase(){}
virtual Base *create(const std::string &command,
const std::string &sequenceId,
const std::list< std::string > &args) = 0;
virtual Base *create(const QString &command,
const QString &sequenceId,
const std::list< QString > &args) = 0;
virtual ObjectCreatorBase *clone() = 0;
};
......@@ -49,9 +49,9 @@ template< typename Base, typename Actual >
class ObjectCreator : public ObjectCreatorBase< Base >
{
public:
virtual Actual *create(const std::string &command,
const std::string &sequenceId,
const std::list< std::string > &args);
virtual Actual *create(const QString &command,
const QString &sequenceId,
const std::list< QString > &args);
virtual ObjectCreatorBase< Base > *clone();
};
......@@ -69,18 +69,18 @@ public:
/**
* Ask for a new object linked to the string.
*/
Base *create(const std::string &requestname,
const std::string &sequenceId,
const std::list< std::string > &args);
Base *create(const QString &requestname,
const QString &sequenceId,
const std::list< QString > &args);
/**
* Register the string to return a Actual type.
*/
template< typename Actual >
void registerObject(const std::string &name);