コード例 #1
0
ファイル: xap_Dictionary.cpp プロジェクト: Distrotech/abiword
bool XAP_Dictionary::save(void)
{
	if (!m_bDirty)
		return true;

	if (!_openFile("w"))
		return false;

	UT_GenericVector<UT_UCSChar *> * pVec = m_hashWords.enumerate();
	UT_ASSERT(pVec);

	UT_uint32 size = pVec->size();

	for (UT_uint32 i = 0; i < size; i++)
	{
		UT_UCSChar * pWord = pVec->getNthItem(i);
		_outputUTF8(pWord, UT_UCS4_strlen(pWord));
		_writeBytes(reinterpret_cast<const UT_Byte *>("\n"));
	}

	_closeFile();

	delete pVec;
	m_bDirty = false;

	return true;
}
コード例 #2
0
ファイル: file.c プロジェクト: TheMRod/Rocrail
static void _setFilename( iOFile inst, const char* path ) {
  iOFileData data = Data(inst);
  _closeFile( inst );
  StrOp.freeID( data->path, RocsFileID );
  data->path = StrOp.dupID( path, RocsFileID );
  __openFile(data);
}
コード例 #3
0
ファイル: xap_Dictionary.cpp プロジェクト: Distrotech/abiword
void XAP_Dictionary::_abortFile(void)
{
	// abort the write.
	// TODO close the file and do any restore and/or cleanup.

	_closeFile();
	return;
}
コード例 #4
0
ファイル: SDHandler.cpp プロジェクト: Mikk36/gpsLogger
void SDHandler::_keyReleased() {
  if(_active) {
    _active = false;
    _closeFile();
    _sd->unmount();
    _fileNumber = -1;
    _log("Unpressed\n");
    _led->write(0);
  }
}
コード例 #5
0
ファイル: xap_Dictionary.cpp プロジェクト: Distrotech/abiword
XAP_Dictionary::~XAP_Dictionary()
{
	if (m_fp)
		_closeFile();

	FREEP(m_szFilename);

  	//UT_HASH_PURGEDATA(UT_UCSChar *, (&m_hashWords), g_free);
	m_hashWords.freeData();
#if 0
	UT_StringPtrMap::UT_Cursor _hc1(&m_hashWords);
	for (UT_UCSChar * _hval1 = const_cast<UT_UCSChar *>(reinterpret_cast<const UT_UCSChar *>(_hc1.first())); _hc1.is_valid(); _hval1 = const_cast<UT_UCSChar *>(reinterpret_cast<const UT_UCSChar *>(_hc1.next())) )
	{ 
		if (_hval1)
			g_free (_hval1);
	}
#endif
}
コード例 #6
0
ファイル: SDHandler.cpp プロジェクト: Mikk36/gpsLogger
void SDHandler::logData(const std::string data) {
  if(_checkNewDate(data)) {
    _log("logData: _checkNewDate is true\n");
    if(_active) {
      _log("logData: _active is true\n");
      if(_firstTime) {
        _firstTime = false;
      } else {
        ++_fileNumber;
      }
      _closeFile();
      _openFile();
    }
  }

  if(_fp != 0) {
    _filterData(data);
  }
}
コード例 #7
0
ファイル: xap_Dictionary.cpp プロジェクト: Distrotech/abiword
bool XAP_Dictionary::load(void)
{
	UT_ASSERT(m_hashWords.size() == 0);

	if (!_openFile("r"))
		return false;

	if (!_parseUTF8())
		_abortFile();
	else
		_closeFile();

	m_bDirty = false;
//
// Hardwire in some words that should be in the English Language :-)
//
	addWord("AbiWord");
	addWord("AbiSource");
	return true;
}