paludis Version 3.0.2
The one true package mangler
strip.hh
Go to the documentation of this file.
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2006, 2007 Ciaran McCreesh
5 *
6 * This file is part of the Paludis package manager. Paludis is free software;
7 * you can redistribute it and/or modify it under the terms of the GNU General
8 * Public License version 2, as published by the Free Software Foundation.
9 *
10 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef PALUDIS_GUARD_PALUDIS_STRIP_HH
21#define PALUDIS_GUARD_PALUDIS_STRIP_HH 1
22
23#include <functional>
24#include <string>
26
27/** \file
28 * Strip functions and adapters.
29 *
30 * \ingroup g_strings
31 *
32 * \section Examples
33 *
34 * - None at this time.
35 */
36
37namespace paludis
38{
39 /**
40 * Return a string equal to s, minus the string remove if remove occurs at
41 * the start of s.
42 *
43 * \ingroup g_strings
44 */
45 std::string strip_leading_string(const std::string & s, const std::string & remove) PALUDIS_VISIBLE
46 PALUDIS_ATTRIBUTE((warn_unused_result));
47
48 /**
49 * Return a string equal to s minus any leading characters that are
50 * contained in prefix.
51 *
52 * \ingroup g_strings
53 */
54 std::string strip_leading(const std::string & s, const std::string & prefix) PALUDIS_VISIBLE
55 PALUDIS_ATTRIBUTE((warn_unused_result));
56
57 /**
58 * Return a string equal to s, minus the string remove if remove occurs at
59 * the end of s.
60 *
61 * \ingroup g_strings
62 */
63 std::string strip_trailing_string(const std::string & s, const std::string & remove) PALUDIS_VISIBLE
64 PALUDIS_ATTRIBUTE((warn_unused_result));
65
66 /**
67 * Return a string equal to s minus any trailing characters that are
68 * contained in suffix.
69 *
70 * \ingroup g_strings
71 */
72 std::string strip_trailing(const std::string & s, const std::string & suffix) PALUDIS_VISIBLE
73 PALUDIS_ATTRIBUTE((warn_unused_result));
74}
75
76#endif
std::string strip_trailing(const std::string &s, const std::string &suffix) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result))
std::string strip_leading(const std::string &s, const std::string &prefix) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result))
std::string strip_leading_string(const std::string &s, const std::string &remove) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result))
std::string strip_trailing_string(const std::string &s, const std::string &remove) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result))
#define PALUDIS_ATTRIBUTE(x)
Definition attributes.hh:53
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition about_metadata-fwd.hh:24