예제 #1
0
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
void XAP_Dictionary::_abortFile(void)
{
	// abort the write.
	// TODO close the file and do any restore and/or cleanup.

	_closeFile();
	return;
}
예제 #4
0
void SDHandler::_keyReleased() {
  if(_active) {
    _active = false;
    _closeFile();
    _sd->unmount();
    _fileNumber = -1;
    _log("Unpressed\n");
    _led->write(0);
  }
}
예제 #5
0
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
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
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;
}