Ejemplo n.º 1
0
void FoxPro::save(WriteStream *dbf, WriteStream *cdx, WriteStream *fpt) const {
	assert(dbf);

	if (_hasIndex && !cdx)
		throw Exception("Index needed");
	if (_hasMemo && !fpt)
		throw Exception("Memo needed");

	if (_records.empty() || _fields.empty())
		throw Exception("No records / fields");

	saveHeader(*dbf);
	saveFields(*dbf);
	saveRecords(*dbf);
	dbf->flush();

	if (fpt) {
		saveMemos(*fpt);
		fpt->flush();
	}

	// TODO: Write the compound index (CDX) file

	if (cdx)
		cdx->flush();
}
Ejemplo n.º 2
0
void
KBuildServiceTypeFactory::save(QDataStream &str)
{
    KSycocaFactory::save(str);
#if 0 // not needed since don't have any additional index anymore
    int endOfFactoryData = str.device()->pos();

    // Update header (pass #3)
    saveHeader(str);

    // Seek to end.
    str.device()->seek(endOfFactoryData);
#endif
}
Ejemplo n.º 3
0
//
// beginSaveStream
//
bool kstream::beginSaveStream( const char * szFileName )
{
	// Wrong stream type
	if ( m_streamType == STREAM_INPUT ) return false;

	// Create a new streaming file
	m_spStreamFile.reset( new SystemFile( szFileName, READ_WRITE, BINARY_FILE ) );

	// Save the header information
	if ( !saveHeader() )
		return false;

	return true;
}
Ejemplo n.º 4
0
void KBuildMimeTypeFactory::save(QDataStream &str)
{
    KSycocaFactory::save(str);

    str << (qint32) 0;

    const int endOfFactoryData = str.device()->pos();

    // Update header (pass #3)
    saveHeader(str);

    // Seek to end.
    str.device()->seek(endOfFactoryData);
}
Ejemplo n.º 5
0
void
KBuildServiceTypeFactory::save(TQDataStream &str)
{
   KSycocaFactory::save(str);

   savePatternLists(str);

   int endOfFactoryData = str.device()->at();

   // Update header (pass #3)
   saveHeader(str);

   // Seek to end.
   str.device()->at(endOfFactoryData);
}
QString TableStatistics::saveToString(const QString &geometry)
{
  QString s = "<TableStatistics>\n";
  s += QString(name())+"\t";
  s += QString(d_base->name())+"\t";
  s += QString(d_type == row ? "row" : "col") + "\t";
  s += birthDate()+"\n";
  s += "Targets";
  for (QValueList<int>::iterator i=d_targets.begin(); i!=d_targets.end(); ++i)
    s += "\t" + QString::number(*i);
  s += "\n";
  s += geometry;
  s += saveHeader();
  s += saveColumnWidths();
  s += saveCommandes();
  s += saveColumnTypes();
  s += saveComments();
  s += "WindowLabel\t" + windowLabel() + "\t" + QString::number(captionPolicy()) + "\n";
  return s + "</TableStatistics>\n";
}
Ejemplo n.º 7
0
/**
 * Save the dataset into a file for training and recognition.
 *
 * @param filename Pathname of the destination file
 * @param addr Wii device mac address
 */
bool Dataset::save(const char* file, const char* addr) const
{
	// Open file
	ofstream out(file, ios::trunc);
	if(!out.is_open()) { // File does not exist, hence I create it
		cout << "[Error] Unable to open " << file << endl;
		return false;
	}
	
	// Save header
	saveHeader(out, addr);
	
	// For each training
	for(int i = 0 ; i < size() ; i++)	{
		const Training* training = trainingAt(i);
		if(training)
			training->save(out);
	}
	
	out.close();

	return true;
}
Ejemplo n.º 8
0
 bool save() override
 {
     return SourceCodeDocument::save() && saveHeader();
 }
Ejemplo n.º 9
0
void
writeStorageCache(TargetDevice* tdev)
{
	int func;
	unsigned int patt;
	unsigned int extra;
	unsigned int param;
	int fret;
	HfInfo outfile;
    HfInfo infile;

    StorageCacheImpl* cache = getStorageCache(tdev, true);

    // Open file for save
    fret = hfOpenWrite(&infile, cache->fpath);
    if (fret) {
        printErrorMessage(fret, cache->fpath);
        exit(2);
    }
    fret = hfOpenWrite(&outfile, cache->fpath_tmp);
    if (fret) {
        printErrorMessage(fret, cache->fpath_tmp);
        exit(2);
    }

    saveHeader(&outfile, BLAS_FUNCTIONS_NUMBER, 0);

    // For each function
    for (func =0; func < BLAS_FUNCTIONS_NUMBER; ++ func) {
        BlasFunctionInfo* bFunc = &cache->functionInfo[func];

        // For each pattern
        for (patt =0; patt < bFunc->numPatterns; ++ patt){
            BlasPatternInfo* bPatt = &bFunc->pattInfo[patt];

            // Save pattern header
            savePatternHeader(&outfile, bPatt);

            for (extra =0; extra < bPatt->numExtra; ++ extra){
                BlasExtraInfo* bExtra = &bPatt->extra[extra];

                saveExtraHeader(&outfile, bExtra);

                //
                for (param =0; param < bExtra->numParam; ++param){
                    BlasParamInfo* bParam = &bExtra->param[param];

                    saveParamData(&outfile, bParam);
                }
            }
        }
    }
    hfClose(&infile);
    hfClose(&outfile);

    // rename file
    fret = remove(cache->fpath);
    if (fret == 0) {
        fret = rename(cache->fpath_tmp, cache->fpath);
    }

    // Re-init storage cache
    destroyStorageCache ();
    initStorageCache();
}