mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-07 21:37:14 +01:00
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
51 lines
913 B
C++
51 lines
913 B
C++
//
|
|
// uuidgen.cpp
|
|
//
|
|
// This sample demonstrates the UUIDGenerator and UUID classes.
|
|
//
|
|
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#include "Poco/UUID.h"
|
|
#include "Poco/UUIDGenerator.h"
|
|
#include "Poco/Exception.h"
|
|
#include <iostream>
|
|
|
|
|
|
using Poco::UUID;
|
|
using Poco::UUIDGenerator;
|
|
using Poco::Exception;
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
UUID uuid;
|
|
|
|
std::string arg;
|
|
if (argc > 1)
|
|
arg = argv[1];
|
|
|
|
try
|
|
{
|
|
if (arg == "-random")
|
|
uuid = UUIDGenerator::defaultGenerator().createRandom();
|
|
else if (arg.empty())
|
|
uuid = UUIDGenerator::defaultGenerator().create();
|
|
else
|
|
uuid = UUIDGenerator::defaultGenerator().createFromName(UUID::uri(), arg);
|
|
|
|
std::cout << uuid.toString() << std::endl;
|
|
}
|
|
catch (Exception& exc)
|
|
{
|
|
std::cerr << exc.displayText() << std::endl;
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|