整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

View file

@ -0,0 +1,44 @@
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include "PocoConfigurationCopier.h"
#include <Poco/Util/JSONConfiguration.h>
namespace Util
{
/*
*******************************************************************************
* CLASS DEFINE
*******************************************************************************
*/
void PocoConfigurationCopier::copy(Poco::Util::AbstractConfiguration::Ptr& from,
Poco::Util::AbstractConfiguration::Ptr& to)
{
bool usingJSON = false;
if (to.isNull())
{
to = new Poco::Util::JSONConfiguration();
usingJSON = true;
}
else
usingJSON = !to.cast<Poco::Util::JSONConfiguration>().isNull();
Poco::AutoPtr<Poco::Util::JSONConfiguration> pJConfig = from.cast<Poco::Util::JSONConfiguration>();
if (pJConfig && usingJSON)
{
std::stringstream ss;
pJConfig->save(ss);
to.cast<Poco::Util::JSONConfiguration>()->load(ss);
}
else
{
Poco::Util::AbstractConfiguration::Keys keys;
from->keys(keys);
for (const auto& key : keys)
to->setString(key, from->getString(key));
}
}
}