本文整理汇总了C++中Namespace::findNamespace方法的典型用法代码示例。如果您正苦于以下问题:C++ Namespace::findNamespace方法的具体用法?C++ Namespace::findNamespace怎么用?C++ Namespace::findNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Namespace
的用法示例。
在下文中一共展示了Namespace::findNamespace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
std::string outputcpp;
std::string outputhpp;
std::string output_doc;
for(int i = 0; i < argc; ++i) {
if(strcmp(argv[i], "--module") == 0) {
if(i+1 >= argc) {
std::cerr << "Need to specify a module name.\n";
usage();
return 1;
}
modulename = argv[++i];
} else if(strcmp(argv[i], "--input") == 0) {
if(i+1 >= argc) {
std::cerr << "Need to specify input file name.\n";
usage();
return 1;
}
inputfile = argv[++i];
} else if(strcmp(argv[i], "--output-cpp") == 0) {
if(i+1 >= argc) {
std::cerr << "Need to specify output cpp name.\n";
usage();
return 1;
}
outputcpp = argv[++i];
} else if(strcmp(argv[i], "--output-hpp") == 0) {
if(i+1 >= argc) {
std::cerr << "Need to specify output hpp name.\n";
usage();
return 1;
}
outputhpp = argv[++i];
} else if(strcmp(argv[i], "--select-namespace") == 0) {
if(i+1 >= argc) {
std::cerr << "Need to specify a namespace.\n";
usage();
return 1;
}
selected_namespace = argv[++i];
} else if(strcmp(argv[i], "--output-doc") == 0) {
if(i+1 >= argc) {
std::cerr << "Need to specify document xml file.\n";
usage();
return 1;
}
output_doc = argv[++i];
} else if(argv[i][0] == '-') {
std::cerr << "Unknown option '" << argv[i] << "'.\n";
usage();
return 1;
} else {
}
}
if( inputfile == "" || (
(outputcpp == "" || outputhpp == "") && output_doc == "")) {
std::cerr << "Not all options specified.\n";
usage();
return 1;
}
try {
input = new std::ifstream(inputfile.c_str());
if(!input->good()) {
std::cerr << "Couldn't open file '" << inputfile << "' for reading.\n";
return 1;
}
current_file = inputfile;
unit = new CompilationUnit();
Namespace* std_namespace = new Namespace();
std_namespace->name = "std";
std_namespace->types.push_back(new StringType());
unit->namespaces.push_back(std_namespace);
unit->types.push_back(new HSQUIRRELVMType());
unit->types.push_back(new SQIntegerType());
yyparse();
Namespace* ns = unit;
if(selected_namespace != "") {
ns = ns->findNamespace(selected_namespace);
}
if(outputcpp != "") {
std::ofstream cppout(outputcpp.c_str());
if(!cppout.good()) {
std::cerr << "Couldn't open file '"
<< outputcpp << "' for writing.\n";
return 1;
}
std::ofstream hppout(outputhpp.c_str());
if(!hppout.good()) {
std::cerr << "Couldn't open file '" << outputhpp
<< "' for writing.\n";
return 1;
}
WrapperCreator creator(cppout, hppout);
creator.create_wrapper(ns);
//.........这里部分代码省略.........