Skip to content

Commit

Permalink
Use 'const QString&' for parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedcharles committed Oct 4, 2014
1 parent d87a6db commit ee61b80
Show file tree
Hide file tree
Showing 45 changed files with 468 additions and 465 deletions.
10 changes: 5 additions & 5 deletions src/ActionUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

using namespace std;

void ActionUnit::_uninstall( TAction * pChild, QString packageName )
void ActionUnit::_uninstall( TAction * pChild, const QString& packageName )
{
list<TAction*> * childrenList = pChild->mpMyChildrenList;
for(auto it2 = childrenList->begin(); it2 != childrenList->end(); it2++)
Expand All @@ -45,7 +45,7 @@ void ActionUnit::_uninstall( TAction * pChild, QString packageName )
}


void ActionUnit::uninstall( QString packageName )
void ActionUnit::uninstall(const QString& packageName )
{
for(auto it = mActionRootNodeList.begin(); it != mActionRootNodeList.end(); it ++ )
{
Expand Down Expand Up @@ -76,7 +76,7 @@ void ActionUnit::compileAll()
}
}

TAction * ActionUnit::findAction( QString & name )
TAction * ActionUnit::findAction(const QString & name )
{
//QMap<int, TAction *> mActionMap;

Expand Down Expand Up @@ -440,7 +440,7 @@ TAction * ActionUnit::getHeadAction( TToolBar * pT )
return 0;
}

