trunk/branch integration: source indentation

This commit is contained in:
Marian Krivos 2011-08-23 07:09:52 +00:00
parent 24a844d68b
commit a535226b86

View File

@ -37,7 +37,9 @@
#include "Poco/TemporaryFile.h"
#include "Poco/Path.h"
#include "Poco/Exception.h"
#if !defined(POCO_VXWORKS)
#include "Poco/Process.h"
#endif
#include "Poco/Mutex.h"
#include <set>
#include <sstream>
@ -57,13 +59,13 @@ public:
{
for (std::set<std::string>::iterator it = _files.begin(); it != _files.end(); ++it)
{
try
{
File f(*it);
if (f.exists())
f.remove(true);
}
catch (Exception&)
try
{
File f(*it);
if (f.exists())
f.remove(true);
}
catch (Exception&)
{
}
}
@ -83,12 +85,16 @@ private:
};
TemporaryFile::TemporaryFile(): File(tempName()), _keep(false)
TemporaryFile::TemporaryFile():
File(tempName()),
_keep(false)
{
}
TemporaryFile::TemporaryFile(const std::string& tempDir): File(tempName(tempDir)), _keep(false)
TemporaryFile::TemporaryFile(const std::string& tempDir):
File(tempName(tempDir)),
_keep(false)
{
}
@ -122,26 +128,40 @@ void TemporaryFile::keepUntilExit()
}
namespace
{
static TempFileCollector fc;
}
void TemporaryFile::registerForDeletion(const std::string& path)
{
static TempFileCollector fc;
fc.registerFile(path);
fc.registerFile(path);
}
namespace
{
static FastMutex mutex;
}
std::string TemporaryFile::tempName(const std::string& tempDir)
{
std::ostringstream name;
static FastMutex mutex;
static unsigned long count = 0;
mutex.lock();
unsigned long n = count++;
mutex.unlock();
name << (tempDir.empty() ? Path::temp() : tempDir);
name << "tmp" << Process::id();
for (int i = 0; i < 6; ++i)
{
name << char('a' + (n % 26));
std::ostringstream name;
static unsigned long count = 0;
mutex.lock();
unsigned long n = count++;
mutex.unlock();
name << (tempDir.empty() ? Path::temp() : tempDir);
#if defined(POCO_VXWORKS)
name << "tmp";
#else
name << "tmp" << Process::id();
#endif
for (int i = 0; i < 6; ++i)
{
name << char('a' + (n % 26));
n /= 26;
}
return name.str();