本文整理汇总了C++中json::doctarget::OutputStream::analysisResult方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputStream::analysisResult方法的具体用法?C++ OutputStream::analysisResult怎么用?C++ OutputStream::analysisResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::doctarget::OutputStream
的用法示例。
在下文中一共展示了OutputStream::analysisResult方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void ClassScope::serialize(JSON::DocTarget::OutputStream &out) const {
// TODO(stephentu): fix this hack
ClassScopeRawPtr self(const_cast<ClassScope*>(this));
JSON::DocTarget::MapStream ms(out);
ms.add("name", getDocName());
ms.add("line", getStmt() ? getStmt()->line0() : 0);
ms.add("docs", m_docComment);
ms.add("parent");
if (m_parent.empty()) {
out << JSON::Null();
} else {
out << GetDocName(out.analysisResult(), self, m_parent);
}
vector<string> ifaces;
getInterfaces(out.analysisResult(), ifaces, true);
vector<string> origIfaces;
origIfaces.resize(ifaces.size());
transform(ifaces.begin(), ifaces.end(), origIfaces.begin(),
GetDocNameFunctor(out.analysisResult(), self));
ms.add("interfaces", origIfaces);
int mods = 0;
switch (m_kindOf) {
case KindOf::AbstractClass: mods |= ClassInfo::IsAbstract; break;
case KindOf::Enum:
case KindOf::FinalClass:
mods |= ClassInfo::IsFinal; break;
case KindOf::UtilClass:
mods |= ClassInfo::IsFinal | ClassInfo::IsAbstract; break;
case KindOf::Interface: mods |= ClassInfo::IsInterface; break;
case KindOf::Trait: mods |= ClassInfo::IsTrait; break;
case KindOf::ObjectClass:
break;
}
ms.add("modifiers", mods);
FunctionScopePtrVec funcs;
getFunctionsFlattened(0, funcs);
ms.add("methods", funcs);
vector<Symbol*> rawSymbols;
getVariables()->getSymbols(rawSymbols, true);
vector<SymClassVarWrapper> wrappedSymbols;
for (vector<Symbol*>::iterator it = rawSymbols.begin();
it != rawSymbols.end(); ++it) {
wrappedSymbols.push_back(SymClassVarWrapper(*it));
}
ms.add("properties", wrappedSymbols);
// TODO: constants
ms.done();
}
示例2: serializeClassVar
void Symbol::serializeClassVar(JSON::DocTarget::OutputStream &out) const {
assert(!isParameter());
JSON::DocTarget::MapStream ms(out);
ms.add("name", m_name);
ms.add("line", m_declaration ? m_declaration->getLocation()->line0 : 0);
int mods = 0;
if (isPublic()) mods |= ClassInfo::IsPublic;
if (isProtected()) mods |= ClassInfo::IsProtected;
if (isPrivate()) mods |= ClassInfo::IsPrivate;
if (isStatic()) mods |= ClassInfo::IsStatic;
ms.add("modifiers", mods);
ms.add("type", getFinalType());
ms.add("initializer");
if (m_initVal) {
ExpressionPtr initExp(
dynamic_pointer_cast<Expression>(m_initVal));
assert(initExp);
const string &init = ExtractInitializer(out.analysisResult(), initExp);
if (!init.empty()) out << init;
else out << JSON::Null();
} else {
out << JSON::Null();
}
const string &docs = ExtractDocComment(
m_declaration ?
dynamic_pointer_cast<Expression>(m_declaration) : ExpressionPtr());
ms.add("docs", docs);
ms.done();
}
示例3: serialize
void Type::serialize(JSON::DocTarget::OutputStream &out) const {
string s("any");
switch (m_kindOf) {
case KindOfBoolean: s = "boolean"; break;
case KindOfInt32:
case KindOfInt64: s = "integer"; break;
case KindOfDouble: s = "double"; break;
case KindOfString: s = "string"; break;
case KindOfArray: s = "array"; break;
case KindOfVariant:
case KindOfSome:
case KindOfAny: s = "any"; break;
case KindOfObject:
{
if (m_name.empty()) s = "object";
else {
ClassScopePtr c(getClass(out.analysisResult(), BlockScopeRawPtr()));
if (c) {
s = c->getOriginalName();
} else {
s = "object";
}
}
break;
}
case KindOfNumeric: s = "numeric"; break;
case KindOfPrimitive: s = "primitive"; break;
case KindOfPlusOperand: s = "any"; break;
case KindOfSequence: s = "sequence"; break;
}
out << s;
}
示例4: serializeParam
void Symbol::serializeParam(JSON::DocTarget::OutputStream &out) const {
assert(isParameter());
JSON::DocTarget::MapStream ms(out);
ms.add("name", m_name);
ms.add("initializer");
if (m_value) {
auto valueExp = dynamic_pointer_cast<Expression>(m_value);
assert(valueExp);
auto const init = ExtractInitializer(out.analysisResult(), valueExp);
if (!init.empty()) out << init;
else out << JSON::Null();
} else {
out << JSON::Null();
}
ms.done();
}
示例5: serializeParam
void Symbol::serializeParam(JSON::DocTarget::OutputStream &out) const {
assert(isParameter());
JSON::DocTarget::MapStream ms(out);
ms.add("name", m_name);
ms.add("type", getFinalType());
ms.add("referenced", isReferenced());
ms.add("initializer");
if (m_value) {
ExpressionPtr valueExp(
dynamic_pointer_cast<Expression>(m_value));
assert(valueExp);
const string &init = ExtractInitializer(out.analysisResult(), valueExp);
if (!init.empty()) out << init;
else out << JSON::Null();
} else {
out << JSON::Null();
}
ms.done();
}