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/TemporaryFile.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#if !defined(POCO_VXWORKS)
#include "Poco/Process.h" #include "Poco/Process.h"
#endif
#include "Poco/Mutex.h" #include "Poco/Mutex.h"
#include <set> #include <set>
#include <sstream> #include <sstream>
@ -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,23 +128,37 @@ void TemporaryFile::keepUntilExit()
} }
void TemporaryFile::registerForDeletion(const std::string& path) namespace
{ {
static TempFileCollector fc; static TempFileCollector fc;
}
void TemporaryFile::registerForDeletion(const std::string& path)
{
fc.registerFile(path); fc.registerFile(path);
} }
namespace
{
static FastMutex mutex;
}
std::string TemporaryFile::tempName(const std::string& tempDir) std::string TemporaryFile::tempName(const std::string& tempDir)
{ {
std::ostringstream name; std::ostringstream name;
static FastMutex mutex;
static unsigned long count = 0; static unsigned long count = 0;
mutex.lock(); mutex.lock();
unsigned long n = count++; unsigned long n = count++;
mutex.unlock(); mutex.unlock();
name << (tempDir.empty() ? Path::temp() : tempDir); name << (tempDir.empty() ? Path::temp() : tempDir);
#if defined(POCO_VXWORKS)
name << "tmp";
#else
name << "tmp" << Process::id(); name << "tmp" << Process::id();
#endif
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {
name << char('a' + (n % 26)); name << char('a' + (n % 26));