Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
68
Src/nu/ReEntry.h
Normal file
68
Src/nu/ReEntry.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef NULLSOFT_UTILITY_RENTRYH
|
||||
#define NULLSOFT_UTILITY_RENTRYH
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Nullsoft
|
||||
{
|
||||
namespace Utility
|
||||
{
|
||||
|
||||
|
||||
class ReEntryGuard
|
||||
{
|
||||
public:
|
||||
ReEntryGuard() : entered(false)
|
||||
{}
|
||||
|
||||
|
||||
bool FunctionCall(std::string funcName = "Unknown")
|
||||
{
|
||||
|
||||
if (entered)
|
||||
{
|
||||
char errorMsg[256];
|
||||
sprintf(errorMsg, "%s branched to %s", firstFunc.c_str(), funcName.c_str());
|
||||
::MessageBox(NULL, errorMsg, "Class ReEntry error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstFunc = funcName;
|
||||
entered = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void LeaveFunction()
|
||||
{
|
||||
entered = false;
|
||||
firstFunc = "";
|
||||
}
|
||||
private:
|
||||
bool entered;
|
||||
std::string firstFunc;
|
||||
|
||||
};
|
||||
class ReEntry
|
||||
{
|
||||
public:
|
||||
ReEntry(ReEntryGuard &_entry, std::string funcName = "Unknown") : entry(&_entry)
|
||||
{
|
||||
entry->FunctionCall(funcName);
|
||||
}
|
||||
|
||||
~ReEntry()
|
||||
{
|
||||
entry->LeaveFunction();
|
||||
}
|
||||
|
||||
private:
|
||||
ReEntryGuard *entry;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue