Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > 9601c7beb4ff23e834bfa171795ed560 > files > 283

vidalia-0.2.9-1mdv2010.1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Vidalia: Service.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_b47abd1aad201a152869566145babb61.html">src</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_695ba8f8357372e02d38c40b3c6dbe81.html">vidalia</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_738aec08306f4b898e01f7a551299457.html">config</a>
  </div>
</div>
<div class="contents">
<h1>Service.cpp</h1><a href="_service_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">**  This file is part of Vidalia, and is subject to the license terms in the</span>
<a name="l00003"></a>00003 <span class="comment">**  LICENSE file, found in the top level directory of this distribution. If you</span>
<a name="l00004"></a>00004 <span class="comment">**  did not receive the LICENSE file with this file, you may obtain it from the</span>
<a name="l00005"></a>00005 <span class="comment">**  Vidalia source package distributed by the Vidalia Project at</span>
<a name="l00006"></a>00006 <span class="comment">**  http://www.vidalia-project.net/. No part of Vidalia, including this file,</span>
<a name="l00007"></a>00007 <span class="comment">**  may be copied, modified, propagated, or distributed except according to the</span>
<a name="l00008"></a>00008 <span class="comment">**  terms described in the LICENSE file.</span>
<a name="l00009"></a>00009 <span class="comment">*/</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;<a class="code" href="_service_8h.html">Service.h</a>&quot;</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">/** Default Constructor */</span>
<a name="l00015"></a><a class="code" href="class_service.html#acc246c9f7ed3c51e2d91d10fe257513f">00015</a> <a class="code" href="class_service.html#acc246c9f7ed3c51e2d91d10fe257513f">Service::Service</a>()
<a name="l00016"></a>00016 {
<a name="l00017"></a>00017 }
<a name="l00018"></a>00018 <span class="comment"></span>
<a name="l00019"></a>00019 <span class="comment">/** Constructor to create a new Service with initial settings */</span>
<a name="l00020"></a><a class="code" href="class_service.html#ab469e3f3ff5cb6c24146dac07c8830d8">00020</a> <a class="code" href="class_service.html#acc246c9f7ed3c51e2d91d10fe257513f">Service::Service</a>(QString serviceAddress, QString virtualPort,
<a name="l00021"></a>00021  QString physicalAddressPort, QString serviceDirectory, <span class="keywordtype">bool</span> enabled)
<a name="l00022"></a>00022 {
<a name="l00023"></a>00023   <a class="code" href="class_service.html#ac5a275edff8388b1f008eef54fc24832">_serviceAddress</a> = serviceAddress;
<a name="l00024"></a>00024   <a class="code" href="class_service.html#a9078c614529b395b8a5909d0ccf68b28">_virtualPort</a> = virtualPort;
<a name="l00025"></a>00025   <a class="code" href="class_service.html#add804af423f30e80038bce290542b1b4">_physicalAddressPort</a> = physicalAddressPort;
<a name="l00026"></a>00026   <a class="code" href="class_service.html#a1a2a554a4078585139d48f6c9f624781">_serviceDirectory</a> = serviceDirectory;
<a name="l00027"></a>00027   <a class="code" href="class_service.html#ade2a8e62b4b91a888a2b37389e508702">_enabled</a> = enabled;
<a name="l00028"></a>00028 }
<a name="l00029"></a>00029 <span class="comment"></span>
<a name="l00030"></a>00030 <span class="comment">/** Destructor */</span>
<a name="l00031"></a><a class="code" href="class_service.html#af6c3577b59652ac817d1d76aaccee904">00031</a> <a class="code" href="class_service.html#af6c3577b59652ac817d1d76aaccee904">Service::~Service</a>()
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034 <span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment">/** Sets the deploy status of a service */</span>
<a name="l00036"></a><a class="code" href="class_service.html#a1764fb4b447daa44741d09f0d88dc336">00036</a> <span class="keywordtype">void</span> <a class="code" href="class_service.html#a1764fb4b447daa44741d09f0d88dc336">Service::setEnabled</a>(<span class="keywordtype">bool</span> enabled)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038   <a class="code" href="class_service.html#ade2a8e62b4b91a888a2b37389e508702">_enabled</a> = enabled;
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 <span class="comment"></span>
<a name="l00041"></a>00041 <span class="comment">/** Sets the adress of a service */</span>
<a name="l00042"></a><a class="code" href="class_service.html#a37fcb4c961ec93a75959d3aa15350c36">00042</a> <span class="keywordtype">void</span> <a class="code" href="class_service.html#a37fcb4c961ec93a75959d3aa15350c36">Service::setServiceAddress</a>(QString serviceAddress)
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   <a class="code" href="class_service.html#ac5a275edff8388b1f008eef54fc24832">_serviceAddress</a> = serviceAddress;
<a name="l00045"></a>00045 }
<a name="l00046"></a>00046 <span class="comment"></span>
<a name="l00047"></a>00047 <span class="comment">/** Sets the virtualPort of a service */</span>
<a name="l00048"></a><a class="code" href="class_service.html#a18d8888704b5ea541ca4c2044e71fe7f">00048</a> <span class="keywordtype">void</span> <a class="code" href="class_service.html#a18d8888704b5ea541ca4c2044e71fe7f">Service::setVirtualPort</a>(QString virtualPort)
<a name="l00049"></a>00049 {
<a name="l00050"></a>00050   <a class="code" href="class_service.html#a9078c614529b395b8a5909d0ccf68b28">_virtualPort</a> = virtualPort;
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052 <span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">/** Sets the physical Adress and the local port of a service */</span>
<a name="l00054"></a><a class="code" href="class_service.html#a96bcc6eb04e84dd8cefa764e30f32c86">00054</a> <span class="keywordtype">void</span> <a class="code" href="class_service.html#a96bcc6eb04e84dd8cefa764e30f32c86">Service::setPhysicalAddressPort</a>(QString physicalAddressPort)
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056   <a class="code" href="class_service.html#add804af423f30e80038bce290542b1b4">_physicalAddressPort</a> = physicalAddressPort;
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058 <span class="comment"></span>
<a name="l00059"></a>00059 <span class="comment">/** Sets the service directory of a service */</span>
<a name="l00060"></a><a class="code" href="class_service.html#a3afd6a55ad5b67873e761048f5219a5a">00060</a> <span class="keywordtype">void</span> <a class="code" href="class_service.html#a3afd6a55ad5b67873e761048f5219a5a">Service::setServiceDirectory</a>(QString serviceDirectory)
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062   <a class="code" href="class_service.html#a1a2a554a4078585139d48f6c9f624781">_serviceDirectory</a> = serviceDirectory;
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064 <span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment">/** Sets the additional options of a service e.g. excludeNodes */</span>
<a name="l00066"></a><a class="code" href="class_service.html#a13110e175d38f18fadbee75a3e97988b">00066</a> <span class="keywordtype">void</span> <a class="code" href="class_service.html#a13110e175d38f18fadbee75a3e97988b">Service::setAdditionalServiceOptions</a>(QString options)
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068   <a class="code" href="class_service.html#ab609a784c85c35f19112eb3d7bfbac04">_additionalServiceOptions</a> = options;
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 <span class="comment"></span>
<a name="l00071"></a>00071 <span class="comment">/** Writes service class data from &lt;b&gt;myObj&lt;/b&gt; to the QDataStream</span>
<a name="l00072"></a>00072 <span class="comment"> * &lt;b&gt;out&lt;/b&gt;. */</span>
<a name="l00073"></a><a class="code" href="_service_8cpp.html#a8e330dcc8ca3e2fa1f31b4a913342dcf">00073</a> QDataStream&amp;<a class="code" href="_service_8cpp.html#a8e330dcc8ca3e2fa1f31b4a913342dcf">operator&lt;&lt;</a>(QDataStream &amp;out, <span class="keyword">const</span> <a class="code" href="class_service.html">Service</a> &amp;myObj)
<a name="l00074"></a>00074 {
<a name="l00075"></a>00075   out &lt;&lt; myObj.<a class="code" href="class_service.html#a3a2658b480a8e85624a2489620874bce">serviceAddress</a>();
<a name="l00076"></a>00076   out &lt;&lt; myObj.<a class="code" href="class_service.html#aea9c2bece5e597613aa38ac0930a7e77">virtualPort</a>();
<a name="l00077"></a>00077   out &lt;&lt; myObj.<a class="code" href="class_service.html#a3a6c7c4f2726761e319b5f14a545b5d6">physicalAddressPort</a>();
<a name="l00078"></a>00078   out &lt;&lt; myObj.<a class="code" href="class_service.html#a637c140798a9fd640915781fe1828907">serviceDirectory</a>();
<a name="l00079"></a>00079   out &lt;&lt; myObj.<a class="code" href="class_service.html#aef9f50c7e6b18fd504ed8e1a68f2a46c">enabled</a>();
<a name="l00080"></a>00080   out &lt;&lt; myObj.<a class="code" href="class_service.html#a3cb14491d454716b934a858c4b2b86de">additionalServiceOptions</a>();
<a name="l00081"></a>00081 
<a name="l00082"></a>00082   <span class="keywordflow">return</span> out;
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 <span class="comment"></span>
<a name="l00085"></a>00085 <span class="comment">/** Reads service class data in from the QDataStream &lt;b&gt;in&lt;/b&gt; and</span>
<a name="l00086"></a>00086 <span class="comment"> populates * the &lt;b&gt;myObj&lt;/b&gt; object accordingly. */</span>
<a name="l00087"></a><a class="code" href="_service_8cpp.html#a7a67d278b3544843cc60663920e7dd25">00087</a> QDataStream&amp;<a class="code" href="_service_8cpp.html#a7a67d278b3544843cc60663920e7dd25">operator&gt;&gt;</a>(QDataStream &amp;in, <a class="code" href="class_service.html">Service</a> &amp;myObj)
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089   QString serviceAddress;
<a name="l00090"></a>00090   QString virtualPort;
<a name="l00091"></a>00091   QString physicalAddressPort;
<a name="l00092"></a>00092   QString serviceDirectory;
<a name="l00093"></a>00093   <span class="keywordtype">bool</span> enabled;
<a name="l00094"></a>00094   QString additionalServiceOptions;
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="comment">/* Read in from the data stream */</span>
<a name="l00097"></a>00097   in &gt;&gt; serviceAddress &gt;&gt; virtualPort  &gt;&gt; physicalAddressPort
<a name="l00098"></a>00098    &gt;&gt; serviceDirectory &gt;&gt; enabled &gt;&gt; additionalServiceOptions;
<a name="l00099"></a>00099 
<a name="l00100"></a>00100   <span class="comment">/* Set the appropriate class member variables */</span>
<a name="l00101"></a>00101   myObj.<a class="code" href="class_service.html#a37fcb4c961ec93a75959d3aa15350c36">setServiceAddress</a>(serviceAddress);
<a name="l00102"></a>00102   myObj.<a class="code" href="class_service.html#a18d8888704b5ea541ca4c2044e71fe7f">setVirtualPort</a>(virtualPort);
<a name="l00103"></a>00103   myObj.<a class="code" href="class_service.html#a96bcc6eb04e84dd8cefa764e30f32c86">setPhysicalAddressPort</a>(physicalAddressPort);
<a name="l00104"></a>00104   myObj.<a class="code" href="class_service.html#a3afd6a55ad5b67873e761048f5219a5a">setServiceDirectory</a>(serviceDirectory);
<a name="l00105"></a>00105   myObj.<a class="code" href="class_service.html#a1764fb4b447daa44741d09f0d88dc336">setEnabled</a>(enabled);
<a name="l00106"></a>00106   myObj.<a class="code" href="class_service.html#a13110e175d38f18fadbee75a3e97988b">setAdditionalServiceOptions</a>(additionalServiceOptions);
<a name="l00107"></a>00107 
<a name="l00108"></a>00108   <span class="comment">/* Return the updated data stream */</span>
<a name="l00109"></a>00109   <span class="keywordflow">return</span> in;
<a name="l00110"></a>00110 }
<a name="l00111"></a>00111 <span class="comment"></span>
<a name="l00112"></a>00112 <span class="comment">/** Creates a string by concatenating the values of the service. */</span>
<a name="l00113"></a>00113 QString
<a name="l00114"></a><a class="code" href="class_service.html#a6e895467f1c027bcb087b9368000d4cf">00114</a> <a class="code" href="class_service.html#a6e895467f1c027bcb087b9368000d4cf">Service::toString</a>()
<a name="l00115"></a>00115 {
<a name="l00116"></a>00116   <span class="keywordflow">return</span> <a class="code" href="class_service.html#ac5a275edff8388b1f008eef54fc24832">_serviceAddress</a> +<span class="stringliteral">&quot;#&quot;</span>+ <a class="code" href="class_service.html#a9078c614529b395b8a5909d0ccf68b28">_virtualPort</a> +<span class="stringliteral">&quot;#&quot;</span>+  <a class="code" href="class_service.html#add804af423f30e80038bce290542b1b4">_physicalAddressPort</a> +
<a name="l00117"></a>00117     <span class="stringliteral">&quot;#&quot;</span>+ <a class="code" href="class_service.html#a1a2a554a4078585139d48f6c9f624781">_serviceDirectory</a> +<span class="stringliteral">&quot;#&quot;</span>+  <a class="code" href="class_service.html#ade2a8e62b4b91a888a2b37389e508702">_enabled</a> + <span class="stringliteral">&quot;#&quot;</span>+ <a class="code" href="class_service.html#ab609a784c85c35f19112eb3d7bfbac04">_additionalServiceOptions</a>;
<a name="l00118"></a>00118 }
<a name="l00119"></a>00119 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Aug 30 22:58:54 2010 for Vidalia by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>