MCPcopy Create free account
hub / github.com/Snapchat/Valdi / isSVG

Function isSVG

snap_drawing/src/snap_drawing/cpp/Utils/SVGUtils.cpp:19–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace snap::drawing {
18
19bool isSVG(const Valdi::BytesView& data) {
20 if (data.size() == 0 || data.data() == nullptr) {
21 return false;
22 }
23 Valdi::TextParser parser(std::string_view(reinterpret_cast<const char*>(data.data()), data.size()));
24 parser.tryParseWhitespaces();
25 return parser.tryParse("<svg") || parser.tryParse("<?xml");
26}
27
28Valdi::Result<sk_sp<SkSVGDOM>> makeSVGDOM(const Valdi::BytesView& data) {
29 Image::initializeCodecs();

Callers 10

isReservedTagFunction · 0.85
getTagNamespaceFunction · 0.85
updateDOMPropsFunction · 0.85
TESTFunction · 0.85
loadAssetMethod · 0.85
isSVGMethod · 0.85
TESTFunction · 0.85
makeMethod · 0.85
makeMethod · 0.85
isSVGMethod · 0.85

Calls 4

tryParseWhitespacesMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
tryParseMethod · 0.45

Tested by 2

TESTFunction · 0.68
TESTFunction · 0.68