void ActionUnit::showToolBar( QString & name )
void ActionUnit::showToolBar(const QString & name )
{
for(auto it = mEasyButtonBarList.begin(); it!=mEasyButtonBarList.end(); it++ )
{
Expand All @@ -454,7 +454,7 @@ void ActionUnit::showToolBar( QString & name )
mpHost->mpConsole->mpCommandLine->setFocus();
}

void ActionUnit::hideToolBar( QString & name )
void ActionUnit::hideToolBar(const QString & name )
{
for(auto it = mEasyButtonBarList.begin(); it!=mEasyButtonBarList.end(); it++ )
{
Expand Down
12 changes: 6 additions & 6 deletions src/ActionUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ class ActionUnit
ActionUnit( Host * pHost ) : mpHost(pHost), mMaxID(0) {;}
std::list<TAction *> getActionRootNodeList() { QMutexLocker locker(& mActionUnitLock); return mActionRootNodeList; }
TAction * getAction( int id );
TAction * findAction( QString & );
TAction * findAction(const QString & );
void compileAll();
bool registerAction( TAction * pT );
void unregisterAction( TAction * pT );
void reParentAction( int childID, int oldParentID, int newParentID, int parentPostion = -1, int childPosition = -1 );
qint64 getNewID();
void uninstall( QString );
void _uninstall( TAction * pChild, QString packageName );
void uninstall(const QString& );
void _uninstall( TAction * pChild, const QString& packageName );
void updateToolbar();
std::list<TToolBar *> getToolBarList();
std::list<TEasyButtonBar *> getEasyButtonBarList();
TAction * getHeadAction( TToolBar * );
TAction * getHeadAction( TEasyButtonBar * );
void processDataStream( QString & );
void processDataStream(const QString & );
void constructToolbar( TAction *, mudlet * pMainWindow, TToolBar * pTB );
void constructToolbar( TAction *, mudlet * pMainWindow, TEasyButtonBar * pTB );
void showToolBar( QString & );
void hideToolBar( QString & );
void showToolBar(const QString & );
void hideToolBar(const QString & );

QMutex mActionUnitLock;
QList<TAction*> uninstallList;
Expand Down
10 changes: 5 additions & 5 deletions src/AliasUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ qint64 AliasUnit::getNewID()
return ++mMaxID;
}

bool AliasUnit::processDataStream( QString & data )
bool AliasUnit::processDataStream( const QString & data )
{
TLuaInterpreter * Lua = mpHost->getLuaInterpreter();
QString lua_command_string = "command";
Expand Down Expand Up @@ -303,7 +303,7 @@ void AliasUnit::reenableAllTriggers()
}
}

TAlias * AliasUnit::findAlias( QString & name )
TAlias * AliasUnit::findAlias(const QString & name )
{
//TAlias * pT = 0;
QMap<QString, TAlias *>::const_iterator it = mLookupTable.find( name );
Expand All @@ -315,7 +315,7 @@ TAlias * AliasUnit::findAlias( QString & name )
return 0;
}

bool AliasUnit::enableAlias( QString & name )
bool AliasUnit::enableAlias(const QString & name )
{
bool found = false;
QMap<QString, TAlias *>::const_iterator it = mLookupTable.find( name );
Expand All @@ -329,7 +329,7 @@ bool AliasUnit::enableAlias( QString & name )
return found;
}

bool AliasUnit::disableAlias( QString & name )
bool AliasUnit::disableAlias(const QString & name )
{
bool found = false;
QMap<QString, TAlias *>::const_iterator it = mLookupTable.find( name );
Expand All @@ -344,7 +344,7 @@ bool AliasUnit::disableAlias( QString & name )
}


bool AliasUnit::killAlias( QString & name )
bool AliasUnit::killAlias(const QString & name )
{
for(auto it = mAliasRootNodeList.begin(); it != mAliasRootNodeList.end(); it++)
{
Expand Down
10 changes: 5 additions & 5 deletions src/AliasUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ class AliasUnit
std::list<TAlias *> getAliasRootNodeList() { return mAliasRootNodeList; }
TAlias * getAlias( int id );
void compileAll();
TAlias * findAlias( QString & name );
bool enableAlias( QString & );
bool disableAlias( QString & );
bool killAlias( QString & name );
TAlias * findAlias(const QString & name );
bool enableAlias(const QString & );
bool disableAlias(const QString & );
bool killAlias(const QString & name );
bool registerAlias( TAlias * pT );
void unregisterAlias( TAlias * pT );
void uninstall( QString );
void _uninstall( TAlias * pChild, QString packageName );
void reParentAlias( int childID, int oldParentID, int newParentID, int parentPosition = -1, int childPosition = -1 );
bool processDataStream( QString & );
bool processDataStream(const QString & );
void setAliasStayOpen( QString, int );
void stopAllTriggers();
void reenableAllTriggers();
Expand Down
2 changes: 1 addition & 1 deletion src/FontManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void FontManager::addFonts()
}

// loads all of the fonts in the given folder
void FontManager::loadFonts(QString folder)
void FontManager::loadFonts(const QString& folder)
{
// Check what happens with this: "Adding application fonts on Unix/X11 platforms without fontconfig is currently not supported."
QStringList filters;
Expand Down
5 changes: 4 additions & 1 deletion src/FontManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/


class QString;


class FontManager
{
public:
void addFonts();
void loadFonts(QString folder);
private:
void loadFonts(const QString& folder);
};

#endif // MUDLET_FONTMANAGER_H
40 changes: 20 additions & 20 deletions src/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <errno.h>


Host::Host( int port, QString hostname, QString login, QString pass, int id )
Host::Host( int port, const QString& hostname, const QString& login, const QString& pass, int id )
: mTelnet( this )
, mpConsole( 0 )
, mLuaInterpreter ( this, id )
Expand Down Expand Up @@ -298,7 +298,7 @@ void Host::saveModules(int sync)
}
}

void Host::reloadModule(QString moduleName)
void Host::reloadModule(const QString& moduleName)
{
QMap<QString, QStringList> installedModules = mInstalledModules;
QMapIterator<QString, QStringList> it(installedModules);
Expand Down Expand Up @@ -416,7 +416,7 @@ void Host::adjustNAWS()
mTelnet.setDisplayDimensions();
}

void Host::setReplacementCommand( QString s )
void Host::setReplacementCommand(const QString& s )
{
mReplacementCommand = s;
}
Expand Down Expand Up @@ -576,7 +576,7 @@ void Host::callEventHandlers()

}

void Host::incomingStreamProcessor( QString & data, int line )
void Host::incomingStreamProcessor(const QString & data, int line )
{
mTriggerUnit.processDataStream( data, line );

Expand All @@ -587,7 +587,7 @@ void Host::incomingStreamProcessor( QString & data, int line )
}
}

