本文整理汇总了C++中ObjectID::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectID::empty方法的具体用法?C++ ObjectID::empty怎么用?C++ ObjectID::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectID
的用法示例。
在下文中一共展示了ObjectID::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onRestoreMessage
void IdeMailBox::onRestoreMessage(IEvent *e)
{
HtmlEvent *htmlEvent = dynamic_cast<HtmlEvent *>(e);
if(htmlEvent == nullptr)
return;
ObjectID id = htmlEvent->get(0).to_ascii();
if(id.empty() == false)
{
// Elimina il messaggio
getPortal()->getMessenger()->moveMessageToInbox(getPage()->getDatabase(), getSessionAccount(), id);
// Mostra la posta in arrivo
_renderFolder(messageFolderInbox);
}
}
示例2: onDeleteMessage
void IdeMailBox::onDeleteMessage(IEvent *e)
{
HtmlEvent *htmlEvent = dynamic_cast<HtmlEvent *>(e);
if(htmlEvent == nullptr)
return;
ObjectID id = htmlEvent->get(0).to_ascii();
if(id.empty() == false)
{
// Elimina il messaggio
getPortal()->getMessenger()->moveMessageToTrash(getPage()->getDatabase(), getSessionAccount(), id);
// Mostra la directory di riferimento
_renderFolder(m_folder);
}
}
示例3: load
//bool EntitiesEntity::_loadObject(const shared_ptr<IPortalDatabase> &database, shared_ptr<ObjectsIRevisionable> object)
bool EntitiesEntity::load(const shared_ptr<IPortalDatabase> &database, const EntityID & id)
{
OS_TIMER_PERFORMANCE(TP, _S("Entity::_loadObject"));
OS_LOCK(m_cs);
#ifndef OS_TODOCIP
shared_ptr<ObjectsIRevisionable> object = objects_revisionable_cast(database->getPortal()->getObject(database, id.toUTF16()));
m_primary = object;
//OS_ASSERT(getEntityID() == id);
#endif
if(database->getPortal()->getSnapshotManager()->m_enableEnsureLoadingEntity)
database->getPortal()->getSnapshotManager()->ensure(database, id);
DataTable result;
// TOCLEAN_SNAPSHOT_SCORE
//String sql = String::format(_S("select current,visible,score,depth,parent,section,stability_date from os_snapshot_objects where reference='%S'").c_str(), m_primary->id->toUTF16().c_str());
String sql = String::format(_S("select type,current,visible,depth,parent,section,stability_date from os_snapshot_objects where entity='%S'").c_str(), id.toUTF16().c_str());
database->execute(sql, result);
if(!result.hasRow(0))
{
clear();
return false;
}
else
{
ObjectID currentID = static_cast<String>(result.get(0,_S("current"))).to_ascii();
m_type = Convert::toObjectType(static_cast<uint32>(result.get(0,_S("type"))));
m_visible = result.get(0,_S("visible"));
//m_score = *result.get(0,_S("score")); // TOCLEAN_SNAPSHOT_SCORE
m_depth = result.get(0,_S("depth"));
m_parent = static_cast<String>(result.get(0,_S("parent"))).to_ascii();
m_section = static_cast<String>(result.get(0,_S("section"))).to_ascii();
m_stabilityDate = String(result.get(0,_S("stability_date")));
if(id == ObjectsSystem::instance()->getRootID())
//m_current = objects_revisionable_cast(database->getPortal()->getObject(database, ObjectsSystem::instance()->getRootID().toObjectID()));
m_current = ObjectsSection::getRootSection();
else
{
#ifdef OS_TODOCIP
/*
if(currentID.empty())
return false;
m_current = objects_revisionable_cast(database->getPortal()->getObject(database, currentID));
if(m_current == nullptr)
return false;
*/
if(currentID.empty() == false)
m_current = objects_revisionable_cast(database->getPortal()->getObject(database, currentID));
#else
if(currentID.empty())
{
m_current.reset();
// OS_ASSERT(m_parent == ObjectsSystem::instance()->getSkippedID());
// No, dato che la getEntity non fa + l'ensure, può succedere che carica un oggetto non stabilizzato.
m_visible = false;
}
else
m_current = objects_revisionable_cast(database->getPortal()->getObject(database, currentID));
#endif
}
return true;
}
}
示例4: razorUpgrade
bool CompatibilityManager::razorUpgrade(const String &folder)
{
try
{
if(FileSystem::instance()->directoryExists(folder))
{
StringList portals;
FileSystem::instance()->getDirectories(folder, portals, false);
for(StringList::const_iterator i = portals.begin(); i != portals.end(); ++i)
{
// 000000018F94C9554C8B227CF000C6E30EB281AEAE1A77E7
String name = *i;
if(name.length() == 48)
{
// Portal < Razor
std::string oldID = name.to_ascii();
// Options
String oldPath = utils::standardisePath(folder + oldID);
shared_ptr<PortalOptions> options(OS_NEW PortalOptions());
// Carica le impostazioni del portale
if(options->readFromPath(oldPath) == false)
return false;
shared_ptr<IDbDriver> driver = DatabasesSystem::instance()->getDriver("sqlite");
// Query Database
shared_ptr<IDbConnection> connection = driver->createConnection(oldID, driver->createOptions());
connection->open();
String portalName = options->getName();
//String portalDescription = static_cast<String>(options->getOptionValue("description"));
NotificationsManager::instance()->notify(_S("Migration of '") + portalName + _S("' to 1.0 series"));
PlatformManager::instance()->sleep(500);
//ObjectID userID = static_cast<String>(m_portalOptions.getOption(options::users_reference)).to_ascii();
ObjectID userID = static_cast<String>(options->getOptionValue("users.reference")).to_ascii();
//bool monarchic = (options->getPortalID().getPortalType() == portalTypeMonarchic);
ID oldPortalID(oldID);
uint8 portalType = OS_UINT8_LO(oldPortalID.getHeader().getFirst());
bool monarchic = (portalType == 1);
// Calcolo UserID.
// Se non lo posso dedurre, uso il primo che trovo loggato.
if(userID.empty())
{
if(monarchic)
{
//userID = options->getPortalID().getAdministratorID();
#ifdef OS_NOOBJECTID
userID = oldPortalID.getHash();
#else
userID = ObjectID::generate(portalObjectTypeUser, oldPortalID.getHash());
#endif
}
else
{
String sql = String::EMPTY;
sql += _S(" select tp.profile, tu.reference ");
sql += _S(" from ");
sql += _S(" os_snapshot_profiles tp, ");
sql += _S(" os_snapshot_users tu ");
sql += _S(" where ");
sql += _S(" tp.profile=tu.profile and ");
sql += _S(" tu.score=1 and ");
sql += _S(" tu.follow=1 and ");
sql += _S(" tu.description='Auto valutation'");
shared_ptr<IDbResult> result = connection->query(sql);
DataTable table;
result->init(table);
DataTableRow row = table.addRow();
while(result->end() == false)
{
result->bind(row);
String objectID = static_cast<String>(*row[1]);
userID = objectID.to_ascii();
result->moveNext();
break;
}
}
}
#ifdef OS_NOOBJECTID
PovID povID = userID;
#else
PovID povID = userID.getHash();
#endif
if(userID.empty() == false)
{
// Clean old snapshot
//.........这里部分代码省略.........