Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CSVTable Class Reference

#include <csv.h>

Public Types

enum  optimizer_enum { optimizer_undefined =0x7fffffff }
 

Public Member Functions

 CSVTable (std::string name, std::string saveroot)
 
 CSVTable (VSFileSystem::VSFile &f, std::string saveroot)
 
bool RowExists (std::string name, unsigned int &where)
 
bool ColumnExists (std::string name, unsigned int &where)
 
void SetupOptimizer (std::vector< std::string >keys, unsigned int type)
 

Public Attributes

std::string rootdir
 
vsUMap< std::string, intcolumns
 
vsUMap< std::string, introws
 
std::vector< std::string > key
 
std::vector< std::string > table
 
bool optimizer_setup
 
unsigned int optimizer_type
 
std::vector< std::string > optimizer_keys
 
std::vector< unsigned intoptimizer_indexes
 

Detailed Description

Definition at line 16 of file csv.h.

Member Enumeration Documentation

Enumerator
optimizer_undefined 

Definition at line 35 of file csv.h.

35 {optimizer_undefined=0x7fffffff};

Constructor & Destructor Documentation

CSVTable::CSVTable ( std::string  name,
std::string  saveroot 
)
CSVTable::CSVTable ( VSFileSystem::VSFile f,
std::string  saveroot 
)

Member Function Documentation

bool CSVTable::ColumnExists ( std::string  name,
unsigned int where 
)

Definition at line 195 of file csv.cpp.

References columns.

Referenced by SetupOptimizer().

196 {
197  vsUMap< string, int >::iterator i = columns.find( name );
198  if ( i == columns.end() )
199  return false;
200  where = (*i).second;
201  return true;
202 }
bool CSVTable::RowExists ( std::string  name,
unsigned int where 
)

Definition at line 186 of file csv.cpp.

References rows.

187 {
188  vsUMap< string, int >::iterator i = rows.find( name );
189  if ( i == rows.end() )
190  return false;
191  where = (*i).second;
192  return true;
193 }
void CSVTable::SetupOptimizer ( std::vector< std::string >  keys,
unsigned int  type 
)

Definition at line 214 of file csv.cpp.

References ColumnExists(), optimizer_indexes, optimizer_keys, optimizer_setup, optimizer_type, and optimizer_undefined.

Referenced by Unit::LoadRow().

215 {
216  optimizer_setup = true;
217  optimizer_type = type;
218  optimizer_keys = keys;
219  optimizer_indexes.resize( keys.size(), CSVTable::optimizer_undefined );
220  for (unsigned int i = 0; i < keys.size(); ++i)
221  ColumnExists( keys[i], optimizer_indexes[i] );
222 }

Member Data Documentation

vsUMap< std::string, int > CSVTable::columns

Definition at line 22 of file csv.h.

Referenced by ColumnExists().

std::vector< std::string > CSVTable::key

Definition at line 24 of file csv.h.

Referenced by CSVRow::CSVRow(), CSVRow::getKey(), and CSVRow::size().

std::vector< unsigned int > CSVTable::optimizer_indexes

Definition at line 42 of file csv.h.

Referenced by SetupOptimizer().

std::vector< std::string > CSVTable::optimizer_keys

Definition at line 41 of file csv.h.

Referenced by SetupOptimizer().

bool CSVTable::optimizer_setup

Definition at line 39 of file csv.h.

Referenced by Unit::LoadRow(), and SetupOptimizer().

unsigned int CSVTable::optimizer_type

Definition at line 40 of file csv.h.

Referenced by SetupOptimizer().

std::string CSVTable::rootdir

Definition at line 21 of file csv.h.

Referenced by CSVRow::getRoot().

vsUMap< std::string, int > CSVTable::rows

Definition at line 23 of file csv.h.

Referenced by getAITypes(), and RowExists().

std::vector< std::string > CSVTable::table

Definition at line 25 of file csv.h.

Referenced by CSVRow::operator[]().


The documentation for this class was generated from the following files: