Google
Web alhem.net

Select.cpp

Go to the documentation of this file.
00001 /*
00002  **     \file Select.cpp
00003  **     \date  2006-05-05
00004  **     \author grymse@alhem.net
00005 **/
00006 /*
00007 Copyright (C) 2006  Anders Hedstrom
00008 
00009 This program is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2
00012 of the License, or (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 */
00023 #include "Select.h"
00024 
00025 
00026 namespace Cgi {
00027 
00028 
00029 Select::Select(const std::string& name) : Styled(), m_name(name)
00030 {
00031 }
00032 
00033 
00034 Select::~Select()
00035 {
00036 }
00037 
00038 
00039 void Select::Add(const std::string& value)
00040 {
00041         m_values.push_back(new Value(*this, value));
00042 }
00043 
00044 
00045 void Select::Add(long value,const std::string& description)
00046 {
00047         m_values.push_back(new Multi(*this, value, description));
00048 }
00049 
00050 
00051 void Select::Print()
00052 {
00053         if (GetStyle().size())
00054         {
00055                 printf("<select style='%s' name='%s'>", GetStyle().c_str(), m_name.c_str());
00056         }
00057         else
00058         {
00059                 printf("<select name='%s'>", m_name.c_str());
00060         }
00061         for (std::list<Value *>::iterator it = m_values.begin(); it != m_values.end(); it++)
00062         {
00063                 Value *p = *it;
00064                 p -> Print();
00065         }
00066         printf("</select>");
00067 }
00068 
00069 
00070 } // namespace

Generated for cgi++ by doxygen 1.3.7

Page, code, and content Copyright (C) 2004 by Anders Hedström