本文整理汇总了C++中ContainedPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ContainedPtr类的具体用法?C++ ContainedPtr怎么用?C++ ContainedPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContainedPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
FreezeScript::AnalyzeInitVisitor::typeChange(const TypePtr& t, const string& scoped, const string& kind)
{
BuiltinPtr b = BuiltinPtr::dynamicCast(t);
ContainedPtr c = ContainedPtr::dynamicCast(t);
ProxyPtr p = ProxyPtr::dynamicCast(t);
_out.newline();
_out.newline();
_out << "<!-- NOTICE: " << scoped << " has changed from ";
if(b)
{
_out << b->kindAsString();
}
else if(p)
{
_out << "proxy";
}
else
{
assert(c);
_out << c->kindOf();
}
_out << " to " << kind << " -->";
}
示例2: fixId
string
Slice::JsGenerator::typeToString(const TypePtr& type)
{
if(!type)
{
return "void";
}
static const char* builtinTable[] =
{
"Number", // byte
"Boolean", // bool
"Number", // short
"Number", // int
"Number", // long
"Number", // float
"Number", // double
"String",
"Ice.Value",
"Ice.ObjectPrx",
"Object",
"Ice.Value"
};
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
return builtinTable[builtin->kind()];
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
if(proxy)
{
return fixId(proxy->_class()->scoped() + "Prx");
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
return typeToString(seq->type()) + "[]";
}
DictionaryPtr d = DictionaryPtr::dynamicCast(type);
if(d)
{
const TypePtr keyType = d->keyType();
BuiltinPtr b = BuiltinPtr::dynamicCast(keyType);
return ((b && b->kind() == Builtin::KindLong) || StructPtr::dynamicCast(keyType)) ? "Ice.HashMap" : "Map";
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
if(contained)
{
return fixId(contained->scoped());
}
return "???";
}
示例3: fixId
string
Slice::ObjCGenerator::getParamName(const ContainedPtr& param, bool internal)
{
if(internal)
{
return "iceP_" + param->name();
}
else
{
return fixId(param->name());
}
}
示例4: lookupParamIdKwd
string
Slice::ObjCGenerator::getParamId(const ContainedPtr& param)
{
string n;
if(ParamDeclPtr::dynamicCast(param) && param->findMetaData("objc:param:", n))
{
return lookupParamIdKwd(n.substr(11));
}
else
{
return lookupParamIdKwd(param->name());
}
}
示例5: fixIdent
string
Slice::Ruby::getAbsolute(const ContainedPtr& cont, IdentStyle style, const string& prefix)
{
string scope = fixIdent(cont->scope(), IdentToUpper);
if(prefix.empty())
{
return scope + fixIdent(cont->name(), style);
}
else
{
return scope + prefix + fixIdent(cont->name(), style);
}
}
示例6: while
ModulePtr
Slice::ObjCGenerator::findModule(const ContainedPtr& cont, int baseTypes, bool mangleCasts)
{
ModulePtr m = ModulePtr::dynamicCast(cont);
ContainerPtr container = cont->container();
while(container && !m)
{
ContainedPtr contained = ContainedPtr::dynamicCast(container);
container = contained->container();
m = ModulePtr::dynamicCast(contained);
}
assert(m);
return m;
}
示例7:
void
Slice::ObjCGenerator::MetaDataVisitor::setMetaData(const ContainedPtr& cont, const StringList& metadata)
{
StringList localMetaData = cont->getMetaData();
for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end();)
{
string s = *p++;
if(s.find(_objcPrefix) == 0)
{
localMetaData.remove(s);
}
}
localMetaData.insert(localMetaData.end(), metadata.begin(), metadata.end());
cont->setMetaData(localMetaData);
}
示例8: if
string
Slice::ObjCGenerator::getFactoryMethod(const ContainedPtr& p, bool deprecated)
{
ClassDefPtr def = ClassDefPtr::dynamicCast(p);
if(def && def->declaration()->isLocal())
{
deprecated = false; // Local classes don't have this issue since they were added after this fix.
}
//
// If deprecated is true, we return uDPConnectionInfo for a class
// named UDPConnectionInfo, return udpConnectionInfo otherwise.
//
string name = fixId(p->name());
if(name.empty())
{
return name;
}
else if(deprecated || name.size() < 2 || !isupper(*(name.begin() + 1)))
{
*name.begin() = tolower(*name.begin());
}
else
{
for(string::iterator p = name.begin(); p != name.end() && isalpha(*p); ++p)
{
if(p != name.end() - 1 && isalpha(*(p + 1)) && !isupper(*(p + 1)))
{
break;
}
*p = tolower(*p);
}
}
return name;
}
示例9: if
string
Slice::JsGenerator::importPrefix(const ContainedPtr& contained,
const ContainedPtr& toplevel,
const vector<pair<string, string> >& imports)
{
string m1 = getModuleMetadata(contained);
string m2 = getModuleMetadata(toplevel);
string p;
if(m1.empty())
{
string p1 = contained->definitionContext()->filename();
string p2 = toplevel->definitionContext()->filename();
p = relativePath(p1, p2);
string::size_type pos = p.rfind('.');
if (pos != string::npos)
{
p.erase(pos);
}
}
else if(m1 == "ice" && m1 != m2)
{
return "iceNS0.";
}
else if(m1 != m2)
{
p = m1;
}
if(!p.empty())
{
for(vector<pair<string, string> >::const_iterator i = imports.begin(); i != imports.end(); ++i)
{
if(i->first == p)
{
return i->second + ".";
}
}
}
return "";
}
示例10: if
string
FreezeScript::typeToString(const TypePtr& type)
{
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
ContainedPtr c = ContainedPtr::dynamicCast(type);
if(b)
{
return b->kindAsString();
}
else if(c)
{
return c->scoped();
}
else
{
ProxyPtr p = ProxyPtr::dynamicCast(type);
assert(p);
return p->_class()->scoped() + "*";
}
}
示例11: scopedToName
void
CodeVisitor::startNamespace(const ContainedPtr& cont)
{
if(_ns)
{
string scope = cont->scope();
scope = scope.substr(2); // Removing leading '::'
scope = scope.substr(0, scope.length() - 2); // Removing trailing '::'
_out << sp << nl << "namespace " << scopedToName(scope, true);
_out << sb;
}
}
示例12: fixIdent
string
CodeVisitor::getName(const ContainedPtr& p, const string& suffix)
{
if(_ns)
{
return fixIdent(p->name() + suffix);
}
else
{
return getAbsolute(p, false, "", suffix);
}
}
示例13: assert
string
Slice::JsGenerator::getModuleMetadata(const ContainedPtr& p)
{
//
// Check if the file contains the python:pkgdir global metadata.
//
DefinitionContextPtr dc = p->definitionContext();
assert(dc);
const string prefix = "js:module:";
const string value = dc->findMetaData(prefix);
return value.empty() ? value : value.substr(prefix.size());
}
示例14: assert
string Slice::ChecksumVisitor::typeToString(const TypePtr& type)
{
static const char* builtinTable[] = { "byte", "boolean", "short", "int", "long", "float",
"double", "string", "Object", "Object*", "LocalObject" };
if (!type) {
return "void";
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if (builtin) {
return builtinTable[builtin->kind()];
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
if (proxy) {
return proxy->_class()->scoped() + "*";
}
ContainedPtr cont = ContainedPtr::dynamicCast(type);
assert(cont);
return cont->scoped();
}
示例15: assert
string
Slice::JsGenerator::getStaticId(const TypePtr& type)
{
BuiltinPtr b = BuiltinPtr::dynamicCast(type);
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
assert((b && b->kind() == Builtin::KindObject) || cl);
if(b)
{
return "Ice.ObjectImpl.ice_staticId()";
}
else if(cl->isInterface())
{
ContainedPtr cont = ContainedPtr::dynamicCast(cl->container());
assert(cont);
return fixId(cont->scoped()) + "." + cl->name() + "Disp_.ice_staticId()";
}
else
{
return fixId(cl->scoped()) + ".ice_staticId()";
}
}