本文整理汇总了C++中UnitPtr::visit方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPtr::visit方法的具体用法?C++ UnitPtr::visit怎么用?C++ UnitPtr::visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPtr
的用法示例。
在下文中一共展示了UnitPtr::visit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: v
void
PackageVisitor::createModules(const UnitPtr& unit, const string& module, const string& dir)
{
StringList modules;
PackageVisitor v(modules);
unit->visit(&v, false);
for(StringList::iterator p = modules.begin(); p != modules.end(); ++p)
{
vector<string> v;
if(!IceUtilInternal::splitString(*p, ".", v))
{
assert(false);
}
string currentModule;
string path = dir.empty() ? "." : dir;
for(vector<string>::iterator q = v.begin(); q != v.end(); ++q)
{
if(q != v.begin())
{
addSubmodule(path, currentModule, *q);
currentModule += ".";
}
currentModule += *q;
path += "/" + *q;
createDirectory(path);
addModule(path, currentModule, module);
}
}
}
示例2: visitClassDefStart
void
FreezeScript::collectCompactIds(const UnitPtr& u, const FreezeScript::CompactIdResolverIPtr& r)
{
class Visitor : public ParserVisitor
{
public:
Visitor(const FreezeScript::CompactIdResolverIPtr& resolver) : _r(resolver)
{
}
virtual bool visitClassDefStart(const ClassDefPtr& p)
{
if(p->compactId() != -1)
{
_r->add(p->compactId(), p->scoped());
}
return true;
}
FreezeScript::CompactIdResolverIPtr _r;
};
Visitor v(r);
u->visit(&v, false);
}
示例3: createChecksums
Slice::ChecksumMap Slice::createChecksums(const UnitPtr& u)
{
ChecksumMap result;
ChecksumVisitor visitor(result);
u->visit(&visitor, false);
return result;
}
示例4: codeVisitor
void
Slice::Ruby::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths, Output& out)
{
out << nl << "require 'Ice'";
if(!all)
{
vector<string> paths = includePaths;
for(vector<string>::iterator p = paths.begin(); p != paths.end(); ++p)
{
*p = fullPath(*p);
}
StringList includes = un->includeFiles();
for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
{
string file = changeInclude(*q, paths);
out << nl << "require '" << file << ".rb'";
}
}
CodeVisitor codeVisitor(out);
un->visit(&codeVisitor, false);
if(checksum)
{
ChecksumMap checksums = createChecksums(un);
if(!checksums.empty())
{
out << sp;
for(ChecksumMap::const_iterator p = checksums.begin(); p != checksums.end(); ++p)
{
out << nl << "::Ice::SliceChecksums[\"" << p->first << "\"] = \"";
ostringstream str;
str.flags(ios_base::hex);
str.fill('0');
for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
{
str << (int)(*q);
}
out << str.str() << "\"";
}
}
}
out << nl; // Trailing newline.
}
示例5: hidden
//.........这里部分代码省略.........
//}
//catch(...)
//{
//cout << "CRAP!\n";
//}
cout << "Input file is \"" << inputFilename << "\"\n";
#endif
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "",
IceUtilInternal::Options::Repeat);
vector<string> args;
try
{
args = opts.parse(argc, argv);
}
catch(const IceUtilInternal::BadOptException& e)
{
cerr << argv[0] << ": " << e.reason << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
if(opts.isSet("h") || opts.isSet("help"))
{
usage(argv[0]);
return EXIT_SUCCESS;
}
vector<string> includePaths;
includePaths = opts.argVec("I");
for (vector<string>::const_iterator i=includePaths.begin(); i!=includePaths.end(); ++i)
{
cppArgs.push_back("-I" + Preprocessor::normalizeIncludePath(*i));
}
if(args.empty())
{
cerr << argv[0] << ": no input file" << endl;
usage(argv[0]);
return EXIT_FAILURE;
}
int status = EXIT_SUCCESS;
vector<string>::const_iterator i = args.begin();
std::string filename = *i;
#if ICE_INT_VERSION / 100 < 304
Preprocessor* icecpp = new Preprocessor(argv[0], *i, cppArgs);
#else
PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs);
#endif
FILE* cppHandle = icecpp->preprocess(true);
if (cppHandle == 0)
{
return EXIT_FAILURE;
}
//#if ICE_INT_VERSION / 100 < 304
bool ignRedefs = false;
bool all = false;
bool allowIcePrefix = false;
bool caseSensitive = true;
//StringList defaultGlobalMetadata;
UnitPtr u = Unit::createUnit(ignRedefs, all, allowIcePrefix, caseSensitive);
//#else
// UnitPtr u = Unit::createUnit(false, false, false);
//#endif
int parseStatus = u->parse(*i, cppHandle, false);
if ( parseStatus == EXIT_FAILURE )
{
cerr << "Parsing failed";
exit(0);
}
if(!icecpp->close())
{
u->destroy();
return EXIT_FAILURE;
}
BasicClassLinkHandler linker;
RstGen rstGen(linker);
u->visit(&rstGen, true);
u->destroy();
return status;
}
示例6:
void
Slice::ObjCGenerator::validateMetaData(const UnitPtr& u)
{
MetaDataVisitor visitor;
u->visit(&visitor, true);
}