本文整理汇总了C++中ContextPtr::getNamespaces方法的典型用法代码示例。如果您正苦于以下问题:C++ ContextPtr::getNamespaces方法的具体用法?C++ ContextPtr::getNamespaces怎么用?C++ ContextPtr::getNamespaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContextPtr
的用法示例。
在下文中一共展示了ContextPtr::getNamespaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generatePHP
void Jce2Php::generatePHP_Pdu(const ContextPtr &pPtr) const
{
string n = taf::TC_File::excludeFileExt(taf::TC_File::extractFileName(pPtr->getFileName()));
string fileH = m_sBaseDir + "/" + n + "_pdu.php";
string define = "<?php";
ostringstream s;
s << define << endl;
s << endl;
s << g_parse->printHeaderRemark();
s << endl;
s << "require_once('jce.php');" <<endl;
vector<NamespacePtr> namespaces = pPtr->getNamespaces();
for(size_t i = 0; i < namespaces.size(); i++)
{
s << generatePHP(namespaces[i]) << endl;
}
s << "?>";
taf::TC_File::makeDirRecursive(m_sBaseDir, 0755);
taf::TC_File::save2file(fileH, s.str());
}
示例2: generateJSServerImp
void CodeGenerator::generateJSServerImp(const ContextPtr &cPtr)
{
string sFileName = TC_File::excludeFileExt(_sToPath + TC_File::extractFileName(cPtr->getFileName())) + "Imp.js";
if (TC_File::isFileExist(sFileName))
{
return ;
}
ostringstream str;
str << printHeaderRemark("Imp");
str << "\"use strict\";" << endl << endl;
vector<NamespacePtr> namespaces = cPtr->getNamespaces();
set<string> setNamespace;
for(size_t i = 0; i < namespaces.size(); i++)
{
if (setNamespace.count(namespaces[i]->getId()) != 0)
{
continue;
}
setNamespace.insert(namespaces[i]->getId());
str << "var " << namespaces[i]->getId() << " = require(\"./"
<< TC_File::excludeFileExt(TC_File::extractFileName(cPtr->getFileName())) << ".js\")."
<< namespaces[i]->getId() << ";" << endl;
str << "module.exports." << namespaces[i]->getId() << " = " << namespaces[i]->getId() << ";" << endl;
}
str << endl;
set<string> setInterface;
for(size_t i = 0; i < namespaces.size(); i++)
{
vector<InterfacePtr> & is = namespaces[i]->getAllInterfacePtr();
for (size_t ii = 0; ii < is.size(); ii++)
{
if (setInterface.count(namespaces[i]->getId() + "::" + is[ii]->getId()) != 0)
{
continue;
}
setInterface.insert(namespaces[i]->getId() + "::" + is[ii]->getId());
str << namespaces[i]->getId() << "." << is[ii]->getId() << "Imp.prototype.initialize = function () {" << endl;
INC_TAB;
str << TAB << "//TODO::" << endl;
DEL_TAB;
str << "};" << endl << endl;
}
}
for(size_t i = 0; i < namespaces.size(); i++)
{
str << generateJSServerImp(cPtr, namespaces[i]);
}
TC_File::makeDirRecursive(_sToPath, 0755);
makeUTF8File(sFileName, str.str());
}