1 // Copyright 2008 Brian Caine
3 // This file is part of Potpourri.
5 // Potpourri is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Potpourri is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTIBILITY of FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Potpourri. If not, see <http://www.gnu.org/licenses/>.
20 // This is a collection of odd portions of various functions
21 // shitty written, of course
28 #include "../Global.h"
31 const char path_separator
= '/';
33 const std::string parent_dir
= "..";
34 const std::string current_dir
= ".";
36 const float PI
= 3.14159;
38 const std::string url_regexp
=
39 "([a-zA-Z+-.]*)://([a-zA-Z.&:0-9]*)([~a-zA-Z./%0-9?=-]*)";
41 const std::string hostless_protocols
[] = {"file"};
45 std::vector
<std::string
> split_path
;
62 std::string
toString(T input
)
71 std::string
joinPath(std::vector
<std::string
> path
);
72 std::vector
<std::string
> splitPath(std::string path
);
73 std::string
simplifyPath(std::string orig
);
74 DirectoryNesting
compareDirectories(std::string patha
, std::string pathb
);
75 std::vector
<std::string
> pathDifference(std::string patha
, std::string pathb
);
76 bool isRelative(std::string path
);
77 ParsedPath
parsePath(std::string path
);
79 bool isURL(std::string
);
81 std::vector
<std::string
> splitString(std::string
, std::string
=" ");
85 float toRadians(float);
86 float fromRadians(float);
91 Pair
<float> getOffset(Pair
<float>, float);