Namespace ST for global vars

This commit is contained in:
vladislav.khorev committed 2013-02-21 13:14:46 +00:00
1 parent 61ada33ee1
commit 7d8bcec025
14 files changed
+58 -94

No files matched your search

+8 -1
View File
@@ -8,6 +8,13 @@
namespace SE
{
namespace ST
{
std::string PathToResources;
}
bool findString(char* in, char* list)
{
@@ -82,7 +89,7 @@ std::string GetFilePathUserData(const std::string& filename)
//Special for IOS -> Foundation.h conflicts with sq_plus.h
std::string GetPathToResources()
{
return ResourceManager->PathToResources;
return ST::PathToResources;
}
#endif
@@ -56,7 +56,7 @@ boost::property_tree::ptree::iterator ReplaceIncludeFile(boost::property_tree::p
#ifdef UTILS_ENGINE
xmlFileArr = CreateMemFromFile<char>(fileName, xmlFileSize);
#else
xmlFileArr = CreateMemFromFile<char>(ResourceManager->PathToResources + fileName, xmlFileSize);
xmlFileArr = CreateMemFromFile<char>(ST::PathToResources + fileName, xmlFileSize);
#endif
std::string xmlString = std::string(&xmlFileArr[0], &xmlFileArr[xmlFileSize]);
@@ -150,7 +150,7 @@ std::shared_ptr<boost::property_tree::ptree> FileToPropertyTree(const std::strin
#ifdef UTILS_ENGINE
boost::shared_array<char> file = CreateMemFromFile<char>(fileName, byteCount);
#else
boost::shared_array<char> file = CreateMemFromFile<char>(ResourceManager->PathToResources + fileName, byteCount);
boost::shared_array<char> file = CreateMemFromFile<char>(ST::PathToResources + fileName, byteCount);
#endif
return FileToPropertyTree(file, byteCount, replaceMap);
+12 -8
View File
@@ -2,13 +2,17 @@
namespace SE
{
boost::asio::io_service MainThreadIoService;
namespace ST
{
boost::asio::io_service MainThreadIoService;
boost::thread::id MainThreadId;
}
#ifndef UTILS_ENGINE
void AssertIfInMainThread()
{
if (boost::this_thread::get_id() != ResourceManager->MainThreadId)
if (boost::this_thread::get_id() != ST::MainThreadId)
{
throw ErrorToLog("ERROR! AssertIfInMainThread - assert failed!");
}
@@ -16,16 +20,16 @@ namespace SE
void TryUpdateMainThreadId()
{
if (boost::this_thread::get_id() != ResourceManager->MainThreadId)
if (boost::this_thread::get_id() != ST::MainThreadId)
{
ResourceManager->MainThreadId = boost::this_thread::get_id();
ST::MainThreadId = boost::this_thread::get_id();
}
}
void PerformInMainThreadAsync(boost::function<void()> f)
{
if (boost::this_thread::get_id() == ResourceManager->MainThreadId)
if (boost::this_thread::get_id() == ST::MainThreadId)
{
f();
}
@@ -43,7 +47,7 @@ namespace SE
serviceLock.lock();
MainThreadIoService.post(func);
ST::MainThreadIoService.post(func);
serviceLock.lock();
serviceLock.unlock();