本文整理汇总了C++中content函数的典型用法代码示例。如果您正苦于以下问题:C++ content函数的具体用法?C++ content怎么用?C++ content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了content函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: while
PRBool
nsXFormsSelectableItemAccessible::IsItemSelected()
{
nsresult rv;
nsINode* parent = mContent;
while ((parent = parent->GetNodeParent())) {
nsCOMPtr<nsIContent> content(do_QueryInterface(parent));
if (!content)
return PR_FALSE;
nsCOMPtr<nsINodeInfo> nodeinfo = content->NodeInfo();
if (!nodeinfo->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS)))
continue;
nsCOMPtr<nsIDOMNode> select(do_QueryInterface(parent));
if (!select)
continue;
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
if (nodeinfo->Equals(nsAccessibilityAtoms::select)) {
PRBool isSelected = PR_FALSE;
rv = sXFormsService->IsSelectItemSelected(select, DOMNode, &isSelected);
return NS_SUCCEEDED(rv) && isSelected;
}
if (nodeinfo->Equals(nsAccessibilityAtoms::select1)) {
nsCOMPtr<nsIDOMNode> selitem;
rv = sXFormsService->GetSelectedItemForSelect1(select,
getter_AddRefs(selitem));
return NS_SUCCEEDED(rv) && (selitem == DOMNode);
}
}
return PR_FALSE;
}
开发者ID:gorakhargosh,项目名称:mozilla-central,代码行数:36,代码来源:nsXFormsAccessible.cpp
示例2: guard
bool Game::addClient(book::Client* client)
{
sf::Lock guard(_teamMutex);
Team::type_ptr clientTeam = nullptr;
for(Team::type_ptr team : _teams)
{
if(team->getClients().size() == 0 and team->isGameOver())
{
clientTeam = team;
break;
}
}
sf::Packet response;
if(clientTeam != nullptr)
{
//send map informations
std::ifstream file(_mapFileName);
std::string content((std::istreambuf_iterator<char>(file)),(std::istreambuf_iterator<char>()));
book::packet::JoinGameConfirmation conf(content,clientTeam->id());
for(Team::type_ptr team : _teams)
{
book::packet::JoinGameConfirmation::Data data;
data.team = team->id();
data.gold = team->getGold();
data.color = team->getColor();
conf.addTeam(std::move(data));
}
response<<conf;
client->send(response);
{
//send initial content
response.clear();
sf::Lock gameGuard(_gameMutex);
book::packet::CreateEntity datas;
for(auto id : entities)
addCreate(datas,id);
response<<datas;
client->send(response);
}
std::cout<<"Add client to game"<<std::endl;
client->setTeam(clientTeam);
sf::Lock guardClients(_clientsMutex);
_clients.emplace_back(client);
}
else
{
response<<book::packet::JoinGameReject(_id);
client->send(response);
}
return clientTeam != nullptr;
}
开发者ID:Chiranjivee,项目名称:SFML-book,代码行数:62,代码来源:Game.cpp
示例3: content
//----------------------------------------------------------------------------
// SAXParsor::parse_node
//----------------------------------------------------------------------------
void SAXParsor::parse_node(void *_pNode, INodeAnalyser* pAnalyser)
{
xmlNode *pNode = (xmlNode *)_pNode;
xmlNode *pCurrentNode;
yat::String current_file;
for( pCurrentNode = pNode; pCurrentNode != NULL; pCurrentNode = pCurrentNode->next )
{
// Default : next target is the same target
INodeAnalyser *pNextAnalyser = pAnalyser;
yat::String element_name;
if( pCurrentNode->type == XML_ELEMENT_NODE )
{
element_name = (const char *)(pCurrentNode->name);
// Search for 'xml:base' attribute
for( xmlAttr *pAttr = pCurrentNode->properties; pAttr; pAttr = pAttr->next )
{
if( yat::String((const char *)(pAttr->name)).is_equal_no_case("base") )
{
yat::String content((const char *)(pAttr->children->content));
if( content.find('/') != std::string::npos )
// Remove path part of the base attribute value
content.extract_token_right('/', ¤t_file);
}
}
Attributes attributes;
xmlAttr *pAttr = NULL;
for( pAttr = pCurrentNode->properties; pAttr; pAttr = pAttr->next )
{
yat::String value((const char *)(pAttr->children->content));
yat::String name((const char *)(pAttr->name));
// Search for substitute in defines dictionnary
attributes[name] = value;
}
if( NULL != pAnalyser )
pNextAnalyser = pAnalyser->on_element(element_name, attributes, current_file);
}
else if (pCurrentNode->type == XML_TEXT_NODE && !xmlIsBlankNode(pCurrentNode) )
{
// Retreives element name
yat::String element_name((const char *)(pCurrentNode->parent->name));
yat::String content((const char *)(pCurrentNode->content));
// Remove wasted white spaces
content.trim();
// Process content
if( NULL != pAnalyser )
pAnalyser->on_element_content(element_name, content, current_file);
}
if( NULL != pNextAnalyser )
{
// Parse children node using the next analyser
parse_node(pCurrentNode->children, pNextAnalyser);
if( pNextAnalyser != pAnalyser )
{
// Analyser created on previous call to OnElement no longer in use
pNextAnalyser->release();
}
}
// Notify target for end parsing
if( pCurrentNode->type == XML_ELEMENT_NODE && NULL != pNextAnalyser )
pAnalyser->on_end_element(element_name);
}
}
开发者ID:nhauser,项目名称:cdma,代码行数:77,代码来源:SAXParsor.cpp
示例4: doc
void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
nsIDOMRange* aRange)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aWindow->GetDocument(getter_AddRefs(domDoc));
if (!domDoc) return;
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
nsIPresShell* presShell = doc->GetShell();
if (!presShell) return;
nsCOMPtr<nsIDOMNode> node;
aRange->GetStartContainer(getter_AddRefs(node));
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
nsIFrame* frame = content->GetPrimaryFrame();
if (!frame)
return;
nsCOMPtr<nsISelectionController> selCon;
frame->GetSelectionController(presShell->GetPresContext(),
getter_AddRefs(selCon));
// since the match could be an anonymous textnode inside a
// <textarea> or text <input>, we need to get the outer frame
nsITextControlFrame *tcFrame = nullptr;
for ( ; content; content = content->GetParent()) {
if (!IsInNativeAnonymousSubtree(content)) {
nsIFrame* f = content->GetPrimaryFrame();
if (!f)
return;
tcFrame = do_QueryFrame(f);
break;
}
}
nsCOMPtr<nsISelection> selection;
selCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL,
getter_AddRefs(selection));
if (selection) {
selection->RemoveAllRanges();
selection->AddRange(aRange);
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
if (fm) {
if (tcFrame) {
nsCOMPtr<nsIDOMElement> newFocusedElement(do_QueryInterface(content));
fm->SetFocus(newFocusedElement, nsIFocusManager::FLAG_NOSCROLL);
}
else {
nsCOMPtr<nsIDOMElement> result;
fm->MoveFocus(aWindow, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
nsIFocusManager::FLAG_NOSCROLL,
getter_AddRefs(result));
}
}
// Scroll if necessary to make the selection visible:
// Must be the last thing to do - bug 242056
// After ScrollSelectionIntoView(), the pending notifications might be
// flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
selCon->ScrollSelectionIntoView
(nsISelectionController::SELECTION_NORMAL,
nsISelectionController::SELECTION_WHOLE_SELECTION,
nsISelectionController::SCROLL_CENTER_VERTICALLY |
nsISelectionController::SCROLL_SYNCHRONOUS);
}
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:69,代码来源:nsWebBrowserFind.cpp
示例5: setContent
void ChatWindowStyle::inheritContent(InternalIdentifier subType, InternalIdentifier superType)
{
if (content(subType).isEmpty()) {
setContent(subType, content(superType));
}
}
开发者ID:R4md4c,项目名称:ktp-text-ui,代码行数:6,代码来源:chat-window-style.cpp
示例6: content
QString ChatWindowStyle::getOutgoingStateUnknownHtml() const
{
return content(OutgoingStateUnknown);
}
开发者ID:R4md4c,项目名称:ktp-text-ui,代码行数:4,代码来源:chat-window-style.cpp
示例7: onScrollToY
void PeerListBox::searchQueryChanged(const QString &query) {
onScrollToY(0);
content()->searchQueryChanged(query);
}
开发者ID:zhangsoledad,项目名称:tdesktop,代码行数:4,代码来源:peer_list_box.cpp
示例8: NS_ASSERTION
bool
nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
nsPresContext *aPresContext,
nsIDOMRange *aRange, bool aMustBeInViewPort,
bool aGetTopVisibleLeaf,
nsIDOMRange **aFirstVisibleRange,
bool *aUsesIndependentSelection)
{
NS_ASSERTION(aPresShell && aPresContext && aRange && aFirstVisibleRange,
"params are invalid");
// We need to know if the range start is visible.
// Otherwise, return the first visible range start
// in aFirstVisibleRange
aRange->CloneRange(aFirstVisibleRange);
nsCOMPtr<nsIDOMNode> node;
aRange->GetStartContainer(getter_AddRefs(node));
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
if (!content)
return false;
nsIFrame *frame = content->GetPrimaryFrame();
if (!frame)
return false; // No frame! Not visible then.
if (!frame->StyleVisibility()->IsVisible())
return false;
// Detect if we are _inside_ a text control, or something else with its own
// selection controller.
if (aUsesIndependentSelection) {
*aUsesIndependentSelection =
(frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION);
}
// ---- We have a frame ----
if (!aMustBeInViewPort)
return true; // Don't need it to be on screen, just in rendering tree
// Get the next in flow frame that contains the range start
int32_t startRangeOffset, startFrameOffset, endFrameOffset;
aRange->GetStartOffset(&startRangeOffset);
while (true) {
frame->GetOffsets(startFrameOffset, endFrameOffset);
if (startRangeOffset < endFrameOffset)
break;
nsIFrame *nextContinuationFrame = frame->GetNextContinuation();
if (nextContinuationFrame)
frame = nextContinuationFrame;
else
break;
}
// Set up the variables we need, return true if we can't get at them all
const uint16_t kMinPixels = 12;
nscoord minDistance = nsPresContext::CSSPixelsToAppUnits(kMinPixels);
// Get the bounds of the current frame, relative to the current view.
// We don't use the more accurate AccGetBounds, because that is
// more expensive and the STATE_OFFSCREEN flag that this is used
// for only needs to be a rough indicator
nsRectVisibility rectVisibility = nsRectVisibility_kAboveViewport;
if (!aGetTopVisibleLeaf && !frame->GetRect().IsEmpty()) {
rectVisibility =
aPresShell->GetRectVisibility(frame,
nsRect(nsPoint(0,0), frame->GetSize()),
minDistance);
if (rectVisibility != nsRectVisibility_kAboveViewport) {
return true;
}
}
// We know that the target range isn't usable because it's not in the
// view port. Move range forward to first visible point,
// this speeds us up a lot in long documents
nsCOMPtr<nsIFrameEnumerator> frameTraversal;
nsCOMPtr<nsIFrameTraversal> trav(do_CreateInstance(kFrameTraversalCID));
if (trav)
trav->NewFrameTraversal(getter_AddRefs(frameTraversal),
aPresContext, frame,
eLeaf,
false, // aVisual
false, // aLockInScrollView
false // aFollowOOFs
);
if (!frameTraversal)
return false;
while (rectVisibility == nsRectVisibility_kAboveViewport) {
frameTraversal->Next();
frame = frameTraversal->CurrentItem();
if (!frame)
return false;
//.........这里部分代码省略.........
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:101,代码来源:nsTypeAheadFind.cpp
示例9: QLatin1String
QString ItemRDFImpl::id() const
{
if (!m_item.resource()->isAnon())
return m_item.resource()->uri();
else
return QLatin1String("hash:") + calcMD5Sum(title() + description() + link() + content());
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:7,代码来源:itemrdfimpl.cpp
示例10: file
Sprite::Sprite(GameObject * object, std::string asset, std::string selectAsset)
{
object_ = object;
artAsset_ = asset;
selectArtAsset_ = selectAsset;
texture_ = nullptr;
renderer_ = nullptr;
height_ = object->height();
width_ = object->width();
currentAction_ = ACTION_IDLE;
currentDirection_ = object_->rotation();
// open xml doc
rapidxml::xml_document<> doc;
//std::ifstream file(kAssetSpriteXMLZombie);
std::ifstream file(kAssetSpriteXMLHuman);
std::stringstream buffer;
buffer << file.rdbuf();
file.close();
std::string content(buffer.str());
doc.parse<0>(&content[0]);
rapidxml::xml_node<> *sprite = doc.first_node(); // this is the sprite element
// Iterate through animations
for(rapidxml::xml_node<> *animation = sprite->first_node("animation"); animation; animation = animation->next_sibling()) {
std::string animationKey;
int animationTime;
for (rapidxml::xml_attribute<> *attribute = animation->first_attribute(); attribute; attribute = attribute->next_attribute()) {
std::string attributeName = attribute->name();
if(attributeName.compare("key") == 0) {
animationKey = attribute->value();
}
else if(attributeName.compare("time") == 0) {
animationTime = atoi(attribute->value());
}
}
//Logger::write(Logger::ss << "Reading Animation: " << animationKey);
Animation thisAnimation(animationKey, animationTime);
// Iterate through frames
for(rapidxml::xml_node<> *frame = animation->first_node("frame"); frame; frame = frame->next_sibling()) {
std::string frameKey;
int frameX, frameY, frameWidth, frameHeight;
// Iterate through attributes
for (rapidxml::xml_attribute<> *attribute = frame->first_attribute(); attribute; attribute = attribute->next_attribute()) {
std::string attributeName = attribute->name();
if(attributeName.compare("key") == 0) {
frameKey = attribute->value();
}
else if(attributeName.compare("x") == 0) {
frameX = atoi(attribute->value());
}
else if(attributeName.compare("y") == 0) {
frameY = atoi(attribute->value());
}
else if(attributeName.compare("width") == 0) {
frameWidth = atoi(attribute->value());
}
else if(attributeName.compare("height") == 0) {
frameHeight = atoi(attribute->value());
}
}
SDL_Rect thisFrame = { frameX, frameY, frameWidth, frameHeight };
thisAnimation.insertFrame(animationKey + frameKey, thisFrame);
}
animations_.insert(std::pair<std::string, Animation>(animationKey, thisAnimation));
}
animationTimer_.start();
currentAnimation_ = animations_["idleRight"];
double rotation = object_->rotation();
if((rotation >= 45) && (rotation <= 135)) {
currentAnimation_ = animations_["idleDown"];
}
else if((rotation >= 135) && (rotation <= 225)) {
currentAnimation_ = animations_["idleLeft"];
}
else if((rotation >= 225) && (rotation <= 315)) {
currentAnimation_ = animations_["idleUp"];
}
else {
currentAnimation_ = animations_["idleRight"];
}
}
开发者ID:jdmack,项目名称:tlb,代码行数:100,代码来源:Sprite.cpp
示例11: getValueFromOs_release
static std::string getValueFromOs_release(std::string key)
{
FILE* os_rel = fopen("/etc/os-release", "r");
if (!os_rel)
return "";
char* buf = new char[10 * 1024]; // more than enough
size_t len = fread(buf, 1, 10 * 1024, os_rel);
fclose(os_rel);
if (len == 0)
{
delete[] buf;
return "";
}
std::string content(buf, len);
delete[] buf;
// find begin of value string
size_t valStart = 0, seachPos;
key += '=';
if (content.compare(0, key.length(), key) == 0)
valStart = key.length();
else
{
key = "\n" + key;
seachPos = 0;
do
{
seachPos = content.find(key, seachPos);
if (seachPos == std::string::npos)
return "";
if (seachPos == 0 || content[seachPos - 1] != '\\')
valStart = seachPos + key.length();
else
seachPos++;
} while (valStart == 0);
}
if (content[valStart] == '\n')
return "";
// find end of value string
seachPos = valStart;
do
{
seachPos = content.find('\n', seachPos + 1);
} while (seachPos != std::string::npos && content[seachPos - 1] == '\\');
size_t const valEnd = seachPos;
std::string value(content, valStart, valEnd - valStart);
if (value.empty())
return value;
// remove quotes
if (value[0] == '\'' || value[0] == '"')
{
if (value.length() < 2)
return value;
size_t qEnd = value.rfind(value[0]);
if (qEnd != std::string::npos)
{
value.erase(qEnd);
value.erase(0, 1);
}
}
// unescape characters
for (size_t slashPos = value.find('\\'); slashPos < value.length() - 1; slashPos = value.find('\\', slashPos))
{
if (value[slashPos + 1] == '\n')
value.erase(slashPos, 2);
else
{
value.erase(slashPos, 1);
slashPos++; // skip unescaped character
}
}
return value;
}
开发者ID:MrMC,项目名称:mrmc,代码行数:81,代码来源:SystemInfo.cpp
示例12: vector_cb_per_field
void vector_cb_per_field(char *field_buffer, size_t field_length, struct vector_cb_data *data) {
std::string content(field_buffer, field_length);
data->lines[data->lines.size() - 1].push_back(content);
}
开发者ID:came,项目名称:hyrise,代码行数:4,代码来源:GenericCSV.cpp
示例13: return
bool ChatWindowStyle::hasActionTemplate() const
{
return (!content(ActionIncoming).isEmpty() && !content(ActionOutgoing).isEmpty());
}
开发者ID:R4md4c,项目名称:ktp-text-ui,代码行数:4,代码来源:chat-window-style.cpp
示例14: connect
connect(p , SIGNAL( rename(AbstractFile*) ),
this, SLOT ( rename(AbstractFile*) ) );
connect(p , SIGNAL( deletion(AbstractFile*) ),
this, SLOT ( deletion(AbstractFile*) ) );
connect(p , SIGNAL( addFile(DevFolder*) ),
this, SLOT ( addFile(DevFolder*) ) );
connect(p , SIGNAL( subFolder(DevFolder*) ),
this, SLOT ( subFolder(DevFolder*) ) );
DevTreeMap::insert(i, p);
DevProjectMap::insert(name, p);
addTopLevelItem(i);
DevScope *top = p->global;
QStringList keys, cfg = p->content("CONFIG");
keys<<"SOURCES"<<"HEADERS"<<"FORMS"<<"RESOURCES"<<"TRANSLATIONS";
createNested(top, keys, cfg, i);
expandItem(i);
scrollToItem(i, QAbstractItemView::PositionAtTop);
return true;
}
void DevWorkSpace::createNested(DevScope *s, const QStringList& vars,
const QStringList& cfg, QTreeWidgetItem *i)
{
for (DevScopeMap::iterator it = s->nest.begin(); it != s->nest.end(); it++)
{
开发者ID:BackupTheBerlios,项目名称:devqt-svn,代码行数:31,代码来源:devworkspace.cpp
示例15: urlhandle
http::doc urlhandle(const std::string &url, const std::string &querystr, const uint32_t remoteip)
{
//std::cout << url << "\n";
const uint32_t localip = util::str2ip("127.0.0.1"); // TODO Make this configurable
std::vector<std::string> path = util::strsplit(url, '/');
if (path.size() && path[0] == "") path.erase(path.begin());
for (std::string &elem : path) elem = util::urldecode(elem);
std::unordered_map<std::string, std::string> query{};
if (querystr.size() > 0) for (const std::string &qu : util::strsplit(querystr, '&'))
{
std::string::size_type idx = qu.find("=");
if (idx == qu.npos) query[util::urldecode(qu)] = "";
else query[util::urldecode(qu.substr(0, idx), true)] = util::urldecode(qu.substr(idx + 1), true);
}
try
{
if (path.size() == 0 || path[0] == "") return home(remoteip == localip);
if (path[0] == "search" || path[0] == "view" || path[0] == "content" || path[0] == "complete" || path[0] == "titles" || path[0] == "shuffle")
{
if (path.size() < 2) return error("Bad Request", "Missing volume ID");
if (! volumes.check(path[1])) return error("Not Found", "No volume with ID “" + path[1] + "” exists");
std::string input{};
std::string::const_iterator start = util::find_nth(url.begin(), url.end(), '/', 3) + 1;
if (start > url.end()) input = "";
else input = util::urldecode(std::string{start, url.end()});
std::string input_qstr = input + (querystr.size() ? "?" + querystr : "");
if (path[0] == "search") return search(volumes.get(path[1]), input_qstr);
else if (path[0] == "view") return content(volumes.get(path[1]), input, true);
else if (path[0] == "complete") return complete(volumes.get(path[1]), input_qstr);
else if (path[0] == "titles") return titles(volumes.get(path[1]), input_qstr);
else if (path[0] == "shuffle") return shuffle(volumes.get(path[1]));
else return content(volumes.get(path[1]), input);
}
else if (path[0] == "load" || path[0] == "unload")
{
if (path.size() < 2) return error("Bad Request", "Missing category name");
if (path[0] == "load") return loadcat(path[1]);
else return unloadcat(path[1]);
}
else if (path[0] == "external")
{
if (path.size() < 2) return error("Bad Request", "Missing external path");
if (remoteip != localip) return error("Denied", "You do not have permission to access this functionality");
return http::doc{"text/plain", volumes.load_external(path[1])};
}
else if (path[0] == "pref") return pref();
else if (path[0] == "rsrc") return rsrc(util::strjoin(path, '/', 1));
else if (path[0] == "add") return http::doc{resource("html/add.html")};
else if (path[0] == "action")
{
if (path.size() < 2) return error("Bad Request", "No action selected");
if (remoteip != localip) return error("Denied", "You do not have permission to access this functionality");
return action(path[1], query);
}
else throw handle_error{"Unknown action “" + path[0] + "”"};
}
catch (std::exception &e)
{
return error("Error", e.what());
}
}
开发者ID:showermat,项目名称:zsr-utils,代码行数:61,代码来源:zsrsrv.cpp
注:本文中的content函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论