diff options
Diffstat (limited to 'src/includes_normalize.h')
-rw-r--r-- | src/includes_normalize.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/includes_normalize.h b/src/includes_normalize.h index 98e912f..2ec08ed 100644 --- a/src/includes_normalize.h +++ b/src/includes_normalize.h @@ -21,15 +21,19 @@ struct StringPiece; /// Utility functions for normalizing include paths on Windows. /// TODO: this likely duplicates functionality of CanonicalizePath; refactor. struct IncludesNormalize { + /// Normalize path relative to |relative_to|. + IncludesNormalize(const string& relative_to); + // Internal utilities made available for testing, maybe useful otherwise. - static string Join(const vector<string>& list, char sep); - static vector<string> Split(const string& input, char sep); - static string ToLower(const string& s); static string AbsPath(StringPiece s); - static string Relativize(StringPiece path, const string& start); + static string Relativize(StringPiece path, + const vector<StringPiece>& start_list); /// Normalize by fixing slashes style, fixing redundant .. and . and makes the - /// path relative to |relative_to|. - static bool Normalize(const string& input, const char* relative_to, - string* result, string* err); + /// path relative to |relative_to_|. + bool Normalize(const string& input, string* result, string* err) const; + + private: + string relative_to_; + vector<StringPiece> splitted_relative_to_; }; |