Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Fl_Params.h

00001 /***************************************************************************
00002                           Fl_Params.h  -  description
00003                              -------------------
00004     begin                : Sat Dec 28 2002
00005     copyright            : (C) 2002 by Alexey Parshin
00006     email                : alexeyp@m7.tts-sf.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef _FL_PARAMS_H_
00019 #define _FL_PARAMS_H_
00020 
00021 #include "../Fl_String.h"
00022 #include "../Fl_Variant.h"
00023 #include "../Fl_Ptr_List.h"
00024 
00030 class Fl_Param : public Fl_Variant {
00031     Fl_String         m_name;
00032     Fl_Ptr_List       m_bindParamIndexes;
00033     bool              m_null;
00034     char             *m_conversionBuffer;
00035 public:
00036     Fl_Param(const char *name);
00037     ~Fl_Param();
00038 
00039     void is_null(bool n) { m_null = n; }
00040     bool is_null() const { return m_null; }
00041 
00042     char *conversion_buffer() { return m_conversionBuffer; }
00043 
00044     const Fl_String& name() const { return m_name; }
00045     void       bind_clear() { m_bindParamIndexes.clear(); }
00046     void       bind_add(unsigned bindIndex);
00047     unsigned   bind_count() { return m_bindParamIndexes.count(); }
00048     unsigned   bind_index(unsigned ind) { return (unsigned)m_bindParamIndexes[ind]; }
00049 
00050     // ASSIGNMENT OPERATORS
00051     Fl_Variant& operator =(const Fl_Variant &C) {
00052         if (this == &C) return *this;
00053         set_data(C);
00054         return *this;
00055     }
00056 
00057     Fl_Variant& operator =(const char *s) {
00058         set_string(s);
00059         return *this;
00060     }
00061 
00062     Fl_Variant& operator =(const Fl_String &s) {
00063         set_string(s.c_str(), s.length());
00064         return *this;
00065     }
00066 
00067     Fl_Variant& operator =(int v) {
00068         set_int(v);
00069         return *this;
00070     }
00071 
00072     Fl_Variant& operator =(double v) {
00073         set_float(v);
00074         return *this;
00075     }
00076 
00077     Fl_Variant& operator =(Fl_Date_Time dt) {
00078         set_date(dt);
00079         return *this;
00080     }
00081 
00082     Fl_Variant& operator =(const Fl_Image *pm) {
00083         set_image_ptr(pm);
00084         return *this;
00085     }
00086 };
00087 
00088 class Fl_Params {
00089     Fl_Ptr_List m_items;
00090     void       clear();
00091 public:
00092     Fl_Params() {};
00093     ~Fl_Params() { clear(); }
00094 
00095     int        param_index(const char *paramName);
00096     Fl_Param&  operator[] (unsigned index) const;
00097     Fl_Param&  operator[] (const char *paramName) const;
00098     Fl_Param&  operator[] (const Fl_String& paramName) const;
00099     void       add(const Fl_Param * item);
00100     void       remove(unsigned index);
00101     unsigned   count() const { return m_items.count(); }
00102 };
00103 
00104 #endif

Generated on Thu Jul 31 15:33:44 2003 for eFLTK by doxygen1.2.15