本文整理汇总了C++中ContentNode类的典型用法代码示例。如果您正苦于以下问题:C++ ContentNode类的具体用法?C++ ContentNode怎么用?C++ ContentNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContentNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getContentNodeByUrl
bool ContentNode::getContentNodeByUrl(QSqlDatabase& database,
const QString & url,
ContentNode & node)
{
QSqlQuery query(database);
query.prepare( "select id, name, location, title, authors, description, "
"last_access, publisher, "
"rating, read_time, read_count, progress, attributes "
"from content where md5 = :md5" );
query.bindValue(":md5", url);
if (query.exec() && query.next())
{
int index = 0;
node.id_ = query.value(index++).toInt();
node.name_ = query.value(index++).toString();
node.location_ = query.value(index++).toString();
node.title_ = query.value(index++).toString();
node.mutable_authors() = query.value(index++).toString();
node.mutable_description() = query.value(index++).toString();
node.mutable_last_access() = query.value(index++).toString();
node.mutable_publisher() = query.value(index++).toString();
node.mutable_md5() = url;
node.mutable_rating() = query.value(index++).toInt();
node.mutable_read_time() = query.value(index++).toInt();
node.mutable_read_count() = query.value(index++).toInt();
node.mutable_progress() = query.value(index++).toString();
node.mutable_attributes() = query.value(index++).toByteArray();
return true;
}
return false;
}
示例2: fromPath
void ContentNode::fromPath(ContentNode & node,const QString &path)
{
node.clear();
QFileInfo info(path);
node.mutable_name() = info.fileName();
node.mutable_location() = info.path();
node.mutable_size() = info.size();
}
示例3: getNContentNodes
bool ContentNode::hasItemNodes()
{
int nContentNodes = getNContentNodes();
for (int n=0; n<nContentNodes; n++) {
ContentNode *cnode = getContentNode(n);
if (cnode->isItemNode() == true)
return true;
}
return false;
}
示例4: getContentNode
bool ContentManager::addToRecentDocuments(const QString &doc_path)
{
ContentNode node;
getContentNode(node, doc_path);
if (node.id() == CMS_INVALID_ID)
{
return false;
}
return addToRecentDocuments(node.id());
}
示例5: removeContentNode
/// Remove content metadata for given content node. Caller should no longer
/// use the content node. This function also removes the content node
/// from its parent categories.
bool ContentManager::removeContentNode(ContentNode& info)
{
// Remove the options.
ContentOptions::removeOptions(*database_, info.id());
// Remove from content category table, which also removes
// from recent document list.
ContentCategory::removeContentCategory(*database_, info.id());
// Remove the content itself.
ContentNode::removeContentNode(*database_, info);
return true;
}
示例6: removeContentNode
bool ContentNode::removeContentNode(QSqlDatabase& database,
ContentNode& node)
{
QSqlQuery query(database);
query.prepare( "delete from content where id = ?");
query.addBindValue(node.id());
if (query.exec())
{
node.clear();
return true;
}
return false;
}
示例7: removeChildContent
/// Remove child content from specified category.
bool ContentManager::removeChildContent(ContentCategory & category,
const ContentNode & node)
{
return ContentCategory::removeChildContent(*database_,
category,
node.id());
}
示例8: getParentCategories
/// Retrieve parent category id list that contains the content.
bool ContentManager::getParentCategories(const ContentNode &node,
cms_ids & categories)
{
return ContentCategory::getContentParentCategories(*database_,
node.id(),
categories);
}
示例9: browseMetaData
ContentNode *MediaPlayer::getContentDirectory(Device *dev)
{
CyberXML::Node *rootNode = browseMetaData(dev, "0", "*", 0, 0, "");
if (rootNode == NULL)
return NULL;
ContentNode *contentRootNode = new RootNode();
contentRootNode->set(rootNode);
delete rootNode;
getContentDirectory(contentRootNode, dev, "0");
if (Debug::isOn() == true)
contentRootNode->print();
return contentRootNode;
}
示例10: getContentNode
bool ContentManager::removeRecentDocument(const QString &doc_path)
{
ContentNode node;
getContentNode(node, doc_path);
if (node.id() == CMS_INVALID_ID)
{
return false;
}
if (!ContentCategory::removeChildContent(*database_,
node.id()))
{
return false;
}
return true;
}
示例11: getID
ContentNode *ContentNode::findContentNodeByID(const char *id)
{
if (id == NULL)
return NULL;
string idStr = id;
const char *nodeID = getID();
if (idStr.compare(nodeID) == 0)
return this;
int nodeCnt = getNContentNodes();
for (int n=0; n<nodeCnt; n++) {
ContentNode *cnode = getContentNode(n);
ContentNode *fnode = cnode->findContentNodeByID(id);
if (fnode != NULL)
return fnode;
}
return NULL;
}
示例12: UpdateItemList
void UpdateItemList(int dirNum)
{
ListView_DeleteAllItems(ghItemListWindow);
MediaServer *mserver = gMediaGate->getMediaServer();
Directory *dir = mserver->getContentDirectory(dirNum);
if (dir == NULL)
return;
LVITEM item = {0};
item.mask = 0;
item.mask = LVIF_TEXT;
TCHAR buf[512] = { 0 } ;
int itemCnt = dir->getNContentNodes();
for (int n=0 ; n<itemCnt ; n++) {
ContentNode *conNode = dir->getContentNode(n);
if (conNode->isItemNode() == false)
continue;
ItemNode *itemNode = (ItemNode *)conNode;
FTL::CFConversion conv;
item.pszText = (LPTSTR)conv.MBCS_TO_TCHAR(itemNode->getTitle());
item.iItem = n;
item.iSubItem = 0;
ListView_InsertItem(ghItemListWindow , &item);
item.pszText = (LPTSTR)conv.MBCS_TO_TCHAR(itemNode->getCreator());
item.iSubItem = 1;
ListView_SetItem(ghItemListWindow , &item);
item.pszText = (LPTSTR)conv.MBCS_TO_TCHAR(itemNode->getDate());
item.iSubItem = 2;
ListView_SetItem(ghItemListWindow , &item);
_stprintf(buf, TEXT("%ld"), itemNode->getStorageUsed());
item.pszText = buf;
item.iSubItem = 3;
ListView_SetItem(ghItemListWindow , &item);
}
}
示例13: browseDirectChildren
int MediaPlayer::getContentDirectory(ContentNode *parentNode, Device *dev, const char *objectID)
{
if (objectID == NULL)
return 0;
CyberXML::Node *resultNode = browseDirectChildren(dev, objectID, "*", 0, 0, "");
if (resultNode == NULL)
return 0;
BrowseResult browseResult(resultNode);
//cout << browseResult.getNContentNodes() << endl;
int nResultNode = 0;
int nContents = browseResult.getNContentNodes();
for (int n=0; n<nContents; n++) {
Node *xmlNode = browseResult.getContentNode(n);
ContentNode *contentNode = NULL;
if (ContainerNode::isContainerNode(xmlNode) == true) {
contentNode = new ContainerNode();
}
if (ItemNode::isItemNode(xmlNode) == true)
contentNode = new BrowseResultNode();
if (contentNode == NULL)
continue;
contentNode->set(xmlNode);
parentNode->addContentNode(contentNode);
nResultNode++;
// Add Child Nodes
if (contentNode->isContainerNode() == true) {
ContainerNode *containerNode = (ContainerNode*)contentNode;
int childCnt = containerNode->getChildCount();
if (0 < childCnt) {
const char *objid = containerNode->getID();
getContentDirectory(contentNode, dev, objid);
}
}
}
delete resultNode;
return nResultNode;
}
示例14: latestReading
QString ContentManager::latestReading()
{
QString path;
cms_ids all;
if (!getRecentDocuments(all))
{
return path;
}
if (all.size() <= 0)
{
return path;
}
ContentNode node;
if (!getContentNode(all.front(), node))
{
return path;
}
return node.nativeAbsolutePath();
}
示例15: getNContentNodes
void DIDLLite::output(std::ostream& ps)
{
// Thanks for Brent Hills (10/26/04)
//ps << SOAP::VERSION_HEADER;
DIDLLiteNode didlNode;
string name = didlNode.getName();
string value = didlNode.getValue();
ps << "<" << name;
didlNode.outputAttributes(ps);
ps << ">" << endl;
int nNodes = getNContentNodes();
for (int n=0; n<nNodes; n++) {
ContentNode *contentNode = getContentNode(n);
contentNode->output(ps, 1, false);
}
ps << "</" << name << ">" << endl;
}