[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2170: Some more const cleanups. (in trunk: . src/control)
Author: edmanm
Date: 2007-12-04 12:39:35 -0500 (Tue, 04 Dec 2007)
New Revision: 2170
Modified:
trunk/
trunk/src/control/torevents.cpp
trunk/src/control/torevents.h
Log:
r2213@lysithea: edmanm | 2007-12-04 02:43:57 -0500
Some more const cleanups.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2213] on 0108964c-5b0b-4c9e-969f-e2288315d100
Modified: trunk/src/control/torevents.cpp
===================================================================
--- trunk/src/control/torevents.cpp 2007-12-02 20:28:56 UTC (rev 2169)
+++ trunk/src/control/torevents.cpp 2007-12-04 17:39:35 UTC (rev 2170)
@@ -139,10 +139,9 @@
/** Converts an event in the string form sent by Tor to its enum value */
TorEvents::TorEvent
-TorEvents::toTorEvent(QString event)
+TorEvents::toTorEvent(const QString &event)
{
TorEvent e;
- event = event.toUpper();
if (event == "BW") {
e = Bandwidth;
} else if (event == "CIRC") {
@@ -180,7 +179,7 @@
/** Parse the event type out of a message line and return the corresponding
* Event enum value */
TorEvents::TorEvent
-TorEvents::parseEventType(ReplyLine line)
+TorEvents::parseEventType(const ReplyLine &line)
{
QString msg = line.getMessage();
int i = msg.indexOf(" ");
@@ -191,7 +190,7 @@
* more than one line, so we will iterate through them all and dispatch the
* necessary events. */
void
-TorEvents::handleEvent(ControlReply reply)
+TorEvents::handleEvent(const ControlReply &reply)
{
foreach(ReplyLine line, reply.getLines()) {
switch (parseEventType(line)) {
@@ -228,7 +227,7 @@
* BytesWritten = 1*DIGIT
*/
void
-TorEvents::handleBandwidthUpdate(ReplyLine line)
+TorEvents::handleBandwidthUpdate(const ReplyLine &line)
{
QStringList msg = line.getMessage().split(" ");
if (msg.size() >= 3) {
@@ -252,7 +251,7 @@
* Path = ServerID *("," ServerID)
*/
void
-TorEvents::handleCircuitStatus(ReplyLine line)
+TorEvents::handleCircuitStatus(const ReplyLine &line)
{
QString msg = line.getMessage().trimmed();
int i = msg.indexOf(" ") + 1;
@@ -279,7 +278,7 @@
* If the circuit ID is 0, then the stream is unattached.
*/
void
-TorEvents::handleStreamStatus(ReplyLine line)
+TorEvents::handleStreamStatus(const ReplyLine &line)
{
QString msg = line.getMessage().trimmed();
int i = msg.indexOf(" ") + 1;
@@ -298,7 +297,7 @@
* Severity = "DEBUG" / "INFO" / "NOTICE" / "WARN"/ "ERR"
*/
void
-TorEvents::handleLogMessage(ReplyLine line)
+TorEvents::handleLogMessage(const ReplyLine &line)
{
QString msg = line.getMessage();
int i = msg.indexOf(" ");
@@ -324,7 +323,7 @@
* case we don't know what server it is yet, so we use Address:Port.
*/
void
-TorEvents::handleOrConnStatus(ReplyLine line)
+TorEvents::handleOrConnStatus(const ReplyLine &line)
{
QStringList msg = line.getMessage().split(" ");
if (msg.size() >= 3) {
@@ -339,7 +338,7 @@
* "650" SP "NEWDESC" 1*(SP ServerID)
*/
void
-TorEvents::handleNewDescriptor(ReplyLine line)
+TorEvents::handleNewDescriptor(const ReplyLine &line)
{
QString descs = line.getMessage();
QStringList descList = descs.mid(descs.indexOf(" ")+1).split(" ");
@@ -357,7 +356,7 @@
* Expiry is expressed as the local time (rather than GMT).
*/
void
-TorEvents::handleAddressMap(ReplyLine line)
+TorEvents::handleAddressMap(const ReplyLine &line)
{
QStringList msg = line.getMessage().split(" ");
if (msg.size() >= 4) {
@@ -382,7 +381,7 @@
* StatusValue = 1*(ALNUM / '_') / QuotedString
*/
void
-TorEvents::handleStatusEvent(TorEvent type, ReplyLine line)
+TorEvents::handleStatusEvent(TorEvent type, const ReplyLine &line)
{
QString status;
StatusEvent::Severity severity;
Modified: trunk/src/control/torevents.h
===================================================================
--- trunk/src/control/torevents.h 2007-12-02 20:28:56 UTC (rev 2169)
+++ trunk/src/control/torevents.h 2007-12-04 17:39:35 UTC (rev 2170)
@@ -78,7 +78,7 @@
QList<TorEvent> eventList();
/** Parses an event message and emits the proper signal */
- void handleEvent(ControlReply reply);
+ void handleEvent(const ControlReply &reply);
/** Dispatches a given event to all its handler targets. */
void dispatch(TorEvent e, QEvent *event);
@@ -95,26 +95,26 @@
QMultiHash<TorEvent, QObject*> _eventList;
/** Parses the event type from the event message */
- static TorEvent parseEventType(ReplyLine line);
+ static TorEvent parseEventType(const ReplyLine &line);
/** Converts a string to an Event */
- static TorEvent toTorEvent(QString event);
+ static TorEvent toTorEvent(const QString &event);
/** Handle a bandwidth update event */
- void handleBandwidthUpdate(ReplyLine line);
+ void handleBandwidthUpdate(const ReplyLine &line);
/** Handle a circuit status event */
- void handleCircuitStatus(ReplyLine line);
+ void handleCircuitStatus(const ReplyLine &line);
/** Handle a stream status event */
- void handleStreamStatus(ReplyLine line);
+ void handleStreamStatus(const ReplyLine &line);
/** Handle a log message event */
- void handleLogMessage(ReplyLine line);
+ void handleLogMessage(const ReplyLine &line);
/** Handle an OR connection status event. */
- void handleOrConnStatus(ReplyLine line);
+ void handleOrConnStatus(const ReplyLine &line);
/** Handles a new list of descriptors event. */
- void handleNewDescriptor(ReplyLine line);
+ void handleNewDescriptor(const ReplyLine &line);
/** Handles a new or updated address map event. */
- void handleAddressMap(ReplyLine line);
+ void handleAddressMap(const ReplyLine &line);
/** Handles a Tor status event. */
- void handleStatusEvent(TorEvent type, ReplyLine line);
+ void handleStatusEvent(TorEvent type, const ReplyLine &line);
/** Parses and posts a Tor client status event. */
void dispatchClientStatusEvent(StatusEvent::Severity severity,