本文整理汇总了C++中NodePtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::get方法的具体用法?C++ NodePtr::get怎么用?C++ NodePtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isAllowed
bool WsDirNode::isAllowed(const set<string>& gids)
{
WsGlobalProperties* props = WsGlobalProperties::instance();
if (props->get("global", "public_site", "false") == "true") {
/* Public site access granted */
return true;
}
//lock the parent because we are using it to avoid free
NodePtr parent = m_parent.lock();
if ((m_properties.get() == 0 || m_properties.get()->getGroups().size() == 0) && parent.get() != 0) {
/* Check if inherit from parent is set to true in Global configuration */
if (props->get("global", "inherit_rights_from_parent", "false") == "true") {
/* Set to true, so Get right from parent */
return parent.get()->isAllowed(gids);
/* Check if inherit from parent set to true in Node conf */
} else if (m_properties.get()->get("global", "inherit_rights_from_parent", "false") == "true") {
if (!parent.get() == 0) {
/* get right from parent if not null */
return parent.get()->isAllowed(gids);
} else return false;
} else
return false;
} else {
/* We need the rights from the current node */
return m_properties.get()->isAllowed(gids);
}
}
示例2: LOG
vector<WsResultItem> WsMnoGoSearch::getResults(const set<string>& groups)
{
string path;
vector<WsResultItem> filteredResults;
list<WsResultItem>::iterator it;
NodePtr n;
LOG(DEBUG) << "WsMnoGoSearch::getResults() : Total found results before filter " << m_results.size();
for (it = m_results.begin(); it != m_results.end(); ++it) {
/* remove file://tmp/directories from path*/
path = (*it).getPath().string();
/* Get the node associated with the result */
n = m_fst->eatPath(path);
if (n.get() != 0) {
/* If it's a directory, skip it */
if ( n.get()->isDirectory() ) continue;
/* Check if user if allowed to access this node */
if (n.get()->isAllowed(groups)) {
string newPath = (*it).getFullPath().string();
std::time_t t = boost::filesystem::last_write_time(newPath);
(*it).setModifyDate(t);
(*it).setSize(boost::filesystem::file_size(newPath));
filteredResults.push_back(*it);
}
} else
LOG(ERROR) << "WsMnoGoSearch::getResults() : Error finding node " << path << endl;
}
LOG(DEBUG) << "WsMnoGoSearch :: Total found results after filter " << m_results.size();
return filteredResults;
}
示例3: loadMenu
void WsMenu::loadMenu(NodePtr pNodeParent, WMenu* menuParent)
{
std::vector<NodePtr> dirNode = pNodeParent.get()->getAll();
for (std::vector<NodePtr>::iterator it = dirNode.begin(); it != dirNode.end(); ++it) {
NodePtr curNode = *it;
if (curNode.get()->getDisplayInMenu())
createMenu(curNode, menuParent);
}
}
示例4: removeNode
void LazyGraph::removeNode(NodeId id)
{
NodePtr n = getNode(id);
nodeCache->changedResources.erase(n.get());
map<NodeId, long int>::iterator k = nodeOffsets.find(id);
if (k != nodeOffsets.end()) {
nodeOffsets.erase(k);
}
//n->owner = NULL;
nodeCache->changedResources.erase(n.get());
}
示例5: parse
NodeVector Parser::parse()
{
std::vector<Token> tokens = tokenize();
std::deque<NodePtr> stack;
stack.push_back(std::make_shared<Node>(CMD, "ROOT"));
NodePtr lastCompleted = nullptr;
while (tokens.size() && stack.size()) {
NodePtr node;
Token tok = tokens.front();
tokens.erase(tokens.begin());
if (tok.type == TokType::RAW) {
node = std::make_shared<Node>(TEXT, tok.str);
stack.back()->addChild(node);
} else if (tok.type == TokType::CMD_BEG) {
node = std::make_shared<Node>(CMD, tok.str);
stack.push_back(node);
} else if (tok.type == TokType::CMD_CNT) {
node = std::make_shared<TmpNode>(TMP, "");
((TmpNode*)node.get())->setParent(lastCompleted);
stack.push_back(node);
} else if (tok.type == TokType::CMD_END) {
node = stack.back();
stack.pop_back();
if (!stack.size())
throw std::runtime_error("Too many CMD_ENDs");
if (node->getType() == TMP) {
if (!lastCompleted)
throw std::runtime_error("Noone to absorb children");
NodePtr parent = ((TmpNode*)node.get())->getParent();
parent->absorb(node->getChildren(), 1);
} else {
if (node->getType() == CMD)
lastCompleted = node;
stack.back()->addChild(node);
}
}
}
if (tokens.size())
throw std::runtime_error("Unconsomed tokens");
if (stack.size() != 1)
throw std::runtime_error("Invalid format - !1 stack elems");
NodeVector vec = stack.front()->getChildren(0);
return vec;
}
示例6: Attache
void LinkedNode::Attache(LinkedNode* father_node,u32 transformcode)
{
if (father_)
{
//ret == this
//use ret to keep this pointer not to be deleted
NodePtr ret = father_->RemoveChild(name_);
Assert(ret.get()==this);
father_node->InsertChild(ret.get());
}
else
father_node->InsertChild(this);
transform_code_ = transformcode;
}
示例7: _connect
bool LocalNode::_connect( NodePtr node, ConnectionPtr connection )
{
EQASSERT( connection.isValid( ));
EQASSERT( node->getNodeID() != getNodeID( ));
if( !node.isValid() || _state != STATE_LISTENING ||
!connection->isConnected() || node->_state != STATE_CLOSED )
{
return false;
}
_addConnection( connection );
// send connect packet to peer
NodeConnectPacket packet;
packet.requestID = registerRequest( node.get( ));
packet.nodeID = _id;
packet.nodeType = getType();
connection->send( packet, serialize( ));
bool connected = false;
if( !waitRequest( packet.requestID, connected, 10000 /*ms*/ ))
{
EQWARN << "Node connection handshake timeout - peer not a Collage node?"
<< std::endl;
return false;
}
if( !connected )
return false;
EQASSERT( node->_id != NodeID::ZERO );
EQASSERTINFO( node->_id != _id, _id );
EQINFO << node << " connected to " << *(Node*)this << std::endl;
return true;
}
示例8: dumpBT
void dumpBT(std::ostream& out, NodePtr<BacktraceFrame> frame) {
if (frame == nullptr)
return;
auto value = frame->get();
out << " " << std::get<1>(value) << "(" << std::get<0>(value) << ")";
dumpBT(out, popNode(frame));
}
示例9: doEditPage
void WsContent::doEditPage(std::string path)
{
std::string newPath = path;
boost::algorithm::replace_first(newPath, "/Edit", "");
boost::algorithm::replace_first(newPath, "/SiteMap", "");
std::string sPathWithoutPrefix = WsApp->WsModules().pathWithoutPrefix(newPath); // ex. /SiteMap
std::string sysPath(m_sDocumentRoot + sPathWithoutPrefix);
WsUser* pUser = WsApp->wsUser();
NodePtr pNode = pUser->getAccessRoot()->eatPath(sPathWithoutPrefix);
if (!pNode.get() ) {
addWidget(new WsErrorPage(WsErrorPage::Error, path, pUser, "Returned node is null"));
return;
}
clear();
setOverflow(WContainerWidget::OverflowAuto);
WVBoxLayout* vbox = new WVBoxLayout();
setLayout(vbox);
WsFormConfig* m_formConfig = new WsFormConfig(pNode, WsApp->WsModules());
vbox->addWidget(m_formConfig, 0);
vbox->addWidget(WsApp->WsModules().module("WsModEditorUploader")->createContents());
std::string strExt(boost::filesystem::extension(sPathWithoutPrefix));
if ( strExt == ".fhtml" ) {
if ( !gdcore_isPathFile(sysPath) ) return;
gdFHtmlEditor* pEditor = new gdFHtmlEditor("", false);
pEditor->setCurrentPath(sysPath);
pEditor->readFile();
m_formConfig->setEditorFhtml(pEditor);
pEditor->resize(WLength(100, WLength::Percentage), WLength(400));
vbox->addWidget(pEditor, 1);
}
}
示例10: getPreviousNode
NodeImpl *TreeWalkerImpl::previousNode( void*& filterException )
{
NodePtr n = getPreviousNode(filterException);
if( n )
m_currentNode = n;
return n.get();
}
示例11: getNextSibling
NodeImpl *TreeWalkerImpl::nextSibling( void*& filterException )
{
NodePtr n = getNextSibling( m_currentNode, filterException );
if( n )
m_currentNode = n;
return n.get();
}
示例12: getLastChild
NodeImpl *TreeWalkerImpl::lastChild( void*& filterException )
{
NodePtr n = getLastChild(m_currentNode, filterException);
if( n )
m_currentNode = n;
return n.get();
}
示例13: getParentNode
NodeImpl *TreeWalkerImpl::parentNode( void*& filterException )
{
NodePtr n = getParentNode( m_currentNode, filterException );
if ( n )
m_currentNode = n;
return n.get();
}
示例14: newNode
NodePtr LazyGraph::newNode(const vec2d &p)
{
NodeId id = nextNodeId;
nextNodeId.id++;
NodePtr n = new LazyNode(this, id, p.x, p.y);
if (mapping != NULL) {
mapping->insert(make_pair(p, n.get()));
}
nodes.insert(make_pair(id, n.get()));
if (nodeOffsets.find(id) == nodeOffsets.end()) {
nodeOffsets.insert(make_pair(id, (long int) - 1));
}
nodeCache->add(n.get(), true);
return n;
}
示例15: addSub
int WsTreeDeserializer::addSub(const Value& v, NodePtr n)
{
/* Iterate on nodes of current level in Json file and add it as children of node n */
for (ValueIterator itr = v.begin() ; itr != v.end() ; ++itr) {
Value v1 = *itr;
path p(itr.key().asString());
if (v1["type"].asString() == "DIRECTORY") {
/* Create node */
NodePtr temp = NodePtr(new WsDirNode(p, m_rootPath));
n.get()->addChildDirectory(temp);
/* Set its properties */
temp.get()->setProperties(NodePropertiesPtr(new WsNodeProperties(v1["properties"].toStyledString())));
temp.get()->setModifyDate(v1["modifdate"].asDouble());
temp.get()->setCreateDate(v1["creatdate"].asDouble());
/* No children */
if (v1["children"] == Value::null) {
continue;
}
/* Add children because current node is directory*/
addSub(v1["children"], temp);
} else {
/* current node is file, add only children to parent (n) */
NodePtr temp = NodePtr(new WsFileNode(p, m_rootPath));
n.get()->addChildFile(temp);
temp.get()->setProperties(NodePropertiesPtr(new WsNodeProperties(v1["properties"].toStyledString())));
temp.get()->setModifyDate(v1["modifdate"].asDouble());
temp.get()->setCreateDate(v1["creatdate"].asDouble());
temp.get()->setSize(v1["size"].asDouble());
}
}
return ErrorCode::Success;
}