本文整理汇总了C++中AST::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ AST::Size方法的具体用法?C++ AST::Size怎么用?C++ AST::Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AST
的用法示例。
在下文中一共展示了AST::Size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScanC_CxxFiles
void AssemblyInfo::ScanC_CxxFiles()
{
static const lemon::char_t* c_cxx_extensions[] =
{
LEMON_TEXT("h"),LEMON_TEXT("hpp"),LEMON_TEXT("hxx"),LEMON_TEXT("hh"),
LEMON_TEXT("c"),LEMON_TEXT("cpp"),LEMON_TEXT("cc"),LEMON_TEXT("cxx")
};
static const lemon::char_t* source_extensions[] =
{
LEMON_TEXT("c"),LEMON_TEXT("cpp"),LEMON_TEXT("cc"),LEMON_TEXT("cxx")
};
const lemon::char_t ** c_cxx_extensions_begin = c_cxx_extensions;
const lemon::char_t ** c_cxx_extensions_end = c_cxx_extensions + sizeof(c_cxx_extensions)/sizeof(char_t*);
const lemon::char_t ** source_extensions_begin = source_extensions;
const lemon::char_t ** source_extensions_end = source_extensions + sizeof(source_extensions)/sizeof(char_t*);
std::stack<lemon::String> directories;
directories.push(_projectPath);
while(!directories.empty())
{
lemon::String directory = directories.top();
fs::directory_iteartor_t iter(directory),end;
directories.pop();
for(;iter != end; ++ iter)
{
fs::path path(directory + LEMON_TEXT("/") + *iter);
path.compress();
if(*iter == LEMON_TEXT(".") || *iter == LEMON_TEXT(".."))
{
continue;
}
if(fs::is_directory(path.string()))
{
directories.push(path.string());
continue;
}
lemon::String extension = fs::extension(path);
if(c_cxx_extensions_end != std::find_if(
c_cxx_extensions_begin,
c_cxx_extensions_end,
lemon::bind(&ExtensionCompare,lemon::cref(extension),lemon::_0)))
{
AST ast;
Lexer lexer(path.string().c_str());
Parser parser(this);
parser.Parse(lexer,ast);
if(source_extensions_end != std::find_if(
source_extensions_begin,
source_extensions_end,
lemon::bind(&ExtensionCompare,lemon::cref(extension),lemon::_0)))
{
if(ast.Size() == 0) continue;
AST::NodeListType::const_iterator iter,end = ast.NodeList.end();
for(iter = ast.NodeList.begin(); iter != end; ++ iter)
{
AddTraceEvent(LEMON_MAKE_TRACEMESSAGE_ID(_files,iter->lines),iter->formatter);
}
CXXCodeGen codegen(this,_files);
fs::path target = fs::path(_c_cxxGenerateFileDir) / fs::relative(fs::path(_projectPath),path);
codegen.Generate(target.string() + LEMON_TEXT(".g.hpp") ,ast);
++ _files;
}
}
}
}
}