TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Enum.php

Documentation is available at Enum.php

  1. <?php
  2.  
  3. /**
  4.  *
  5.  * <p>Title: Enum class</p>
  6.  *
  7.  * <p>Description: </p>
  8.  *
  9.  * <p>Copyright (c) 2005-2008 by Steema Software SL. All Rights Reserved.</p>
  10.  *
  11.  * <p>Company: Steema Software SL</p>
  12.  *
  13.  *   public abstract*/
  14.  
  15.  
  16.   class Enum /*implements Serializable*/ {
  17.  
  18.     public /*transient String*/ $name='';
  19.     public /*transient int*/ $value;
  20.  
  21.     protected function _Enum(/*int*/ $value{
  22.         $this();
  23.         $this->value $value;
  24.     }
  25.  
  26.     function Enum({
  27. //        parent
  28.     }
  29.  
  30.  
  31. /*        public function serialize(){
  32.             return serialize($this);
  33.         }
  34.         public function unserialize($serialized){
  35.             return unserialize($serialized);
  36.         }
  37.   */
  38.   /*throws NoSuchFieldException,
  39.             IllegalAccessException*/
  40.  
  41.     protected function readResolve()  {
  42.         return getClass()->getField(name)->get(null);
  43.     }
  44.  
  45.     public function getValue({
  46.         return $value;
  47.     }
  48.  
  49.     /*throws IOException,
  50.             ClassNotFoundException */
  51.     private function readObject($in)  {
  52.         $this->name = (string) $in->readObject();
  53.     }
  54.  
  55.     /*throws IOException*/
  56.     private function writeObject($out)  {
  57.         $out->writeObject(getName());
  58.     }
  59.  
  60.     private function  getName({
  61. /*        Class c = getClass();
  62.         Field[] f = c.getDeclaredFields();
  63.  
  64.         for (int i = 0; i < f.length; i++) {
  65.             int mod = f[i].getModifiers();
  66.  
  67.             if (Modifier.isStatic(mod) && Modifier.isFinal(mod)
  68.                 && Modifier.isPublic(mod)) {
  69.  
  70.                 try {
  71.                     if (this == f[i].get(null)) {
  72.                         return f[i].getName();
  73.                     }
  74.                 } catch (IllegalAccessException ex) {
  75.                     return "";
  76.                 } catch (IllegalArgumentException ex) {
  77.                     return "";
  78.                 }
  79.             }
  80.         }
  81.   */
  82.         return "";
  83.     }
  84.  
  85. }
  86.  
  87. ?>

Documentation generated on Wed, 16 Jun 2010 12:05:09 +0200 by phpDocumentor 1.4.1