1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <tools/hostfilter.hxx>
13 static std::regex
g_AllowedHostsRegex("");
14 static bool g_AllowedHostsSet
= false;
16 void HostFilter::setAllowedHostsRegex(const char* sAllowedRegex
)
18 g_AllowedHostsSet
= sAllowedRegex
&& sAllowedRegex
[0] != '\0';
19 if (g_AllowedHostsSet
)
20 g_AllowedHostsRegex
= sAllowedRegex
;
23 bool HostFilter::isForbidden(const OUString
& rHost
)
25 if (!g_AllowedHostsSet
)
28 return !std::regex_match(rHost
.toUtf8().getStr(), g_AllowedHostsRegex
);
31 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */