STRING_MANAGER::TWorksheet Struct Reference

#include <diff_tool.h>


Public Types

typedef std::vector< TRowTData
typedef std::vector< ucstringTRow

Public Member Functions

TRowback ()
std::vector< TRow >::const_iterator begin () const
std::vector< TRow >::iterator begin ()
std::vector< TRow >::const_iterator end () const
std::vector< TRow >::iterator end ()
std::vector< TRow >::iterator erase (std::vector< TRow >::iterator it)
void eraseColumn (uint colIndex)
bool findCol (ucstring colName, uint &colIndex)
bool findId (uint &colIndex)
bool findRow (uint colIndex, const ucstring &colValue, uint &rowIndex)
const ucstringgetData (uint rowIndex, const ucstring &colName) const
const ucstringgetData (uint rowIndex, uint colIndex) const
std::vector< TRow >::iterator insert (std::vector< TRow >::iterator pos, const TRow &value)
void insertColumn (uint colIndex)
void insertRow (uint rowIndex, const TRow &row)
const TRowoperator[] (uint index) const
TRowoperator[] (uint index)
void push_back (const TRow &row)
void resize (uint numRows)
void setColCount (uint count)
void setData (uint rowIndex, const ucstring &colName, const ucstring &value)
void setData (uint rowIndex, uint colIndex, const ucstring &value)
uint size () const
 TWorksheet ()

Data Fields

uint ColCount
TData Data


Member Typedef Documentation

typedef std::vector<TRow> STRING_MANAGER::TWorksheet::TData
 

Definition at line 95 of file diff_tool.h.

typedef std::vector<ucstring> STRING_MANAGER::TWorksheet::TRow
 

Definition at line 94 of file diff_tool.h.

Referenced by back(), NLMISC::CWordsDictionary::init(), insert(), insertRow(), STRING_MANAGER::TTestWorksheetItem::operator()(), operator[](), and push_back().


Constructor & Destructor Documentation

STRING_MANAGER::TWorksheet::TWorksheet  )  [inline]
 

Definition at line 99 of file diff_tool.h.

References ColCount.

00100                         : ColCount(0)
00101                 {
00102                 }


Member Function Documentation

TRow& STRING_MANAGER::TWorksheet::back  )  [inline]
 

Definition at line 139 of file diff_tool.h.

References TRow.

00140                 {
00141                         return Data.back();
00142                 }

std::vector<TRow>::const_iterator STRING_MANAGER::TWorksheet::begin void   )  const [inline]
 

Definition at line 114 of file diff_tool.h.

00115                 {
00116                         return Data.begin();
00117                 }

std::vector<TRow>::iterator STRING_MANAGER::TWorksheet::begin void   )  [inline]
 

Definition at line 104 of file diff_tool.h.

Referenced by eraseColumn(), findCol(), getData(), NLMISC::CWordsDictionary::init(), insertColumn(), and setData().

00105                 {
00106                         return Data.begin();
00107                 }

std::vector<TRow>::const_iterator STRING_MANAGER::TWorksheet::end void   )  const [inline]
 

Definition at line 119 of file diff_tool.h.

00120                 {
00121                         return Data.end();
00122                 }

std::vector<TRow>::iterator STRING_MANAGER::TWorksheet::end void   )  [inline]
 

Definition at line 109 of file diff_tool.h.

Referenced by findCol(), getData(), NLMISC::CWordsDictionary::init(), and setData().

00110                 {
00111                         return Data.end();
00112                 }

std::vector<TRow>::iterator STRING_MANAGER::TWorksheet::erase std::vector< TRow >::iterator  it  )  [inline]
 

Definition at line 134 of file diff_tool.h.

00135                 {
00136                         return Data.erase(it);
00137                 }

void STRING_MANAGER::TWorksheet::eraseColumn uint  colIndex  )  [inline]
 

Definition at line 171 of file diff_tool.h.

References begin(), ColCount, nlassert, and uint.

00172                 {
00173                         nlassert(colIndex < ColCount);
00174 
00175                         for (uint i=0; i<Data.size(); ++i)
00176                         {
00177                                 // insert a default value.
00178                                 Data[i].erase(Data[i].begin()+colIndex);
00179                         }
00180                         ColCount--;
00181                 }

bool STRING_MANAGER::TWorksheet::findCol ucstring  colName,
uint colIndex
[inline]
 

Definition at line 209 of file diff_tool.h.

References begin(), end(), and uint.

Referenced by NLMISC::CWordsDictionary::init().

00210                 {
00211                         if (Data.empty())
00212                                 return false;
00213                         TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), ucstring(colName));
00214                         if (it == Data[0].end())
00215                                 return false;
00216 
00217                         colIndex = it - Data[0].begin();
00218                         return true;
00219                 }

bool STRING_MANAGER::TWorksheet::findId uint colIndex  )  [inline]
 

Definition at line 193 of file diff_tool.h.

References uint.

Referenced by NLMISC::CWordsDictionary::init().

00194                 {
00195                         if (Data.empty())
00196                                 return false;
00197 
00198                         for (TWorksheet::TRow::iterator it=Data[0].begin(); it!=Data[0].end(); ++it)
00199                         {
00200                                 if ((*it).toString().find( "ID" ) != std::string::npos)
00201                                 {
00202                                         colIndex = it - Data[0].begin();
00203                                         return true;
00204                                 }
00205                         }
00206                         return false;
00207                 }

bool STRING_MANAGER::TWorksheet::findRow uint  colIndex,
const ucstring colValue,
uint rowIndex
[inline]
 

Definition at line 239 of file diff_tool.h.

References ColCount, nlassert, and uint.

00240                 {
00241                         nlassert(colIndex < ColCount);
00242 
00243                         TData::iterator first(Data.begin()), last(Data.end());
00244 
00245                         for (; first != last; ++first)
00246                         {
00247                                 if (first->operator[](colIndex) == colValue)
00248                                 {
00249                                         rowIndex = first - Data.begin();
00250                                         return true;
00251                                 }
00252                                         
00253                         }
00254                         return false;
00255                 }

const ucstring& STRING_MANAGER::TWorksheet::getData uint  rowIndex,
const ucstring colName
const [inline]
 

Definition at line 281 of file diff_tool.h.

References begin(), end(), nlassert, and uint.

00282                 {
00283                         nlassert(rowIndex > 0 && rowIndex < Data.size());
00284                         TWorksheet::TRow::const_iterator it = std::find(Data[0].begin(), Data[0].end(), ucstring(colName));
00285                         nlassert(it != Data[0].end());
00286 
00287                         return Data[rowIndex][it - Data[0].begin()];
00288                 }

const ucstring& STRING_MANAGER::TWorksheet::getData uint  rowIndex,
uint  colIndex
const [inline]
 

Definition at line 265 of file diff_tool.h.

References ColCount, nlassert, and uint.

Referenced by STRING_MANAGER::TGetWorksheetHashValue::operator()(), STRING_MANAGER::TGetWorksheetIdentifier::operator()(), and STRING_MANAGER::readExcelSheet().

00266                 {
00267                         nlassert(rowIndex < Data.size());
00268                         nlassert(colIndex < ColCount);
00269 
00270                         return Data[rowIndex][colIndex];
00271                 }

std::vector<TRow>::iterator STRING_MANAGER::TWorksheet::insert std::vector< TRow >::iterator  pos,
const TRow value
[inline]
 

Definition at line 129 of file diff_tool.h.

References TRow, and value.

00130                 {
00131                         return Data.insert(pos, value);
00132                 }

void STRING_MANAGER::TWorksheet::insertColumn uint  colIndex  )  [inline]
 

Definition at line 159 of file diff_tool.h.

References begin(), ColCount, nlassert, and uint.

Referenced by STRING_MANAGER::makeHashCode(), and STRING_MANAGER::readExcelSheet().

00160                 {
00161                         nlassert(colIndex <= ColCount);
00162 
00163                         for (uint i=0; i<Data.size(); ++i)
00164                         {
00165                                 // insert a default value.
00166                                 Data[i].insert(Data[i].begin()+colIndex);
00167                         }
00168                         ColCount++;
00169                 }

