Vidalia  0.2.17
ControlMethod.cpp
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file ControlMethod.cpp
00013 ** \brief Class for specifying which method is used to communicate to Tor
00014 */
00015 
00016 #include "ControlMethod.h"
00017 
00018 QString
00019 ControlMethod::toString(ControlMethod::Method method)
00020 {
00021   QString str = "";
00022   switch(method) {
00023     case ControlMethod::Port:
00024       str = "ControlPort";
00025       break;
00026 
00027     case ControlMethod::Socket:
00028       str = "ControlSocket";
00029       break;
00030   }
00031 
00032   return str;
00033 }
00034 
00035 ControlMethod::Method 
00036 ControlMethod::fromString(QString method)
00037 {
00038   if(method == QString("ControlPort"))
00039     return ControlMethod::Port;
00040   else if(method == QString("ControlSocket"))
00041     return ControlMethod::Socket;
00042 }