本文整理汇总了C++中NF_SHARE_PTR::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::Add方法的具体用法?C++ NF_SHARE_PTR::Add怎么用?C++ NF_SHARE_PTR::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddClassInclude
bool NFCClassModule::AddClassInclude(const char* pstrClassFilePath, NF_SHARE_PTR<NFIClass> pClass)
{
if (pClass->Find(pstrClassFilePath))
{
return false;
}
//////////////////////////////////////////////////////////////////////////
std::string strFile = pPluginManager->GetConfigPath() + pstrClassFilePath;
std::string strContent;
pPluginManager->GetFileContent(strFile, strContent);
rapidxml::xml_document<> xDoc;
xDoc.parse<0>((char*)strContent.c_str());
//////////////////////////////////////////////////////////////////////////
//support for unlimited layer class inherits
rapidxml::xml_node<>* root = xDoc.first_node();
rapidxml::xml_node<>* pRropertyRootNode = root->first_node("Propertys");
if (pRropertyRootNode)
{
AddPropertys(pRropertyRootNode, pClass);
}
//////////////////////////////////////////////////////////////////////////
//and record
rapidxml::xml_node<>* pRecordRootNode = root->first_node("Records");
if (pRecordRootNode)
{
AddRecords(pRecordRootNode, pClass);
}
rapidxml::xml_node<>* pComponentRootNode = root->first_node("Components");
if (pComponentRootNode)
{
AddComponents(pComponentRootNode, pClass);
}
//pClass->mvIncludeFile.push_back( pstrClassFilePath );
//and include file
rapidxml::xml_node<>* pIncludeRootNode = root->first_node("Includes");
if (pIncludeRootNode)
{
for (rapidxml::xml_node<>* includeNode = pIncludeRootNode->first_node(); includeNode; includeNode = includeNode->next_sibling())
{
const char* pstrIncludeFile = includeNode->first_attribute("Id")->value();
//std::vector<std::string>::iterator it = std::find( pClass->mvIncludeFile.begin(), pClass->mvIncludeFile..end(), pstrIncludeFile );
if (AddClassInclude(pstrIncludeFile, pClass))
{
pClass->Add(pstrIncludeFile);
}
}
}
return true;
}
示例2: AddClass
bool NFCClassModule::AddClass(const char* pstrClassFilePath, NF_SHARE_PTR<NFIClass> pClass)
{
NF_SHARE_PTR<NFIClass> pParent = pClass->GetParent();
while (pParent)
{
//inherited some properties form class of parent
std::string strFileName = "";
pParent->First(strFileName);
while (!strFileName.empty())
{
if (pClass->Find(strFileName))
{
strFileName.clear();
continue;
}
if (AddClassInclude(strFileName.c_str(), pClass))
{
pClass->Add(strFileName);
}
strFileName.clear();
pParent->Next(strFileName);
}
pParent = pParent->GetParent();
}
//////////////////////////////////////////////////////////////////////////
if (AddClassInclude(pstrClassFilePath, pClass))
{
pClass->Add(pstrClassFilePath);
}
//file.close();
return true;
}
示例3: AddClassCallBack
bool NFCEventProcessModule::AddClassCallBack(const std::string& strClassName, const CLASS_EVENT_FUNCTOR_PTR& cb)
{
NF_SHARE_PTR<NFCClassEventList> pEventList = mxClassEventInfoEx.GetElement(strClassName);
if (nullptr == pEventList)
{
pEventList = NF_SHARE_PTR<NFCClassEventList>(NF_NEW NFCClassEventList());
mxClassEventInfoEx.AddElement(strClassName, pEventList);
}
assert(NULL != pEventList);
pEventList->Add(cb);
return true;
}
示例4: RemoveEventCallBack
bool NFCEventProcessModule::RemoveEventCallBack(const NFIDENTID& objectID, const int nEventID/*, const EVENT_PROCESS_FUNCTOR_PTR& cb*/)
{
NF_SHARE_PTR<NFCObjectEventInfo> pObjectEventInfo = mObjectEventInfoMapEx.GetElement(objectID);
if (nullptr != pObjectEventInfo)
{
NF_SHARE_PTR<NFEventList> pEventInfo = pObjectEventInfo->GetElement(nEventID);
if (pEventInfo.get())
{
NF_SHARE_PTR<NFList<int>> pList = mRemoveEventListEx.GetElement(objectID);
if (!pList.get())
{
pList = NF_SHARE_PTR<NFList<int>>(NF_NEW NFList<int>());
mRemoveEventListEx.AddElement(objectID, pList);
}
pList->Add(nEventID);
return true;
}
}
return false;
}
示例5: AddEventCallBack
bool NFCEventProcessModule::AddEventCallBack(const NFIDENTID& objectID, const int nEventID, const EVENT_PROCESS_FUNCTOR_PTR& cb)
{
NF_SHARE_PTR<NFCObjectEventInfo> pObjectEventInfo = mObjectEventInfoMapEx.GetElement(objectID);
if (!pObjectEventInfo.get())
{
pObjectEventInfo = NF_SHARE_PTR<NFCObjectEventInfo>(NF_NEW NFCObjectEventInfo());
mObjectEventInfoMapEx.AddElement(objectID, pObjectEventInfo);
}
assert(nullptr != pObjectEventInfo);
NF_SHARE_PTR<NFEventList> pEventInfo = pObjectEventInfo->GetElement(nEventID);
if (!pEventInfo)
{
pEventInfo = NF_SHARE_PTR<NFEventList>(NF_NEW NFEventList());
pObjectEventInfo->AddElement(nEventID, pEventInfo);
}
assert(nullptr != pEventInfo);
pEventInfo->Add(cb);
return true;
}
示例6: AddClassInclude
bool NFCClassModule::AddClassInclude(const char* pstrClassFilePath, NF_SHARE_PTR<NFIClass> pClass)
{
if (pClass->Find(pstrClassFilePath))
{
return false;
}
//////////////////////////////////////////////////////////////////////////
rapidxml::xml_document<> xDoc;
char* pData = NULL;
int nDataSize = 0;
std::string strFile = pPluginManager->GetConfigPath() + pstrClassFilePath;
rapidxml::file<> fdoc(strFile.c_str());
nDataSize = fdoc.size();
pData = new char[nDataSize + 1];
strncpy(pData, fdoc.data(), nDataSize);
pData[nDataSize] = 0;
xDoc.parse<0>(pData);
//////////////////////////////////////////////////////////////////////////
//support for unlimited layer class inherits
rapidxml::xml_node<>* root = xDoc.first_node();
rapidxml::xml_node<>* pRropertyRootNode = root->first_node("Propertys");
if (pRropertyRootNode)
{
AddPropertys(pRropertyRootNode, pClass);
}
//////////////////////////////////////////////////////////////////////////
//and record
rapidxml::xml_node<>* pRecordRootNode = root->first_node("Records");
if (pRecordRootNode)
{
AddRecords(pRecordRootNode, pClass);
}
rapidxml::xml_node<>* pComponentRootNode = root->first_node("Components");
if (pComponentRootNode)
{
AddComponents(pComponentRootNode, pClass);
}
//pClass->mvIncludeFile.push_back( pstrClassFilePath );
//and include file
rapidxml::xml_node<>* pIncludeRootNode = root->first_node("Includes");
if (pIncludeRootNode)
{
for (rapidxml::xml_node<>* includeNode = pIncludeRootNode->first_node(); includeNode; includeNode = includeNode->next_sibling())
{
const char* pstrIncludeFile = includeNode->first_attribute("Id")->value();
//std::vector<std::string>::iterator it = std::find( pClass->mvIncludeFile.begin(), pClass->mvIncludeFile..end(), pstrIncludeFile );
if (AddClassInclude(pstrIncludeFile, pClass))
{
pClass->Add(pstrIncludeFile);
}
}
}
//////////////////////////////////////////////////////////////////////////
if (NULL != pData)
{
delete []pData;
}
//////////////////////////////////////////////////////////////////////////
return true;
}