summaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/docs/link.h
blob: 961f460b99a5b27c69b406147ebfb8e07445d017 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <library/cpp/json/json_value.h>

#include <util/generic/string.h>
#include <util/generic/maybe.h>

namespace NYql::NDocs {

    struct TLinkTarget {
        TString RelativePath;
        TMaybe<TString> Anchor;

        static TLinkTarget Parse(TStringBuf string);
    };

    using TLinkKey = TString;

    using TLinks = THashMap<TLinkKey, TLinkTarget>;

    TMaybe<TLinkTarget> Lookup(const TLinks& links, TStringBuf name);

    TLinkKey ParseLinkKey(TStringBuf string);

    TLinks ParseLinks(const NJson::TJsonValue& json);

    TLinks Merge(TLinks&& lhs, TLinks&& rhs);

} // namespace NYql::NDocs