aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/uri/other.h
blob: 7aec22e77b325d0751fd2dcd308c568286c92f86 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once

#include <util/generic/string.h>

// Some functions for inverted url representation
// No scheme cut-off, no 80th port normalization

void TrspChars(char* s);
void UnTrspChars(char* s);
void TrspChars(char* s, size_t l);
void UnTrspChars(char* s, size_t l);
void TrspChars(const char* s, char* d);
void UnTrspChars(const char* s, char* d);

void InvertDomain(char* begin, char* end);

inline TString& InvertDomain(TString& url) {
    InvertDomain(url.begin(), url.begin() + url.size());
    return url;
}

void InvertUrl(char* begin, char* end);

inline void InvertUrl(char* url) {
    InvertUrl(url, url + strlen(url));
}

inline TString& InvertUrl(TString& url) {
    InvertUrl(url.begin(), url.begin() + url.size());
    return url;
}

void RevertUrl(char* begin, char* end);

inline void RevertUrl(char* url) {
    RevertUrl(url, url + strlen(url));
}

inline TString& RevertUrl(TString& url) {
    RevertUrl(url.begin(), url.begin() + url.size());
    return url;
}