const std::string UlamTypePrimitive::getUlamTypeMangledType() { // e.g. parsing overloaded functions, may not be complete. std::ostringstream mangled; s32 bitsize = getBitSize(); s32 arraysize = getArraySize(); if(isReference()) //includes ALT_ARRAYITEM (t3147) mangled << "r"; if(arraysize > 0) mangled << ToLeximitedNumber(arraysize); else mangled << 10; if(bitsize > 0) mangled << ToLeximitedNumber(bitsize); else mangled << 10; std::string ecode(UlamTypePrimitive::getUlamTypeEnumCodeChar(getUlamTypeEnum())); mangled << ToLeximited(ecode).c_str(); return mangled.str(); } //getUlamTypeMangledType
ASTType *ASTType::getReferenceTy() { if(isReference()) { return this; } else { return getPointerTy(); } }
const std::string UlamType::getUlamTypeMangledType() { // e.g. parsing overloaded functions, may not be complete. std::ostringstream mangled; s32 bitsize = getBitSize(); s32 arraysize = getArraySize(); if(isReference()) //includes ALT_ARRAYITEM (t3147); not isAltRefType (t3114) mangled << "r"; //e.g. t3114 if(arraysize > 0) mangled << ToLeximitedNumber(arraysize); // else if(arraysize == 0) // mangled << ToLeximitedNumber(-1); //distinct from scalar else mangled << 10; //scalar NONARRAYSIZE if(bitsize > 0) mangled << ToLeximitedNumber(bitsize); else mangled << 10; std::string ecode(UlamType::getUlamTypeEnumCodeChar(getUlamTypeEnum())); mangled << ToLeximited(ecode).c_str(); return mangled.str(); } //getUlamTypeMangledType
bool PageDef::documentedPage() const { return // not part of a group !getGroupDef() && // not an externally defined page !isReference(); }
QString TypeInfo::toString() const { QString tmp; tmp += m_qualifiedName.join("::"); if (isConstant()) tmp += QLatin1String(" const"); if (isVolatile()) tmp += QLatin1String(" volatile"); if (indirections()) tmp += QString(indirections(), QLatin1Char('*')); if (isReference()) tmp += QLatin1Char('&'); if (isFunctionPointer()) { tmp += QLatin1String(" (*)("); for (int i = 0; i < m_arguments.count(); ++i) { if (i != 0) tmp += QLatin1String(", "); tmp += m_arguments.at(i).toString(); } tmp += QLatin1String(")"); } foreach(QString elt, arrayElements()) { tmp += QLatin1String("["); tmp += elt; tmp += QLatin1String("]"); }
FORECAST UlamTypePrimitive::explicitlyCastable(UTI typidx) { FORECAST scr = UlamType::safeCast(typidx); //default if(scr == CAST_CLEAR) { // primitives must be the same sizes when casting to a reference type if(isReference() && !UlamType::checkReferenceCast(typidx)) scr = CAST_BAD; // strings cannot be cast explicitly to other primitive types, except Void (t3961) UlamType * vut = m_state.getUlamTypeByIndex(typidx); ULAMTYPE valtypEnum = vut->getUlamTypeEnum(); if((getUlamTypeEnum() != Void) && ((valtypEnum == String) ^ (getUlamTypeEnum() == String))) scr = CAST_BAD; //only quarks may be cast to Ints, explicitly or not; requires toInt method (t3996) if(valtypEnum == Class) { ULAMCLASSTYPE vclasstype = vut->getUlamClassType(); if(vclasstype != UC_QUARK) scr = CAST_BAD; } } return scr; } //explicitlyCastable
void Value::dump() const { if (!isValid()) { qDebug("Invalid Value"); return; } qDebug() << "Value:" << mValueType->name() << (isReference() ? " (reference)" : ""); if (isConstant()) qDebug() << "\t = " << constant().valueInfo(); }
bool PageDef::visibleInIndex() const { static bool externalPages = Config_getBool("EXTERNAL_PAGES"); return // not part of a group !getGroupDef() && // not an externally defined page (!isReference() || externalPages) ; }
bool FileDef::generateSourceFile() const { QCString extension = name().right(4); return !isReference() && (Config_getBool("SOURCE_BROWSER") || (Config_getBool("VERBATIM_HEADERS") && guessSection(name())==Entry::HEADER_SEC) ) && extension!=".doc" && extension!=".txt" && extension!=".dox"; }
bool VaapiDecoderH265::DPB::bump() { PictureList::iterator it = find_if(m_pictures.begin(),m_pictures.end(), isOutputNeeded); if (it == m_pictures.end()) return false; bool success = output(*it); if (!isReference(*it)) m_pictures.erase(it); return success; }
QCString GroupDef::getOutputFileBase() const { if (isReference()) { return fileName; } else { return convertNameToFile(fileName); } }
void NamespaceDef::setFileName(const QCString &fn) { if (isReference()) { fileName = "namespace"+fn; } else { fileName = convertNameToFile("namespace"+fn); } }
/*virtual*/ std::string CCopasiObject::getObjectDisplayName(bool regular /*=true*/, bool richtext /*=false*/) const { std::string ret = ""; if (mpObjectParent) { ret = mpObjectParent->getObjectDisplayName(regular, richtext); if (ret == "(CN)Root" || ret == "ModelList[]" || ret.substr(0, 7) == "(Model)") { ret = ""; } } if (ret.length() >= 2) if ((ret.substr(ret.length() - 2) == "[]") && (!isReference())) { ret.insert(ret.length() - 1, getObjectName()); if (isNameVector() || isVector() || getObjectType() == "ParameterGroup") ret += "[]"; return ret; } if ((ret.length() != 0) && (ret[ret.length() - 1] != '.')) ret += "."; if (isNameVector() || isVector() || getObjectType() == "ParameterGroup") ret += getObjectName() + "[]"; else if (isReference() || getObjectType() == "Parameter" || getObjectType() == getObjectName()) ret += getObjectName(); else ret += "(" + getObjectType() + ")" + getObjectName(); return ret; }
// called prior to using the allele in analysis // called again when haplotype alleles are built, in which case the "currentBase" is set to the alternate sequence of the allele void Allele::update(int haplotypeLength) { if (haplotypeLength == 1) { if (type == ALLELE_REFERENCE) { currentBase = string(1, *currentReferenceBase); } else { currentBase = base(); } } else { currentBase = base(); } // should be done after setting currentBase to haplotypeLength if (isReference()) setQuality(); basesLeft = bpLeft(); basesRight = bpRight(); }
ExpressionPtr buildPtrOperation(BasicGenerator::Operator op, const ExpressionPtr& ptrExpr) { assert_true(isReference(ptrExpr) && isPointer(core::analysis::getReferencedType(ptrExpr->getType()))) << "Trying to build a unary pointer operation with non-ref<ptr>."; IRBuilder builder(ptrExpr->getNodeManager()); auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>(); switch(op) { case BasicGenerator::Operator::PostInc: return builder.callExpr(pExt.getPtrPostInc(), ptrExpr); case BasicGenerator::Operator::PostDec: return builder.callExpr(pExt.getPtrPostDec(), ptrExpr); case BasicGenerator::Operator::PreInc: return builder.callExpr(pExt.getPtrPreInc(), ptrExpr); case BasicGenerator::Operator::PreDec: return builder.callExpr(pExt.getPtrPreDec(), ptrExpr); default: break; } assert_fail() << "Unsupported unary pointer operation " << op; return ExpressionPtr(); }
bool NamespaceDef::isLinkableInProject() const { int i = name().findRev("::"); if (i==-1) i=0; else i+=2; static bool extractAnonNs = Config_getBool("EXTRACT_ANON_NSPACES"); if (extractAnonNs && // extract anonymous ns name().mid(i,20)=="anonymous_namespace{" // correct prefix ) // not disabled by config { return TRUE; } return !name().isEmpty() && name().at(i)!='@' && // not anonymous (hasDocumentation() || getLanguage()==SrcLangExt_CSharp) && // documented !isReference() && // not an external reference !isHidden() && // not hidden !isArtificial(); // or artificial }
Type::Type(const std::string signature) { _signature = util::trim(signature); _className = _signature; if (isPointer()) { util::eraseAll(_className, "*"); } else if (isReference()) { util::erase(_className, "&"); } util::erase(_className, "const"); _className = util::trim(_className); if (isTemplate()) { extractTemplateParameters(); } }
void Metadata::addReference(const std::shared_ptr<Metadata>& md, const std::string& refName) { if (md == nullptr) VMF_EXCEPTION(NullPointerException, "Metadata is nullptr!" ); if (md->getId() == INVALID_ID) VMF_EXCEPTION(IncorrectParamException, "Metadata has to be added into stream before being referenced!" ); if (m_pStream != nullptr && md->m_pStream != m_pStream) VMF_EXCEPTION(IncorrectParamException, "Referenced metadata is from different metadata stream." ); if (isReference(md, refName)) VMF_EXCEPTION(IncorrectParamException, "This reference already exist."); auto spRefDesc = m_spDesc->getReferenceDesc(refName); if (!spRefDesc) VMF_EXCEPTION(IncorrectParamException, "No such reference description."); if (spRefDesc->isUnique) { auto mdSet = getReferencesByName(refName); auto itemsExist = mdSet.size(); if (itemsExist == 0) { m_vReferences.emplace_back(Reference(spRefDesc, md)); } else VMF_EXCEPTION(IncorrectParamException, "Unique reference with this name already exists"); } else { m_vReferences.emplace_back(Reference(spRefDesc, md)); } return; }
bool DirDef::isLinkable() const { return isReference() || isLinkableInProject(); }
bool NamespaceDef::isLinkable() const { return isLinkableInProject() || isReference(); }
String Symbol::toString(const std::shared_ptr<Project> &project, const Flags<ToStringFlag> cursorInfoFlags, Flags<Location::ToStringFlag> locationToStringFlags, const Set<String> &pieceFilters) const { auto filterPiece = [&pieceFilters](const char *name) { return pieceFilters.isEmpty() || pieceFilters.contains(name); }; auto properties = [this, &filterPiece]() -> String { List<String> ret; if (isDefinition() && filterPiece("definition")) ret << "Definition"; if (isContainer() && filterPiece("container")) ret << "Container"; if ((flags & PureVirtualMethod) == PureVirtualMethod && filterPiece("purevirtual")) ret << "Pure Virtual"; if (flags & VirtualMethod && filterPiece("virtual")) ret << "Virtual"; if (flags & ConstMethod) { if (filterPiece("constmethod")) ret << "ConstMethod"; } else if (flags & StaticMethod && filterPiece("static")) { ret << "Static"; } if (flags & Variadic && filterPiece("variadic")) ret << "Variadic"; if (flags & Auto && filterPiece("auto")) ret << "Auto"; if (flags & MacroExpansion && filterPiece("macroexpansion")) ret << "MacroExpansion"; if (flags & TemplateSpecialization && filterPiece("templatespecialization")) ret << "TemplateSpecialization"; if (flags & TemplateReference && filterPiece("templatereference")) ret << "TemplateReference"; if (ret.isEmpty()) return String(); return String::join(ret, ' ') + '\n'; }; List<String> bases; List<String> args; if (project) { if (filterPiece("baseclasses")) { for (const auto &base : baseClasses) { bool found = false; for (const auto &sym : project->findByUsr(base, location.fileId(), Project::ArgDependsOn)) { bases << sym.symbolName; found = true; break; } if (!found) { bases << base; } } } if (filterPiece("arguments")) { for (const auto &arg : arguments) { const String symName = project->findSymbol(arg.cursor).symbolName; if (!symName.isEmpty()) { args << symName; } else { args << arg.cursor.toString(locationToStringFlags & ~Location::ShowContext); } } } } else if (filterPiece("baseClasses")) { bases = baseClasses; } String ret; auto writePiece = [&ret, &filterPiece](const char *key, const char *filter, const String &piece) { if (piece.isEmpty()) return; if (!filterPiece(filter)) return; if (key && strlen(key)) ret << key << ": "; ret << piece << "\n"; }; writePiece(0, "location", location.toString(locationToStringFlags)); writePiece("SymbolName", "symbolname", symbolName); writePiece("Kind", "kind", kindSpelling()); if (filterPiece("type")) { if (!typeName.isEmpty()) { ret += "Type: " + typeName + "\n"; } else if (type != CXType_Invalid) { ret += "Type: " + RTags::eatString(clang_getTypeKindSpelling(type)) + "\n"; } } writePiece("SymbolLength", "symbollength", std::to_string(symbolLength)); if (startLine != -1) writePiece("Range", "range", String::format<32>("%d:%d-%d:%d", startLine, startColumn, endLine, endColumn)); #if CINDEX_VERSION_MINOR > 1 if (kind == CXCursor_EnumConstantDecl) writePiece("Enum Value", "enumvalue", String::format<32>("%lld/0x%0llx", static_cast<long long>(enumValue), static_cast<long long>(enumValue))); if (isDefinition() && RTags::isFunction(kind)) writePiece("Stack cost", "stackcost", std::to_string(stackCost)); #endif writePiece(0, "linkage", linkageSpelling(linkage)); ret += properties(); writePiece("Usr", "usr", usr); if (size) writePiece("sizeof", "sizeof", std::to_string(size)); if (fieldOffset >= 0) writePiece("Field offset (bits/bytes)", "fieldoffset", String::format<32>("%d/%d", fieldOffset, fieldOffset / 8)); if (alignment >= 0) writePiece("Alignment", "alignment", std::to_string(alignment)); if (!args.isEmpty()) writePiece("Arguments", "arguments", String::join(args, ", ")); if (!bases.isEmpty()) writePiece("Base classes", "baseclasses", String::join(bases, ", ")); writePiece("Brief comment", "briefcomment", briefComment); writePiece("XML comment", "xmlcomment", xmlComment); if ((cursorInfoFlags & IncludeParents && filterPiece("parent")) || (cursorInfoFlags & (IncludeContainingFunction) && filterPiece("cf")) || (cursorInfoFlags & (IncludeContainingFunctionLocation) && filterPiece("cfl"))) { auto syms = project->openSymbols(location.fileId()); uint32_t idx = -1; if (syms) { idx = syms->lowerBound(location); if (idx == std::numeric_limits<uint32_t>::max()) { idx = syms->count() - 1; } } const unsigned int line = location.line(); const unsigned int column = location.column(); while (idx-- > 0) { const Symbol s = syms->valueAt(idx); if (s.isDefinition() && s.isContainer() && comparePosition(line, column, s.startLine, s.startColumn) >= 0 && comparePosition(line, column, s.endLine, s.endColumn) <= 0) { if (cursorInfoFlags & IncludeContainingFunctionLocation) writePiece("Containing function location", "cfl", s.location.toString(locationToStringFlags)); if (cursorInfoFlags & IncludeContainingFunction) writePiece("Containing function", "cf", s.symbolName); if (cursorInfoFlags & IncludeParents) writePiece("Parent", "parent", s.location.toString(locationToStringFlags)); // redundant, this is a mess break; } } } if (cursorInfoFlags & IncludeTargets && project && filterPiece("targets")) { const auto targets = project->findTargets(*this); if (targets.size()) { ret.append("Targets:\n"); auto best = RTags::bestTarget(targets); ret.append(String::format<128>(" %s\n", best.location.toString(locationToStringFlags).constData())); for (const auto &tit : targets) { if (tit.location != best.location) ret.append(String::format<128>(" %s\n", tit.location.toString(locationToStringFlags).constData())); } } } if (cursorInfoFlags & IncludeReferences && project && !isReference() && filterPiece("references")) { const auto references = project->findCallers(*this); if (references.size()) { ret.append("References:\n"); for (const auto &r : references) { ret.append(String::format<128>(" %s\n", r.location.toString(locationToStringFlags).constData())); } } } return ret; }
bool GroupDef::isLinkableInProject() const { return !isReference() && isLinkable(); }
bool Type::isObject() const { return !isFunction() && !isReference() && !isVoid(); }
bool DirDef::isLinkableInProject() const { return !isReference() && Config_getBool("SHOW_DIRECTORIES"); }
String Symbol::toString(Flags<ToStringFlag> cursorInfoFlags, Flags<Location::ToStringFlag> locationToStringFlags, const std::shared_ptr<Project> &project) const { auto properties = [this]() { List<String> ret; if (isDefinition()) ret << "Definition"; if (isContainer()) ret << "Container"; if ((flags & PureVirtualMethod) == PureVirtualMethod) { ret << "Pure Virtual"; } else if (flags & VirtualMethod) { ret << "Virtual"; } if (flags & ConstMethod) { ret << "Const"; } else if (flags & StaticMethod) { ret << "Static"; } if (flags & Variadic) ret << "Variadic"; if (flags & Auto) ret << "Auto"; if (flags & AutoRef) ret << "AutoRef"; if (flags & MacroExpansion) ret << "MacroExpansion"; if (flags & TemplateSpecialization) ret << "TemplateSpecialization"; if (ret.isEmpty()) return String(); String joined = String::join(ret, ' '); joined += '\n'; return joined; }; List<String> bases; List<String> args; if (project) { for (const auto &base : baseClasses) { bool found = false; for (const auto &sym : project->findByUsr(base, location.fileId(), Project::ArgDependsOn, location)) { bases << sym.symbolName; found = true; break; } if (!found) { bases << base; } } for (const auto &arg : arguments) { const String symName = project->findSymbol(arg.cursor).symbolName; if (!symName.isEmpty()) { args << symName; } else { args << arg.cursor.toString(locationToStringFlags & ~Location::ShowContext); } } } else { bases = baseClasses; } auto printTypeName = [this]() { String str; if (!typeName.isEmpty()) { str = typeName; } else if (type != CXType_Invalid) { str = RTags::eatString(clang_getTypeKindSpelling(type)); } else { return String(); } return String::format<128>("Type: %s\n", str.constData()); }; String ret = String::format<1024>("%s\n" "SymbolName: %s\n" "Kind: %s\n" "%s" // type "SymbolLength: %u\n" "%s" // range "%s" // enumValue/stackCost "%s" // linkage "%s" // properties "%s" // usr "%s" // sizeof "%s" // fieldoffset "%s" // alignment "%s" // arguments "%s" // baseclasses "%s" // briefComment "%s", // xmlComment location.toString(locationToStringFlags).constData(), symbolName.constData(), kindSpelling().constData(), printTypeName().constData(), symbolLength, startLine != -1 ? String::format<32>("Range: %d:%d-%d:%d\n", startLine, startColumn, endLine, endColumn).constData() : "", #if CINDEX_VERSION_MINOR > 1 (kind == CXCursor_EnumConstantDecl ? String::format<32>("Enum Value: %lld/0x%0llx\n", static_cast<long long>(enumValue), static_cast<long long>(enumValue)).constData() : (isDefinition() && RTags::isFunction(kind) ? String::format<32>("Stack cost: %d\n", stackCost).constData() : "")), #else "", #endif linkageSpelling(linkage), properties().constData(), usr.isEmpty() ? "" : String::format<64>("Usr: %s\n", usr.constData()).constData(), size > 0 ? String::format<16>("sizeof: %d\n", size).constData() : "", fieldOffset >= 0 ? String::format<32>("field offset (bits/bytes): %d/%d\n", fieldOffset, fieldOffset / 8).constData() : "", alignment >= 0 ? String::format<32>("alignment (bytes): %d\n", alignment).constData() : "", args.isEmpty() ? "" : String::format<1024>("Arguments: %s\n", String::join(args, ", ").constData()).constData(), bases.isEmpty() ? "" : String::format<64>("BaseClasses: %s\n", String::join(bases, ", ").constData()).constData(), briefComment.isEmpty() ? "" : String::format<1024>("Brief comment: %s\n", briefComment.constData()).constData(), xmlComment.isEmpty() ? "" : String::format<16384>("XML comment: %s\n", xmlComment.constData()).constData()); if (cursorInfoFlags & IncludeTargets && project) { const auto targets = project->findTargets(*this); if (targets.size()) { ret.append("Targets:\n"); auto best = RTags::bestTarget(targets); ret.append(String::format<128>(" %s\n", best.location.toString(locationToStringFlags).constData())); for (const auto &tit : targets) { if (tit.location != best.location) ret.append(String::format<128>(" %s\n", tit.location.toString(locationToStringFlags).constData())); } } } if (cursorInfoFlags & IncludeReferences && project && !isReference()) { const auto references = project->findCallers(*this); if (references.size()) { ret.append("References:\n"); for (const auto &r : references) { ret.append(String::format<128>(" %s\n", r.location.toString(locationToStringFlags).constData())); } } } return ret; }
void TreeNode::debugInfo( TreeRoot * root ) //----------------------------------------- { WString boundLine; WString descendLine; char * enabled; char * placed; WString statLine; WString refLine; WString rootLine; TreeCoord ox, oy; TreeRect rootRect; ox = _parent->getXOff(); oy = _parent->getYOff(); root->getBound( rootRect ); rootLine.printf( "_rootNode = %s, bounding(%ld,%ld,%ld,%ld) ", root->node()->name(), rootRect.x(), rootRect.y(), rootRect.w(), rootRect.h() ); boundLine.printf( "_bounding [%s] = (%ld,%ld,%ld,%ld), offset = (%ld,%ld) ", (_flags.boundSet) ? "set" : "unset", _bounding.x(), _bounding.y(), _bounding.w(), _bounding.h(), ox, oy ); descendLine.printf( "_sibWidth = %ld, _descend = (%ld,%ld,%ld,%ld) ", _sibWidth, _descend.x(), _descend.y(), _descend.w(), _descend.h() ); switch( _flags.enabled ) { case Hidden: enabled = "Hidden"; break; default: enabled = "Visible"; break; } switch( _flags.placed ) { case NotPlaced: placed = "NotPlaced"; break; case PartiallyPlaced: placed = "PartiallyPlaced"; break; case Arranging: placed = "Arranging"; break; default: placed = "Placed"; } statLine.printf( " enabled = %s, placed = %s, selected = %s, _level = %d\n", enabled, placed, (_flags.selected) ? "true" : "false", getLevel() ); refLine.printf( "hasReference() = %s, isReference() = %s", hasReference() ? "true" : "false", isReference() ? "true" : "false" ); WMessageDialog::messagef( _parent, MsgPlain, MsgOk, name(), "%s%s%s%s%s", (const char *)rootLine, (const char *)boundLine, (const char *)descendLine, (const char *)statLine, (const char *)refLine ); }
Type Type::stripInitialPointersReferencesAndArrays() const { if( isPointer() || isReference() || isArray() ) return dereference().stripInitialPointersReferencesAndArrays(); else return *this; }
Type Type::stripInitialReferences() const { if( isReference() ) return dereference().stripInitialReferences(); else return *this; }
void populateSchema( const AdapterType &node, Schema &schema, boost::optional<DereferenceFunction<AdapterType> > deref = boost::none, Schema *parentSchema = NULL, const std::string *ownName = NULL) { if ((isReference(node))) { const AdapterType &childNode = resolveReference<AdapterType>(deref, schema, node); populateSchema<AdapterType>(childNode, schema, deref, parentSchema, ownName); return; } const typename AdapterType::Object object = node.asObject(); typename AdapterType::Object::const_iterator itr(object.end()); if ((itr = object.find("id")) != object.end()) { if (itr->second.maybeString()) { schema.setId(itr->second.asString()); } } if ((itr = object.find("allOf")) != object.end()) { const AdapterType originalChildNode = itr->second; const AdapterType &actualChildNode = resolveReference<AdapterType>(deref, schema, originalChildNode); schema.addConstraint(makeAllOfConstraint(actualChildNode, deref)); } if ((itr = object.find("anyOf")) != object.end()) { schema.addConstraint(makeAnyOfConstraint(itr->second, deref)); } if ((itr = object.find("dependencies")) != object.end()) { schema.addConstraint(makeDependenciesConstraint(itr->second, deref)); } if ((itr = object.find("enum")) != object.end()) { schema.addConstraint(makeEnumConstraint(itr->second)); } { // Check for schema keywords that require the creation of a // ItemsConstraint instance. const typename AdapterType::Object::const_iterator itemsItr = object.find("items"), additionalitemsItr = object.find("additionalItems"); if (object.end() != itemsItr || object.end() != additionalitemsItr) { schema.addConstraint(makeItemsConstraint( itemsItr != object.end() ? &itemsItr->second : NULL, additionalitemsItr != object.end() ? &additionalitemsItr->second : NULL, deref)); } } if ((itr = object.find("maximum")) != object.end()) { typename AdapterType::Object::const_iterator exclusiveMaximumItr = object.find("exclusiveMaximum"); if (exclusiveMaximumItr == object.end()) { schema.addConstraint(makeMaximumConstraint<AdapterType>(itr->second, NULL)); } else { schema.addConstraint(makeMaximumConstraint(itr->second, &exclusiveMaximumItr->second)); } } else if (object.find("exclusiveMaximum") != object.end()) { // throw exception } if ((itr = object.find("maxItems")) != object.end()) { schema.addConstraint(makeMaxItemsConstraint(itr->second)); } if ((itr = object.find("maxLength")) != object.end()) { schema.addConstraint(makeMaxLengthConstraint(itr->second)); } if ((itr = object.find("maxProperties")) != object.end()) { schema.addConstraint(makeMaxPropertiesConstraint(itr->second)); } if ((itr = object.find("minimum")) != object.end()) { typename AdapterType::Object::const_iterator exclusiveMinimumItr = object.find("exclusiveMinimum"); if (exclusiveMinimumItr == object.end()) { schema.addConstraint(makeMinimumConstraint<AdapterType>(itr->second, NULL)); } else { schema.addConstraint(makeMinimumConstraint(itr->second, &exclusiveMinimumItr->second)); } } else if (object.find("exclusiveMinimum") != object.end()) { // throw exception } if ((itr = object.find("minItems")) != object.end()) { schema.addConstraint(makeMinItemsConstraint(itr->second)); } if ((itr = object.find("minLength")) != object.end()) { schema.addConstraint(makeMinLengthConstraint(itr->second)); } if ((itr = object.find("minProperties")) != object.end()) { schema.addConstraint(makeMinPropertiesConstraint(itr->second)); } if ((itr = object.find("not")) != object.end()) { schema.addConstraint(makeNotConstraint(itr->second, deref)); } if ((itr = object.find("oneOf")) != object.end()) { schema.addConstraint(makeOneOfConstraint(itr->second, deref)); } if ((itr = object.find("pattern")) != object.end()) { schema.addConstraint(makePatternConstraint(itr->second)); } { // Check for schema keywords that require the creation of a // PropertiesConstraint instance. const typename AdapterType::Object::const_iterator propertiesItr = object.find("properties"), patternPropertiesItr = object.find("patternProperties"), additionalPropertiesItr = object.find("additionalProperties"); if (object.end() != propertiesItr || object.end() != patternPropertiesItr || object.end() != additionalPropertiesItr) { schema.addConstraint(makePropertiesConstraint( propertiesItr != object.end() ? &propertiesItr->second : NULL, patternPropertiesItr != object.end() ? &patternPropertiesItr->second : NULL, additionalPropertiesItr != object.end() ? &additionalPropertiesItr->second : NULL, deref, &schema)); } } if ((itr = object.find("required")) != object.end()) { if (version == kDraft3) { if (parentSchema && ownName) { if (constraints::Constraint *c = makeRequiredConstraintForSelf(itr->second, *ownName)) { parentSchema->addConstraint(c); } } else { throw std::runtime_error("'required' constraint not valid here"); } } else { schema.addConstraint(makeRequiredConstraint(itr->second)); } } if ((itr = object.find("title")) != object.end()) { } if ((itr = object.find("type")) != object.end()) { schema.addConstraint(makeTypeConstraint(itr->second, deref)); } if ((itr = object.find("uniqueItems")) != object.end()) { constraints::Constraint *constraint = makeUniqueItemsConstraint(itr->second); if (constraint) { schema.addConstraint(constraint); } } }
inline bool isUnusedPicture(const PicturePtr& picture) { return !isReference(picture) && !isOutputNeeded(picture); }