File indexing completed on 2024-04-28 05:32:12
0001 #ifndef oxygenpathlist_h 0002 #define oxygenpathlist_h 0003 /* 0004 * this file is part of the oxygen gtk engine 0005 * SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0006 * 0007 * inspired notably from kdelibs/kdeui/color/kcolorutils.h 0008 * SPDX-FileCopyrightText: 2007 Matthew Woehlke <mw_triad@users.sourceforge.net> 0009 * SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org> 0010 * SPDX-FileCopyrightText: 2007 Zack Rusin <zack@kde.org> 0011 * 0012 * SPDX-License-Identifier: LGPL-2.0-or-later 0013 */ 0014 0015 #include <iostream> 0016 #include <set> 0017 #include <string> 0018 #include <vector> 0019 0020 namespace Oxygen 0021 { 0022 0023 typedef std::set<std::string> PathSet; 0024 0025 //! utility class to handle path list 0026 //! path list 0027 class PathList: public std::vector<std::string> 0028 { 0029 0030 public: 0031 0032 //! empty constructor 0033 explicit PathList( void ) 0034 {} 0035 0036 //! splitting constructor 0037 explicit PathList( const std::string& path, const std::string& separator = ":" ) 0038 { split( path, separator ); } 0039 0040 //! split string using provided separator and store 0041 void split( const std::string&, const std::string& = ":" ); 0042 0043 //! concatenate using provided separator 0044 std::string join( const std::string& = ":" ) const; 0045 0046 friend std::ostream& operator << ( std::ostream& out, const PathList& pathList ) 0047 { 0048 for( PathList::const_iterator iter = pathList.begin(); iter != pathList.end(); iter++ ) 0049 { out << " " << *iter << std::endl; } 0050 0051 return out; 0052 } 0053 0054 }; 0055 } 0056 0057 #endif