MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / setupIcuAttributes

Method setupIcuAttributes

src/common/IntlUtil.cpp:668–704  ·  view source on GitHub ↗

Add COLL-VERSION attribute.

Source from the content-addressed store, hash-verified

666
667// Add COLL-VERSION attribute.
668bool IntlUtil::setupIcuAttributes(charset* cs, const string& specificAttributes,
669 const string& configInfo, string& newSpecificAttributes)
670{
671 AutoPtr<Jrd::CharSet> charSet(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs));
672
673 IntlUtil::SpecificAttributesMap map;
674 if (!IntlUtil::parseSpecificAttributes(charSet, specificAttributes.length(),
675 (const UCHAR*) specificAttributes.begin(), &map))
676 {
677 return false;
678 }
679
680 string icuVersion;
681 map.get("ICU-VERSION", icuVersion);
682
683 string collVersion;
684 auto icu = UnicodeUtil::getCollVersion(icuVersion, configInfo, collVersion);
685
686 if (!icu)
687 return false;
688
689 if (icuVersion.isEmpty())
690 {
691 int majorVersion, minorVersion;
692 UnicodeUtil::getICUVersion(icu, majorVersion, minorVersion);
693 icuVersion.printf("%d.%d", majorVersion, minorVersion);
694 map.put("ICU-VERSION", icuVersion);
695 }
696
697 map.remove("COLL-VERSION");
698
699 if (collVersion.hasData())
700 map.put("COLL-VERSION", collVersion);
701
702 newSpecificAttributes = IntlUtil::generateSpecificAttributes(charSet, map);
703 return true;
704}
705
706
707string IntlUtil::escapeAttribute(Jrd::CharSet* cs, const string& s)

Callers

nothing calls this directly

Calls 9

getDefaultMemoryPoolFunction · 0.85
lengthMethod · 0.45
beginMethod · 0.45
getMethod · 0.45
isEmptyMethod · 0.45
printfMethod · 0.45
putMethod · 0.45
removeMethod · 0.45
hasDataMethod · 0.45

Tested by

no test coverage detected