void Host::registerEventHandler( QString name, TScript * pScript )
void Host::registerEventHandler(const QString& name, TScript * pScript )
{
if( mEventHandlerMap.contains( name ) )
{
Expand All @@ -603,7 +603,7 @@ void Host::registerEventHandler( QString name, TScript * pScript )
mEventHandlerMap.insert( name, scriptList );
}
}
void Host::registerAnonymousEventHandler( QString name, QString fun )
void Host::registerAnonymousEventHandler(const QString& name, const QString& fun )
{

if( mAnonymousEventHandlerFunctions.contains( name ) )
Expand All @@ -621,7 +621,7 @@ void Host::registerAnonymousEventHandler( QString name, QString fun )
}
}

void Host::unregisterEventHandler( QString name, TScript * pScript )
void Host::unregisterEventHandler(const QString & name, TScript * pScript )
{
if( mEventHandlerMap.contains( name ) )
{
Expand Down Expand Up @@ -650,7 +650,7 @@ void Host::raiseEvent( const TEvent & pE )
}
}

void Host::postIrcMessage( QString a, QString b, QString c )
void Host::postIrcMessage(const QString& a, const QString& b, const QString& c )
{
TEvent pE;
pE.mArgumentList << "sysIrcMessage";
Expand All @@ -659,43 +659,43 @@ void Host::postIrcMessage( QString a, QString b, QString c )
raiseEvent( pE );
}

void Host::enableTimer( QString & name )
void Host::enableTimer(const QString & name )
{
mTimerUnit.enableTimer( name );
}

void Host::disableTimer( QString & name )
void Host::disableTimer(const QString & name )
{
mTimerUnit.disableTimer( name );
}

bool Host::killTimer( QString & name )
bool Host::killTimer(const QString & name )
{
return mTimerUnit.killTimer( name );
}

void Host::enableKey( QString & name )
void Host::enableKey(const QString & name )
{
mKeyUnit.enableKey( name );
}

void Host::disableKey( QString & name )
void Host::disableKey(const QString & name )
{
mKeyUnit.disableKey( name );
}


void Host::enableTrigger( QString & name )
void Host::enableTrigger(const QString & name )
{
mTriggerUnit.enableTrigger( name );
}

void Host::disableTrigger( QString & name )
void Host::disableTrigger(const QString & name )
{
mTriggerUnit.disableTrigger( name );
}

bool Host::killTrigger( QString & name )
bool Host::killTrigger(const QString & name )
{
return mTriggerUnit.killTrigger( name );
}
Expand Down Expand Up @@ -780,7 +780,7 @@ void Host::showUnpackingProgress( QString txt )
QApplication::sendPostedEvents();
}

bool Host::installPackage( QString fileName, int module )
bool Host::installPackage(const QString& fileName, int module )
{

// Module notes:
Expand Down Expand Up @@ -1051,7 +1051,7 @@ bool Host::installPackage( QString fileName, int module )
}

// credit: http://john.nachtimwald.com/2010/06/08/qt-remove-directory-and-its-contents/
bool Host::removeDir( const QString dirName, QString originalPath )
bool Host::removeDir( const QString& dirName, const QString& originalPath )
{
bool result = true;
QDir dir(dirName);
Expand Down Expand Up @@ -1080,7 +1080,7 @@ bool Host::removeDir( const QString dirName, QString originalPath )
return result;
}

bool Host::uninstallPackage( QString packageName, int module)
bool Host::uninstallPackage(const QString& packageName, int module)
{

// As with the installPackage, the module codes are:
Expand Down Expand Up @@ -1173,7 +1173,7 @@ bool Host::uninstallPackage( QString packageName, int module)
return true;
}

void Host::readPackageConfig( QString luaConfig, QString & packageName )
void Host::readPackageConfig(const QString& luaConfig, QString & packageName )
{

QFile configFile(luaConfig);
Expand Down
Loading

0 comments on commit ee61b80

Please sign in to comment.