本文整理汇总了C++中Entry::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ Entry::Name方法的具体用法?C++ Entry::Name怎么用?C++ Entry::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEntry
void PhoneBook::AddEntry(const Entry& anEntry) {
const char* pName = anEntry.Name();
if (pName && pName != '\0') {
int length = strlen(pName);
char key;
Node* currNode = iRoot;
Node* childNode = NULL;
Entry blankEntry(NULL, NULL);
for (int index = 0; index < length; index++) {
key = pName[index];
childNode = currNode->GetChildNodeByKey(key);
//if this is a new node, create one
if (!childNode) {
//If we have reaches the last character, then its a terminal node
if (index == length-1) {
//So store the Entry
childNode = new Node(key, anEntry);
childNode->IsTerminal(true);
}
else {
//Not a terminal node, so dont have to store anything, store some dummy value
childNode = new Node(key, blankEntry);
}
//Add the Node to the currNode
currNode->AddChild(childNode);
currNode = childNode;
}
else {
currNode = childNode;
}
}
}
}
示例2: OnTreeSelectionChanged
void MainFrame::OnTreeSelectionChanged(wxTreeEvent &event) {
auto treeItemId = event.GetItem();
auto rootId = dirTree->GetRootItem();
auto currentFileEntry =
dynamic_cast<EntryItemData *>(dirTree->GetItemData(treeItemId))->Get();
auto gridPanel = dynamic_cast<wxScrolledWindow *>(splitter->GetWindow2());
if (loadThread) {
loadThread->Delete(nullptr, wxTHREAD_WAIT_BLOCK);
loadThread = nullptr;
}
gridPanel->Show(false);
auto grid = gridPanel->GetSizer();
grid->Clear(true);
std::vector<Entry *> loadEntries;
imgButtons.clear();
for (int i = 0; i < currentFileEntry->Count(); ++i) {
Entry *childEntry = (*currentFileEntry)[i];
if (childEntry->IsDirectory())
continue;
auto ext = childEntry->Name().AfterLast('.').Lower();
if (ext != "jpg" && ext != "jpeg" && ext != "png" && ext != "gif")
continue;
loadEntries.push_back(childEntry);
}
for (auto entry : loadEntries) {
auto button = new wxButton(gridPanel, wxID_ANY, "", wxDefaultPosition,
wxDefaultSize, wxBU_EXACTFIT);
imgButtons.push_back(button);
button->Bind(wxEVT_BUTTON, &MainFrame::OnImageButtonClick, this);
button->SetClientObject(new EntryItemData(entry));
button->SetMinSize({250, 250});
auto staticText = new wxStaticText(gridPanel, wxID_ANY, entry->Name());
staticText->SetMaxSize({250, 50});
auto btnSizer = new wxBoxSizer(wxVERTICAL);
btnSizer->Add(button, 0, wxEXPAND);
btnSizer->Add(staticText);
grid->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
}
GetStatusBar()->SetStatusText(wxString::Format("Loading Thumbnail %i of %i",
1, (int)loadEntries.size()));
grid->FitInside(gridPanel);
gridPanel->Show(true);
gridPanel->Scroll(0, 0);
gridPanel->Refresh();
gridPanel->Update();
loadThread = new ThumbnailLoadThread(this, loadEntries, currentEntry);
loadThread->Run();
threadId = loadThread->GetId();
}