• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/data/DataRow.cpp

00001 /*
00002  *   This file is part of the Standard Portable Library (SPL).
00003  *
00004  *   SPL is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   SPL is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with SPL.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #include <spl/data/DataRow.h>
00018 
00019 DataRow::DataRow()
00020 : m_cols()
00021 {
00022 }
00023 
00024 DataRow::DataRow(const DataRow& dr)
00025 : m_cols()
00026 {
00027         *this = dr;
00028 }
00029 
00030 DataRow::DataRow(const Vector<DataColumnPtr>& columns)
00031 : m_cols()
00032 {
00033         for ( int x = 0; x < m_cols.Count(); x++ )
00034         {
00035                 m_cols.Add( VariantPtr(new Variant()));
00036         }
00037 }
00038 
00039 DataRow::~DataRow()
00040 {
00041 }
00042 
00043 DataRow& DataRow::operator =(const DataRow& dr)
00044 {
00045         for ( int x = 0; x < m_cols.Count(); x++ )
00046         {
00047                 m_cols.Add( dr.m_cols.ElementAt(x)->Clone() );
00048         }
00049 
00050         return *this;
00051 }
00052 
00053 void DataRow::AddColumn(const DataColumn& col)
00054 {
00055         VariantPtr c(new Variant());
00056         m_cols.Add(c);
00057 }
00058 
00059 void DataRow::AddColumn(const DataColumn& col, const Variant& data)
00060 {
00061         m_cols.Add(data.Clone());
00062 }
00063 
00064 #if defined(DEBUG)
00065 void DataRow::CheckMem() const
00066 {
00067         m_cols.CheckMem();
00068 }
00069 
00070 void DataRow::ValidateMem() const
00071 {
00072         m_cols.ValidateMem();
00073 }
00074 #endif