void STRING_MANAGER::TWorksheet::insertRow uint  rowIndex,
const TRow row
[inline]
 

Definition at line 221 of file diff_tool.h.

References ColCount, nlassert, TRow, and uint.

00222                 {
00223                         nlassert(rowIndex <= Data.size());
00224                         nlassert(row.size() == ColCount);
00225 
00226                         Data.insert(Data.begin()+rowIndex, row);
00227                 }

const TRow& STRING_MANAGER::TWorksheet::operator[] uint  index  )  const [inline]
 

Definition at line 149 of file diff_tool.h.

References index, TRow, and uint.

00150                 {
00151                         return Data[index];
00152                 }

TRow& STRING_MANAGER::TWorksheet::operator[] uint  index  )  [inline]
 

Definition at line 144 of file diff_tool.h.

References index, TRow, and uint.

00145                 {
00146                         return Data[index];
00147                 }

void STRING_MANAGER::TWorksheet::push_back const TRow row  )  [inline]
 

Definition at line 124 of file diff_tool.h.

References TRow.

00125                 {
00126                         Data.push_back(row);
00127                 }

void STRING_MANAGER::TWorksheet::resize uint  numRows  )  [inline]
 

Definition at line 230 of file diff_tool.h.

References ColCount, and uint.

Referenced by STRING_MANAGER::readExcelSheet().

00231                 {
00232                         uint    oldSize= Data.size();
00233                         Data.resize(numRows);
00234                         // alloc good Column count for new lines
00235                         for(uint i= oldSize;i<Data.size();i++)
00236                                 Data[i].resize(ColCount);
00237                 }

void STRING_MANAGER::TWorksheet::setColCount uint  count  )  [inline]
 

Definition at line 183 of file diff_tool.h.

References ColCount, count, and uint.

00184                 {
00185                         if (count != ColCount)
00186                         {
00187                                 for (uint i=0; i<Data.size(); ++i)
00188                                         Data[i].resize(count);
00189                         }
00190                         ColCount = count;
00191                 }

void STRING_MANAGER::TWorksheet::setData uint  rowIndex,
const ucstring colName,
const ucstring value
[inline]
 

Definition at line 273 of file diff_tool.h.

References begin(), end(), nlassert, uint, and value.

00274                 {
00275                         nlassert(rowIndex > 0 && rowIndex < Data.size());
00276                         TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), ucstring(colName));
00277                         nlassert(it != Data[0].end());
00278 
00279                         Data[rowIndex][it - Data[0].begin()] = value;
00280                 }

void STRING_MANAGER::TWorksheet::setData uint  rowIndex,
uint  colIndex,
const ucstring value
[inline]
 

Definition at line 257 of file diff_tool.h.

References ColCount, nlassert, uint, and value.

Referenced by STRING_MANAGER::readExcelSheet().

00258                 {
00259                         nlassert(rowIndex < Data.size());
00260                         nlassert(colIndex < ColCount);
00261 
00262                         Data[rowIndex][colIndex] = value;
00263                 }

uint STRING_MANAGER::TWorksheet::size  )  const [inline]
 

Definition at line 154 of file diff_tool.h.

References uint.

Referenced by STRING_MANAGER::readExcelSheet().

00155                 {
00156                         return Data.size();
00157                 }


Field Documentation

uint STRING_MANAGER::TWorksheet::ColCount
 

Definition at line 97 of file diff_tool.h.

Referenced by eraseColumn(), findRow(), getData(), insertColumn(), insertRow(), STRING_MANAGER::makeHashCode(), STRING_MANAGER::readExcelSheet(), resize(), setColCount(), setData(), and TWorksheet().

TData STRING_MANAGER::TWorksheet::Data
 

Definition at line 96 of file diff_tool.h.

Referenced by STRING_MANAGER::makeHashCode(), and STRING_MANAGER::prepareExcelSheet().


The documentation for this struct was generated from the following file:
Generated on Tue Mar 16 14:54:56 2004 for NeL by doxygen 1.3.6