Ninja
includes_normalize.h
Go to the documentation of this file.
1 // Copyright 2012 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <string>
16 #include <vector>
17 using namespace std;
18 
19 struct StringPiece;
20 
21 /// Utility functions for normalizing include paths on Windows.
22 /// TODO: this likely duplicates functionality of CanonicalizePath; refactor.
24  // Internal utilities made available for testing, maybe useful otherwise.
25  static string Join(const vector<string>& list, char sep);
26  static vector<string> Split(const string& input, char sep);
27  static string ToLower(const string& s);
28  static string AbsPath(StringPiece s);
29  static string Relativize(StringPiece path, const string& start);
30 
31  /// Normalize by fixing slashes style, fixing redundant .. and . and makes the
32  /// path relative to |relative_to|. Case is normalized to lowercase on
33  /// Windows too.
34  static string Normalize(const string& input, const char* relative_to);
35 };
StringPiece represents a slice of a string whose memory is managed externally.
Definition: string_piece.h:27
Utility functions for normalizing include paths on Windows.