//--------------------------------------------------------------------------- __fastcall TMainForm::TMainForm(TComponent* Owner) : TForm(Owner), _colNum (-1) { if (ParamCount() >= 1) Caption = ParamStr(1); else if (OpenDialog->Execute()) Caption = OpenDialog->FileName; else return; if (_strategy.DataOpen(Caption.c_str(), false)) _storage = c4_Storage (_strategy, true); }
z_status zb_ds_metakit::open(bool create,bool writable) { //TODO - only create when asked to _filename<<name <<".mtk"; _pStore= z_new c4_Storage(_filename,(writable?1:0)); if(_pStore->Strategy().IsValid()) { _status=status_opened_read; if(writable) _status=status_opened_write; return zs_ok; } delete _pStore; _pStore=0; _status=status_cant_open; return zs_could_not_open_file; }
NaiveBayesianClassifier::NaiveBayesianClassifier(const QString &filename) : Classifier() { kdDebug() << "Creating NaiveBayesianClassifer" << endl; database = c4_Storage(filename, true); database.AutoCommit(); m_categories = QMap<QString, c4_View>(); // for ( QStringList::ConstIterator it = categories.constBegin(); it != categories.constEnd(); ++it ) { // getCategory(*it); // } c4_View cats = getDatabase().GetAs("categories[name:S,count:I]"); c4_Row currentRow; c4_StringProp name("name"); long idx; for (idx=0;idx<cats.GetSize();idx++) { QString cat = (const char*) name(cats[idx]); getCategory(cat); } }