本文整理汇总了C++中FindChild函数的典型用法代码示例。如果您正苦于以下问题:C++ FindChild函数的具体用法?C++ FindChild怎么用?C++ FindChild使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindChild函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void CTrieHolder::InitFailureFunction()
{
assert (!m_Nodes.empty());
yvector<size_t> BFS;
BFS.push_back(0);
// going breadth-first search
for (size_t i=0; i < BFS.size(); i++) {
const CTrieNode& Parent = m_Nodes[BFS[i]];
size_t ChildrenCount = GetChildrenCount(BFS[i]);
for (size_t j=0; j<ChildrenCount; j++) {
const CTrieRelation& p = GetChildren(BFS[i])[j];
// going upside using following failure function in order to find the first node which
// has a way downward with symbol RelationChar
int r = Parent.m_FailureFunction;
while ((r != -1) && (FindChild(r,p.m_RelationChar) == -1))
r = m_Nodes[r].m_FailureFunction;
if (r != -1) {
// the way is found
m_Nodes[p.m_ChildNo].m_FailureFunction = FindChild(r,p.m_RelationChar);
} else
// no way is found, should start from the beginning
m_Nodes[p.m_ChildNo].m_FailureFunction = 0;
BFS.push_back(p.m_ChildNo);
};
};
};
示例2: AP4_DYNAMIC_CAST
/*----------------------------------------------------------------------
| AP4_TrakAtom::GetChunkOffsets
+---------------------------------------------------------------------*/
AP4_Result
AP4_TrakAtom::GetChunkOffsets(AP4_Array<AP4_UI64>& chunk_offsets)
{
AP4_Atom* atom;
if ((atom = FindChild("mdia/minf/stbl/stco"))) {
AP4_StcoAtom* stco = AP4_DYNAMIC_CAST(AP4_StcoAtom, atom);
if (stco == NULL) return AP4_ERROR_INTERNAL;
AP4_Cardinal stco_chunk_count = stco->GetChunkCount();
const AP4_UI32* stco_chunk_offsets = stco->GetChunkOffsets();
chunk_offsets.SetItemCount(stco_chunk_count);
for (unsigned int i=0; i<stco_chunk_count; i++) {
chunk_offsets[i] = stco_chunk_offsets[i];
}
return AP4_SUCCESS;
} else if ((atom = FindChild("mdia/minf/stbl/co64"))) {
AP4_Co64Atom* co64 = AP4_DYNAMIC_CAST(AP4_Co64Atom, atom);
if (co64 == NULL) return AP4_ERROR_INTERNAL;
AP4_Cardinal co64_chunk_count = co64->GetChunkCount();
const AP4_UI64* co64_chunk_offsets = co64->GetChunkOffsets();
chunk_offsets.SetItemCount(co64_chunk_count);
for (unsigned int i=0; i<co64_chunk_count; i++) {
chunk_offsets[i] = co64_chunk_offsets[i];
}
return AP4_SUCCESS;
} else {
return AP4_ERROR_INVALID_STATE;
}
}
示例3:
/*----------------------------------------------------------------------
| AP4_EncaSampleEntry::ToSampleDescription
+---------------------------------------------------------------------*/
AP4_SampleDescription*
AP4_EncaSampleEntry::ToSampleDescription()
{
// get the original sample format
AP4_FrmaAtom* frma = (AP4_FrmaAtom*)FindChild("sinf/frma");
// get the scheme info
AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
if (schm == NULL) return NULL;
// get the sample description for the original sample entry
AP4_MpegAudioSampleDescription* original_sample_description =
(AP4_MpegAudioSampleDescription*)
AP4_AudioSampleEntry::ToSampleDescription();
// get the schi atom
AP4_ContainerAtom* schi;
schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi"));
// create the sample description
return new AP4_IsmaCrypSampleDescription(
original_sample_description,
frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4A,
schm->GetSchemeType(),
schm->GetSchemeVersion(),
schm->GetSchemeUri().c_str(),
schi);
}
示例4: AP4_ContainerAtom
/*----------------------------------------------------------------------
| AP4_TrakAtom::AP4_TrakAtom
+---------------------------------------------------------------------*/
AP4_TrakAtom::AP4_TrakAtom(AP4_UI32 size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK, size, false, stream, atom_factory)
{
m_TkhdAtom = AP4_DYNAMIC_CAST(AP4_TkhdAtom, FindChild("tkhd"));
m_MdhdAtom = AP4_DYNAMIC_CAST(AP4_MdhdAtom, FindChild("mdia/mdhd"));
}
示例5: OSAL_ConfigController_SetNumValue
BOOL OSAL_ConfigController_SetNumValue(const char *ignore, const char *config_name, UINT32 *value)
{
BOOL result = FALSE;
BOOL bXmlRead, bSetInnerText, bXmlWrite;
pXmlElement xmlRoot, xmlTopElement, xmlTargetElement;
char buf[16] = {0};
if (config_name == NULL) {
return result;
}
pthread_mutex_lock(&g_configmutex);
// Open Config XML file
xmlRoot = CreateEmptyXmlData();
bXmlRead = ReadXmlFile(xmlRoot, CONFIG_XMLFILE);
if (!bXmlRead) {
OSALTRACE(OSAL_ERROR, ("cannot read config xml file"));
pthread_mutex_unlock(&g_configmutex);
return result;
}
// Find "config_name"
xmlTopElement = FindChild(xmlRoot, CONFIG_INTEL_WIMAX);
xmlTargetElement = FindChild(xmlTopElement, config_name);
if (xmlTargetElement != NULL) {
//convert integer to string
snprintf(buf, sizeof(buf), "%d", *value);
bSetInnerText = SetElementInnerText(xmlTargetElement, buf);
if(bSetInnerText == TRUE) {
// write to XML file
bXmlWrite = WriteXmlFile(xmlTopElement, CONFIG_XMLFILE_TMP);
if(bXmlWrite == TRUE) {
result = TRUE;
}
else {
OSALTRACE(OSAL_ERROR, ("cannot write config xml file"));
result = FALSE;
}
}
}
// Close XML
FreeXmlData(xmlRoot);
//swap the file
pthread_mutex_lock(&g_swapfilemutex);
rename(CONFIG_XMLFILE_TMP,CONFIG_XMLFILE);
pthread_mutex_unlock(&g_swapfilemutex);
pthread_mutex_unlock(&g_configmutex);
return result;
}
示例6: OSAL_ConfigController_GetNumValue
BOOL OSAL_ConfigController_GetNumValue(const char *ignore, const char *config_name, UINT32 * value)
{
BOOL result = FALSE;
BOOL bXmlRead;
pXmlElement xmlRoot, xmlTopElement, xmlTargetElement;
const char *target_data;
BOOL bDnDOutputQuery = FALSE;
if (config_name == NULL) {
return result;
}
if ( strcasecmp(config_name, OSAL_KEY_ENTRY_DND_OUTPUT_MODE) == 0)
{
bDnDOutputQuery = TRUE;
}
pthread_mutex_lock(&g_configmutex);
// Open Config XML file
xmlRoot = CreateEmptyXmlData();
bXmlRead = ReadXmlFile(xmlRoot, CONFIG_XMLFILE);
if (!bXmlRead) {
OSALTRACE(OSAL_ERROR, ("cannot read config xml file"));
pthread_mutex_unlock(&g_configmutex);
return result;
}
// Find "config_name"
xmlTopElement = FindChild(xmlRoot, CONFIG_INTEL_WIMAX);
xmlTargetElement = FindChild(xmlTopElement, config_name);
if (xmlTargetElement != NULL) {
target_data = GetElementInnerText(xmlTargetElement);
if (target_data != NULL) {
// Copy to the value
*value = (UINT32) atoi(target_data);
result = TRUE;
}
}
if ( bDnDOutputQuery )
{
OSALTRACE(OSAL_DEBUG, ("Result of query is %d, and value is %d.", result, result ? *value : -1));
}
// Close XML
FreeXmlData(xmlRoot);
pthread_mutex_unlock(&g_configmutex);
return result;
}
示例7: FindChild
// Try to expand as much of the given path as possible,
// and select the given tree item.
bool wxGenericDirCtrl::ExpandPath(const wxString& path)
{
bool done = false;
wxTreeItemId treeid = FindChild(m_rootId, path, done);
wxTreeItemId lastId = treeid; // The last non-zero treeid
while (treeid.IsOk() && !done)
{
ExpandDir(treeid);
treeid = FindChild(treeid, path, done);
if (treeid.IsOk())
lastId = treeid;
}
if (!lastId.IsOk())
return false;
wxDirItemData *data = (wxDirItemData *) m_treeCtrl->GetItemData(lastId);
if (data->m_isDir)
{
m_treeCtrl->Expand(lastId);
}
if (HasFlag(wxDIRCTRL_SELECT_FIRST) && data->m_isDir)
{
// Find the first file in this directory
wxTreeItemIdValue cookie;
wxTreeItemId childId = m_treeCtrl->GetFirstChild(lastId, cookie);
bool selectedChild = false;
while (childId.IsOk())
{
data = (wxDirItemData*) m_treeCtrl->GetItemData(childId);
if (data && data->m_path != wxEmptyString && !data->m_isDir)
{
m_treeCtrl->SelectItem(childId);
m_treeCtrl->EnsureVisible(childId);
selectedChild = true;
break;
}
childId = m_treeCtrl->GetNextChild(lastId, cookie);
}
if (!selectedChild)
{
m_treeCtrl->SelectItem(lastId);
m_treeCtrl->EnsureVisible(lastId);
}
}
else
{
m_treeCtrl->SelectItem(lastId);
m_treeCtrl->EnsureVisible(lastId);
}
return true;
}
示例8: OSAL_ConfigController_GetStrValue
BOOL OSAL_ConfigController_GetStrValue(const char *ignore, const char *config_name, char* value,UINT32 maxsize)
{
BOOL result = FALSE;
BOOL bXmlRead;
pXmlElement xmlRoot, xmlTopElement, xmlTargetElement;
const char *target_data;
UINT32 data_size=0;
if (config_name == NULL) {
return result;
}
pthread_mutex_lock(&g_configmutex);
// Open Config XML file
xmlRoot = CreateEmptyXmlData();
bXmlRead = ReadXmlFile(xmlRoot, CONFIG_XMLFILE);
if (!bXmlRead) {
OSALTRACE(OSAL_ERROR, ("cannot read config xml file"));
pthread_mutex_unlock(&g_configmutex);
return result;
}
// Find "config_name"
xmlTopElement = FindChild(xmlRoot, CONFIG_INTEL_WIMAX);
xmlTargetElement = FindChild(xmlTopElement, config_name);
if (xmlTargetElement != NULL)
{
target_data = GetElementInnerText(xmlTargetElement);
data_size = strlen(target_data)+1;
if (target_data != NULL)
{
if(data_size > maxsize -1){
// Copy to the value
memcpy(value, target_data, maxsize-1);
// Added by Kalyan to make the value as a complete string
// and to avoid problems with strlen, strcpy on value without \0
value[maxsize-1] = '\0';
}
else {
memcpy(value, target_data, data_size);
}
result = TRUE;
}
}
// Close XML
FreeXmlData(xmlRoot);
pthread_mutex_unlock(&g_configmutex);
return result;
}
示例9: while
void OGR_SRSNode::StripNodes( const char * pszName )
{
/* -------------------------------------------------------------------- */
/* Strip any children matching this name. */
/* -------------------------------------------------------------------- */
while( FindChild( pszName ) >= 0 )
DestroyChild( FindChild( pszName ) );
/* -------------------------------------------------------------------- */
/* Recurse */
/* -------------------------------------------------------------------- */
for( int i = 0; i < GetChildCount(); i++ )
GetChild(i)->StripNodes( pszName );
}
示例10: FindChild
TreeNode * TreeNode::AddChild( TreeNode * Child )
{
TreeNode * Result = NULL;
Result = FindChild( Child->Item, Child->ItemIsIntra);
if( Result == NULL ) {
Result = Child;
(*Children).push_back( Child );
// To keep the children vector sorted.
//inplace_merge( (*Children).begin(), (*Children).end()-1, (*Children).end(), TreeNodeLess );
Child->Parent = this;
if( Child->ItemIsIntra ) {
Child->ItemsetNumber = ItemsetNumber;
Child->Items = Items + 1;
}
else {
Child->ItemsetNumber = ItemsetNumber + 1;
Child->Items = Items + 1;
}
} else {
if( Child->Support > Result->Support )
Result->Support = Child->Support;
delete Child;
}
return Result;
}
示例11: FindChild
Room::Room(Map *m, Room *par, Direction from_direction, SDL_Rect area) {
map = m;
space = area;
parent = par;
for (int i = NORTH; i < LAST_DIRECTION; ++i) {
if (i == from_direction) {
children[from_direction] = parent;
corridors[from_direction] = (SDL_Rect) {0, 0, 0, 0};
}
else
children[i] = NULL;
}
map->ApplyRoom(this);
for (int i = 0; i < CHILD_TRIES; ++i) {
if (!hasChildrenAvailable())
break;
FindChild();
}
if (!map->lastroom && this->CountExits() < 2) {
map->lastroom = this;
AddObject(RoomObject::STAIRS_DOWN);
}
}
示例12: Attach
bool ControlRoom::Attach(const char *nodeUrl,const char *controllerUrl) {
if (controllerUrl[0] ==0) return true;
ControlNode *existing=FindChild(nodeUrl) ;
if ((!existing)||(existing->GetType()!=CNT_ASSIGNABLE)) {
Trace::Error("Trying to map unknown node %s",nodeUrl) ;
return false ;
}
AssignableControlNode *acn=(AssignableControlNode*)existing ;
MultiChannelAdapter *mca=(MultiChannelAdapter *)acn->GetSourceChannel() ;
if (!mca) {
std::string name=acn->GetName() ;
name+="-adapter" ;
mca=new MultiChannelAdapter(name.c_str()) ;
acn->SetSourceChannel(mca) ;
}
Channel *channel=ControllerService::GetInstance()->GetChannel(controllerUrl) ;
if (channel) {
mca->AddChannel(*channel) ;
Trace::Log("MAPPING","Attached %s to %s",nodeUrl,controllerUrl) ;
} else {
Trace::Debug("Failed to attach %s to %s",nodeUrl,controllerUrl) ;
} ;
return true ;
} ;
示例13: FindChild
HWND FindChild(HWND hParent, wchar_t *find_name)
{
if(NULL == hParent)
{
return NULL;
}
HWND hFind = FindWindowEx(hParent, NULL, find_name, NULL);
if(NULL == hFind)
{// not found
HWND hChild = GetWindow(hParent, GW_CHILD);
while (hChild)
{
hFind = FindChild(hChild, find_name);
if(hFind)
{
return hFind;
}
hChild = GetWindow(hChild, GW_HWNDNEXT);
}
return NULL;
}
return hFind;
}
示例14: FindChild
CControlUI* CVideoFrame::FindChild( CContainerUI* pContainer, LPCTSTR strName )
{
if (!pContainer)
return NULL;
if (_tcsicmp(strName, pContainer->GetName()) == 0)
{
return pContainer;
}
for (int i = 0; ; i ++)
{
CControlUI* pControl = pContainer->GetItemAt(i);
if (pControl == NULL)
return NULL;
if ( _tcsicmp(strName ,pControl->GetName()) == 0)
{
return pControl;
}
CContainerUI* pContainerSub = dynamic_cast<CContainerUI*>(pControl);
if (pContainerSub)
{
CControlUI* p = FindChild(pContainerSub, strName);
if (p)
return p;
}
}
return NULL;
}
示例15: while
QModelIndex MergeModel::mapFromSource (const QModelIndex& sourceIndex) const
{
if (!sourceIndex.isValid ())
return {};
QList<QModelIndex> hier;
auto parent = sourceIndex;
while (parent.isValid ())
{
hier.prepend (parent);
parent = parent.parent ();
}
auto currentItem = Root_;
for (const auto& idx : hier)
{
currentItem = currentItem->FindChild (idx);
if (!currentItem)
{
qWarning () << Q_FUNC_INFO
<< "no next item for"
<< idx
<< hier;
return {};
}
}
return createIndex (currentItem->GetRow (), sourceIndex.column (), currentItem.get ());
}