Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/language/duchain/duchain.cpp
Show First 20 Lines • Show All 304 Lines • ▼ Show 20 Line(s) | 292 | #endif | |||
---|---|---|---|---|---|
305 | m_cleanup = new CleanupThread(this); | 305 | m_cleanup = new CleanupThread(this); | ||
306 | m_cleanup->start(); | 306 | m_cleanup->start(); | ||
307 | 307 | | |||
308 | DUChain::m_deleted = false; | 308 | DUChain::m_deleted = false; | ||
309 | 309 | | |||
310 | ///Loading of some static data: | 310 | ///Loading of some static data: | ||
311 | { | 311 | { | ||
312 | ///@todo Solve this more duchain-like | 312 | ///@todo Solve this more duchain-like | ||
313 | QFile f(globalItemRepositoryRegistry().path() + "/parsing_environment_data"); | 313 | QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/parsing_environment_data")); | ||
314 | bool opened = f.open(QIODevice::ReadOnly); | 314 | bool opened = f.open(QIODevice::ReadOnly); | ||
315 | ///FIXME: ugh, so ugly | 315 | ///FIXME: ugh, so ugly | ||
316 | ParsingEnvironmentFile::m_staticData = reinterpret_cast<StaticParsingEnvironmentData*>( new char[sizeof(StaticParsingEnvironmentData)]); | 316 | ParsingEnvironmentFile::m_staticData = reinterpret_cast<StaticParsingEnvironmentData*>( new char[sizeof(StaticParsingEnvironmentData)]); | ||
317 | if(opened) { | 317 | if(opened) { | ||
318 | qCDebug(LANGUAGE) << "reading parsing-environment static data"; | 318 | qCDebug(LANGUAGE) << "reading parsing-environment static data"; | ||
319 | //Read | 319 | //Read | ||
320 | f.read((char*)ParsingEnvironmentFile::m_staticData, sizeof(StaticParsingEnvironmentData)); | 320 | f.read((char*)ParsingEnvironmentFile::m_staticData, sizeof(StaticParsingEnvironmentData)); | ||
321 | }else{ | 321 | }else{ | ||
322 | qCDebug(LANGUAGE) << "creating new parsing-environment static data"; | 322 | qCDebug(LANGUAGE) << "creating new parsing-environment static data"; | ||
323 | //Initialize | 323 | //Initialize | ||
324 | new (ParsingEnvironmentFile::m_staticData) StaticParsingEnvironmentData(); | 324 | new (ParsingEnvironmentFile::m_staticData) StaticParsingEnvironmentData(); | ||
325 | } | 325 | } | ||
326 | } | 326 | } | ||
327 | 327 | | |||
328 | ///Read in the list of available top-context indices | 328 | ///Read in the list of available top-context indices | ||
329 | { | 329 | { | ||
330 | QFile f(globalItemRepositoryRegistry().path() + "/available_top_context_indices"); | 330 | QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/available_top_context_indices")); | ||
331 | bool opened = f.open(QIODevice::ReadOnly); | 331 | bool opened = f.open(QIODevice::ReadOnly); | ||
332 | if(opened) | 332 | if(opened) | ||
333 | { | 333 | { | ||
334 | Q_ASSERT( (f.size() % sizeof(uint)) == 0); | 334 | Q_ASSERT( (f.size() % sizeof(uint)) == 0); | ||
335 | m_availableTopContextIndices.resize(f.size()/(int)sizeof(uint)); | 335 | m_availableTopContextIndices.resize(f.size()/(int)sizeof(uint)); | ||
336 | f.read((char*)m_availableTopContextIndices.data(), f.size()); | 336 | f.read((char*)m_availableTopContextIndices.data(), f.size()); | ||
337 | } | 337 | } | ||
338 | } | 338 | } | ||
▲ Show 20 Lines • Show All 517 Lines • ▼ Show 20 Line(s) | 762 | } | |||
856 | 856 | | |||
857 | //This must be the last step, due to the on-disk reference counting | 857 | //This must be the last step, due to the on-disk reference counting | ||
858 | globalItemRepositoryRegistry().store(); //Stores all repositories | 858 | globalItemRepositoryRegistry().store(); //Stores all repositories | ||
859 | 859 | | |||
860 | { | 860 | { | ||
861 | //Store the static parsing-environment file data | 861 | //Store the static parsing-environment file data | ||
862 | ///@todo Solve this more elegantly, using a general mechanism to store static duchain-like data | 862 | ///@todo Solve this more elegantly, using a general mechanism to store static duchain-like data | ||
863 | Q_ASSERT(ParsingEnvironmentFile::m_staticData); | 863 | Q_ASSERT(ParsingEnvironmentFile::m_staticData); | ||
864 | QFile f(globalItemRepositoryRegistry().path() + "/parsing_environment_data"); | 864 | QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/parsing_environment_data")); | ||
865 | bool opened = f.open(QIODevice::WriteOnly); | 865 | bool opened = f.open(QIODevice::WriteOnly); | ||
866 | Q_ASSERT(opened); | 866 | Q_ASSERT(opened); | ||
867 | Q_UNUSED(opened); | 867 | Q_UNUSED(opened); | ||
868 | f.write((char*)ParsingEnvironmentFile::m_staticData, sizeof(StaticParsingEnvironmentData)); | 868 | f.write((char*)ParsingEnvironmentFile::m_staticData, sizeof(StaticParsingEnvironmentData)); | ||
869 | } | 869 | } | ||
870 | 870 | | |||
871 | ///Write out the list of available top-context indices | 871 | ///Write out the list of available top-context indices | ||
872 | { | 872 | { | ||
873 | QMutexLocker lock(&m_chainsMutex); | 873 | QMutexLocker lock(&m_chainsMutex); | ||
874 | 874 | | |||
875 | QFile f(globalItemRepositoryRegistry().path() + "/available_top_context_indices"); | 875 | QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/available_top_context_indices")); | ||
876 | bool opened = f.open(QIODevice::WriteOnly); | 876 | bool opened = f.open(QIODevice::WriteOnly); | ||
877 | Q_ASSERT(opened); | 877 | Q_ASSERT(opened); | ||
878 | Q_UNUSED(opened); | 878 | Q_UNUSED(opened); | ||
879 | 879 | | |||
880 | f.write((char*)m_availableTopContextIndices.data(), m_availableTopContextIndices.size() * sizeof(uint)); | 880 | f.write((char*)m_availableTopContextIndices.data(), m_availableTopContextIndices.size() * sizeof(uint)); | ||
881 | } | 881 | } | ||
882 | 882 | | |||
883 | 883 | | |||
▲ Show 20 Lines • Show All 853 Lines • Show Last 20 Lines |