<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>EOSKernel: VariantData.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.7 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</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>Globals</span></a></li>
    </ul>
  </div>
<h1>VariantData.h</h1><a href="VariantData_8h.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">-----------------------------------------------------------------------------</span>
<a name="l00003"></a>00003 <span class="comment">This source file is part of EOS Multimedia Scripting System</span>
<a name="l00004"></a>00004 <span class="comment">For the latest info, see https://sourceforge.net/projects/eos-scripting/</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment">Copyright (c) 2009-2013 of Salvatore Carotenuto aka ultimoistante</span>
<a name="l00007"></a>00007 <span class="comment">                          (mailto: ultimoistante@gmail.com)</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span>
<a name="l00010"></a>00010 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span>
<a name="l00011"></a>00011 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span>
<a name="l00012"></a>00012 <span class="comment">version.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span>
<a name="l00015"></a>00015 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span>
<a name="l00016"></a>00016 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"></span>
<a name="l00018"></a>00018 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span>
<a name="l00019"></a>00019 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span>
<a name="l00020"></a>00020 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span>
<a name="l00021"></a>00021 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span>
<a name="l00022"></a>00022 <span class="comment">-----------------------------------------------------------------------------</span>
<a name="l00023"></a>00023 <span class="comment">*/</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#ifndef EOS_KERNEL_VARIANTDATA_H</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define EOS_KERNEL_VARIANTDATA_H</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="VariantData_8h.html#a45d5f4cb80bd115ba76212f4d20f4a1">00030</a> <span class="preprocessor">#define VARIANT_TYPE_BOOLEAN    1</span>
<a name="l00031"></a><a class="code" href="VariantData_8h.html#0ce33fe2a40e00fd5179d0ab495d3287">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define VARIANT_TYPE_NUMERIC    2</span>
<a name="l00032"></a><a class="code" href="VariantData_8h.html#6b816ffa55ee4ab44f3fff0cf168f5ab">00032</a> <span class="preprocessor"></span><span class="preprocessor">#define VARIANT_TYPE_STRING     3</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00037"></a><a class="code" href="classVariantData.html">00037</a> <span class="keyword">class </span><a class="code" href="classVariantData.html" title="Class used to handle Lua Variant (boolean/numeric/string) data in EOS Kernel.">VariantData</a>
<a name="l00038"></a>00038     {
<a name="l00039"></a>00039     <span class="keyword">public</span>:
<a name="l00040"></a><a class="code" href="classVariantData.html#90e5e3c8c2e17774418b3c5de03d24c4">00040</a>         <a class="code" href="classVariantData.html#90e5e3c8c2e17774418b3c5de03d24c4">VariantData</a>(<span class="keywordtype">bool</span> value)        { <a class="code" href="classVariantData.html#d4ee952cc8ced49176df1d773dec64dd">setValue</a>(value); }
<a name="l00041"></a><a class="code" href="classVariantData.html#1eccb0ef55abb0849460e289364fa8a1">00041</a>         <a class="code" href="classVariantData.html#1eccb0ef55abb0849460e289364fa8a1">VariantData</a>(<span class="keywordtype">double</span> value)      { <a class="code" href="classVariantData.html#d4ee952cc8ced49176df1d773dec64dd">setValue</a>(value); }
<a name="l00042"></a><a class="code" href="classVariantData.html#033f281690c41ecb8529d5ec4dcee50f">00042</a>         <a class="code" href="classVariantData.html#033f281690c41ecb8529d5ec4dcee50f">VariantData</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* value) { <a class="code" href="classVariantData.html#d4ee952cc8ced49176df1d773dec64dd">setValue</a>(value); }
<a name="l00043"></a>00043         <span class="comment">//</span>
<a name="l00044"></a><a class="code" href="classVariantData.html#d4ee952cc8ced49176df1d773dec64dd">00044</a>         <span class="keywordtype">void</span> <a class="code" href="classVariantData.html#d4ee952cc8ced49176df1d773dec64dd">setValue</a>(<span class="keywordtype">bool</span> value)        { this-&gt;<a class="code" href="classVariantData.html#b89d01eddb1623a19a762816f8ecbe1b">booleanValue</a> = value; this-&gt;<a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a> = <a class="code" href="VariantData_8h.html#a45d5f4cb80bd115ba76212f4d20f4a1">VARIANT_TYPE_BOOLEAN</a>; }
<a name="l00045"></a><a class="code" href="classVariantData.html#4bb158230df201cbba62f3274bf67bf2">00045</a>         <span class="keywordtype">void</span> <a class="code" href="classVariantData.html#4bb158230df201cbba62f3274bf67bf2">setValue</a>(<span class="keywordtype">double</span> value)      { this-&gt;<a class="code" href="classVariantData.html#2c126081da9af039f2a928eb1d0431c9">numericValue</a> = value; this-&gt;<a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a> = <a class="code" href="VariantData_8h.html#0ce33fe2a40e00fd5179d0ab495d3287">VARIANT_TYPE_NUMERIC</a>; }
<a name="l00046"></a><a class="code" href="classVariantData.html#85c6fb4d9c36148288216e2fcc6a34b4">00046</a>         <span class="keywordtype">void</span> <a class="code" href="classVariantData.html#85c6fb4d9c36148288216e2fcc6a34b4">setValue</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* value) { this-&gt;<a class="code" href="classVariantData.html#b6149a1e20119b6ba877f7c6b43551e9">stringValue</a>  = value; this-&gt;<a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a> = <a class="code" href="VariantData_8h.html#6b816ffa55ee4ab44f3fff0cf168f5ab">VARIANT_TYPE_STRING</a>; }
<a name="l00047"></a>00047         <span class="comment">//</span>
<a name="l00048"></a><a class="code" href="classVariantData.html#7f93c9a6ba029700231cb457b96408b1">00048</a>         <span class="keywordtype">bool</span> <a class="code" href="classVariantData.html#7f93c9a6ba029700231cb457b96408b1">isBoolean</a>() { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a> == <a class="code" href="VariantData_8h.html#a45d5f4cb80bd115ba76212f4d20f4a1">VARIANT_TYPE_BOOLEAN</a>; }
<a name="l00049"></a><a class="code" href="classVariantData.html#f521379b31650cd5fb8f35fd029967f7">00049</a>         <span class="keywordtype">bool</span> <a class="code" href="classVariantData.html#f521379b31650cd5fb8f35fd029967f7">isNumeric</a>() { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a> == <a class="code" href="VariantData_8h.html#0ce33fe2a40e00fd5179d0ab495d3287">VARIANT_TYPE_NUMERIC</a>; }
<a name="l00050"></a><a class="code" href="classVariantData.html#add04c5ac48a44ad1c26ab6bf2099f4b">00050</a>         <span class="keywordtype">bool</span> <a class="code" href="classVariantData.html#add04c5ac48a44ad1c26ab6bf2099f4b">isString</a>()  { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a> == <a class="code" href="VariantData_8h.html#6b816ffa55ee4ab44f3fff0cf168f5ab">VARIANT_TYPE_STRING</a>; }
<a name="l00051"></a>00051         <span class="comment">//</span>
<a name="l00052"></a><a class="code" href="classVariantData.html#d6438333334172e261c0a76c8bbc325d">00052</a>         <span class="keywordtype">bool</span>        <a class="code" href="classVariantData.html#d6438333334172e261c0a76c8bbc325d">getBooleanValue</a>() { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classVariantData.html#b89d01eddb1623a19a762816f8ecbe1b">booleanValue</a>; }
<a name="l00053"></a><a class="code" href="classVariantData.html#8ff14068dcf97d44f0cb73fe36fb90be">00053</a>         <span class="keywordtype">double</span>      <a class="code" href="classVariantData.html#8ff14068dcf97d44f0cb73fe36fb90be">getNumericValue</a>() { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classVariantData.html#2c126081da9af039f2a928eb1d0431c9">numericValue</a>; }
<a name="l00054"></a><a class="code" href="classVariantData.html#bbf9e6d4a64cf875d3d16a51d2e9fb2f">00054</a>         <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="classVariantData.html#bbf9e6d4a64cf875d3d16a51d2e9fb2f">getStringValue</a>()  { <span class="keywordflow">return</span> this-&gt;<a class="code" href="classVariantData.html#b6149a1e20119b6ba877f7c6b43551e9">stringValue</a>.c_str(); }
<a name="l00055"></a>00055         <span class="comment">//</span>
<a name="l00056"></a>00056     <span class="keyword">private</span>:
<a name="l00057"></a><a class="code" href="classVariantData.html#b89d01eddb1623a19a762816f8ecbe1b">00057</a>         <span class="keywordtype">bool</span>        <a class="code" href="classVariantData.html#b89d01eddb1623a19a762816f8ecbe1b">booleanValue</a>;  <span class="comment">// type VARIANT_TYPE_BOOLEAN</span>
<a name="l00058"></a><a class="code" href="classVariantData.html#2c126081da9af039f2a928eb1d0431c9">00058</a>         <span class="keywordtype">double</span>      <a class="code" href="classVariantData.html#2c126081da9af039f2a928eb1d0431c9">numericValue</a>;  <span class="comment">// type VARIANT_TYPE_NUMERIC</span>
<a name="l00059"></a><a class="code" href="classVariantData.html#b6149a1e20119b6ba877f7c6b43551e9">00059</a>         std::string <a class="code" href="classVariantData.html#b6149a1e20119b6ba877f7c6b43551e9">stringValue</a>;   <span class="comment">// type VARIANT_TYPE_STRING</span>
<a name="l00060"></a>00060         <span class="comment">//</span>
<a name="l00061"></a><a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">00061</a>         <span class="keywordtype">char</span> <a class="code" href="classVariantData.html#c93d42bf9dd34df412312f2c29767aad">type</a>;
<a name="l00062"></a>00062     };
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 <span class="preprocessor">#endif</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Sep 22 19:55:59 2009 for EOSKernel by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.7 </small></address>
</body>
</html>
