Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef AAPT_UTIL_H |
| 18 | #define AAPT_UTIL_H |
| 19 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 20 | #include <functional> |
| 21 | #include <memory> |
| 22 | #include <ostream> |
| 23 | #include <string> |
| 24 | #include <vector> |
| 25 | |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame^] | 26 | #include "androidfw/BigBuffer.h" |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 27 | #include "androidfw/ResourceTypes.h" |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 28 | #include "androidfw/StringPiece.h" |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 29 | #include "utils/ByteOrder.h" |
| 30 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 31 | #ifdef _WIN32 |
| 32 | // TODO(adamlesinski): remove once http://b/32447322 is resolved. |
| 33 | // utils/ByteOrder.h includes winsock2.h on WIN32, |
| 34 | // which will pull in the ERROR definition. This conflicts |
| 35 | // with android-base/logging.h, which takes care of undefining |
| 36 | // ERROR, but it gets included too early (before winsock2.h). |
| 37 | #ifdef ERROR |
| 38 | #undef ERROR |
| 39 | #endif |
| 40 | #endif |
| 41 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 42 | namespace aapt { |
| 43 | namespace util { |
| 44 | |
Adam Lesinski | c744ae8 | 2017-05-17 19:28:38 -0700 | [diff] [blame] | 45 | template <typename T> |
| 46 | struct Range { |
| 47 | T start; |
| 48 | T end; |
| 49 | }; |
| 50 | |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 51 | std::vector<std::string> Split(const android::StringPiece& str, char sep); |
| 52 | std::vector<std::string> SplitAndLowercase(const android::StringPiece& str, char sep); |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 53 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 54 | // Returns true if the string starts with prefix. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 55 | bool StartsWith(const android::StringPiece& str, const android::StringPiece& prefix); |
Adam Lesinski | 4d3a987 | 2015-04-09 19:53:22 -0700 | [diff] [blame] | 56 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 57 | // Returns true if the string ends with suffix. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 58 | bool EndsWith(const android::StringPiece& str, const android::StringPiece& suffix); |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 59 | |
Adam Lesinski | 2eed52e | 2018-02-21 15:55:58 -0800 | [diff] [blame] | 60 | // Creates a new StringPiece that points to a substring of the original string without leading |
| 61 | // whitespace. |
| 62 | android::StringPiece TrimLeadingWhitespace(const android::StringPiece& str); |
| 63 | |
| 64 | // Creates a new StringPiece that points to a substring of the original string without trailing |
| 65 | // whitespace. |
| 66 | android::StringPiece TrimTrailingWhitespace(const android::StringPiece& str); |
| 67 | |
| 68 | // Creates a new StringPiece that points to a substring of the original string without leading or |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 69 | // trailing whitespace. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 70 | android::StringPiece TrimWhitespace(const android::StringPiece& str); |
Adam Lesinski | 3b4cd94 | 2015-10-30 16:31:42 -0700 | [diff] [blame] | 71 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 72 | // Tests that the string is a valid Java class name. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 73 | bool IsJavaClassName(const android::StringPiece& str); |
Adam Lesinski | a1ad4a8 | 2015-06-08 11:41:09 -0700 | [diff] [blame] | 74 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 75 | // Tests that the string is a valid Java package name. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 76 | bool IsJavaPackageName(const android::StringPiece& str); |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 77 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 78 | // Tests that the string is a valid Android package name. More strict than a Java package name. |
| 79 | // - First character of each component (separated by '.') must be an ASCII letter. |
| 80 | // - Subsequent characters of a component can be ASCII alphanumeric or an underscore. |
| 81 | // - Package must contain at least two components, unless it is 'android'. |
Rhed Jao | 2c43442 | 2020-11-12 10:48:03 +0800 | [diff] [blame] | 82 | // - The maximum package name length is 223. |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 83 | bool IsAndroidPackageName(const android::StringPiece& str); |
| 84 | |
| 85 | // Tests that the string is a valid Android split name. |
| 86 | // - First character of each component (separated by '.') must be an ASCII letter. |
| 87 | // - Subsequent characters of a component can be ASCII alphanumeric or an underscore. |
| 88 | bool IsAndroidSplitName(const android::StringPiece& str); |
| 89 | |
Rhed Jao | 2c43442 | 2020-11-12 10:48:03 +0800 | [diff] [blame] | 90 | // Tests that the string is a valid Android shared user id. |
| 91 | // - First character of each component (separated by '.') must be an ASCII letter. |
| 92 | // - Subsequent characters of a component can be ASCII alphanumeric or an underscore. |
| 93 | // - Must contain at least two components, unless package name is 'android'. |
| 94 | // - The maximum shared user id length is 223. |
| 95 | // - Treat empty string as valid, it's the case of no shared user id. |
| 96 | bool IsAndroidSharedUserId(const android::StringPiece& package_name, |
| 97 | const android::StringPiece& shared_user_id); |
| 98 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 99 | // Converts the class name to a fully qualified class name from the given |
| 100 | // `package`. Ex: |
| 101 | // |
| 102 | // asdf --> package.asdf |
| 103 | // .asdf --> package.asdf |
| 104 | // .a.b --> package.a.b |
| 105 | // asdf.adsf --> asdf.adsf |
Ryan Mitchell | 4382e44 | 2021-07-14 12:53:01 -0700 | [diff] [blame] | 106 | std::optional<std::string> GetFullyQualifiedClassName(const android::StringPiece& package, |
| 107 | const android::StringPiece& class_name); |
Adam Lesinski | a1ad4a8 | 2015-06-08 11:41:09 -0700 | [diff] [blame] | 108 | |
Ryan Mitchell | 34039b2 | 2019-03-18 08:57:47 -0700 | [diff] [blame] | 109 | // Retrieves the formatted name of aapt2. |
| 110 | const char* GetToolName(); |
| 111 | |
| 112 | // Retrieves the build fingerprint of aapt2. |
| 113 | std::string GetToolFingerprint(); |
| 114 | |
Adam Lesinski | 060b53d | 2017-07-28 17:10:35 -0700 | [diff] [blame] | 115 | template <typename T> |
| 116 | typename std::enable_if<std::is_arithmetic<T>::value, int>::type compare(const T& a, const T& b) { |
| 117 | if (a < b) { |
| 118 | return -1; |
| 119 | } else if (a > b) { |
| 120 | return 1; |
| 121 | } |
| 122 | return 0; |
| 123 | } |
| 124 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 125 | // Makes a std::unique_ptr<> with the template parameter inferred by the compiler. |
| 126 | // This will be present in C++14 and can be removed then. |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 127 | template <typename T, class... Args> |
| 128 | std::unique_ptr<T> make_unique(Args&&... args) { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 129 | return std::unique_ptr<T>(new T{std::forward<Args>(args)...}); |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 130 | } |
| 131 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 132 | // Writes a set of items to the std::ostream, joining the times with the provided separator. |
Adam Lesinski | 36c73a5 | 2016-08-11 13:39:24 -0700 | [diff] [blame] | 133 | template <typename Container> |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 134 | ::std::function<::std::ostream&(::std::ostream&)> Joiner(const Container& container, |
| 135 | const char* sep) { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 136 | using std::begin; |
| 137 | using std::end; |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 138 | const auto begin_iter = begin(container); |
| 139 | const auto end_iter = end(container); |
| 140 | return [begin_iter, end_iter, sep](::std::ostream& out) -> ::std::ostream& { |
| 141 | for (auto iter = begin_iter; iter != end_iter; ++iter) { |
| 142 | if (iter != begin_iter) { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 143 | out << sep; |
| 144 | } |
| 145 | out << *iter; |
| 146 | } |
| 147 | return out; |
| 148 | }; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 149 | } |
| 150 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 151 | // Checks that the Java string format contains no non-positional arguments (arguments without |
| 152 | // explicitly specifying an index) when there are more than one argument. This is an error |
| 153 | // because translations may rearrange the order of the arguments in the string, which will |
| 154 | // break the string interpolation. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 155 | bool VerifyJavaStringFormat(const android::StringPiece& str); |
Adam Lesinski | b23f1e0 | 2015-11-03 12:24:17 -0800 | [diff] [blame] | 156 | |
Adam Lesinski | 2eed52e | 2018-02-21 15:55:58 -0800 | [diff] [blame] | 157 | bool AppendStyledString(const android::StringPiece& input, bool preserve_spaces, |
| 158 | std::string* out_str, std::string* out_error); |
| 159 | |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 160 | class StringBuilder { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 161 | public: |
Adam Lesinski | 2eed52e | 2018-02-21 15:55:58 -0800 | [diff] [blame] | 162 | StringBuilder() = default; |
Adam Lesinski | fba0cf2 | 2017-06-29 17:53:36 -0700 | [diff] [blame] | 163 | |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 164 | StringBuilder& Append(const android::StringPiece& str); |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 165 | const std::string& ToString() const; |
| 166 | const std::string& Error() const; |
Adam Lesinski | ac6edc5 | 2017-03-02 19:31:28 -0800 | [diff] [blame] | 167 | bool IsEmpty() const; |
Adam Lesinski | 8c3f31f | 2016-09-07 13:45:13 -0700 | [diff] [blame] | 168 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 169 | // When building StyledStrings, we need UTF-16 indices into the string, |
| 170 | // which is what the Java layer expects when dealing with java |
| 171 | // String.charAt(). |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 172 | size_t Utf16Len() const; |
Adam Lesinski | 8c3f31f | 2016-09-07 13:45:13 -0700 | [diff] [blame] | 173 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 174 | explicit operator bool() const; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 175 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 176 | private: |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 177 | std::string str_; |
| 178 | size_t utf16_len_ = 0; |
| 179 | bool quote_ = false; |
| 180 | bool trailing_space_ = false; |
| 181 | bool last_char_was_escape_ = false; |
| 182 | std::string error_; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 183 | }; |
| 184 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 185 | inline const std::string& StringBuilder::ToString() const { |
| 186 | return str_; |
| 187 | } |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 188 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 189 | inline const std::string& StringBuilder::Error() const { |
| 190 | return error_; |
| 191 | } |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 192 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 193 | inline bool StringBuilder::IsEmpty() const { |
| 194 | return str_.empty(); |
| 195 | } |
Adam Lesinski | ac6edc5 | 2017-03-02 19:31:28 -0800 | [diff] [blame] | 196 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 197 | inline size_t StringBuilder::Utf16Len() const { |
| 198 | return utf16_len_; |
| 199 | } |
Adam Lesinski | 8c3f31f | 2016-09-07 13:45:13 -0700 | [diff] [blame] | 200 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 201 | inline StringBuilder::operator bool() const { |
| 202 | return error_.empty(); |
| 203 | } |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 204 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 205 | // Writes the entire BigBuffer to the output stream. |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame^] | 206 | bool WriteAll(std::ostream& out, const android::BigBuffer& buffer); |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 207 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 208 | // A Tokenizer implemented as an iterable collection. It does not allocate any memory on the heap |
| 209 | // nor use standard containers. |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 210 | class Tokenizer { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 211 | public: |
| 212 | class iterator { |
| 213 | public: |
Adam Lesinski | 448a15c | 2017-07-25 10:59:26 -0700 | [diff] [blame] | 214 | using reference = android::StringPiece&; |
| 215 | using value_type = android::StringPiece; |
| 216 | using difference_type = size_t; |
| 217 | using pointer = android::StringPiece*; |
| 218 | using iterator_category = std::forward_iterator_tag; |
| 219 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 220 | iterator(const iterator&) = default; |
| 221 | iterator& operator=(const iterator&) = default; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 222 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 223 | iterator& operator++(); |
Adam Lesinski | d0f116b | 2016-07-08 15:00:32 -0700 | [diff] [blame] | 224 | |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 225 | android::StringPiece operator*() { return token_; } |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 226 | bool operator==(const iterator& rhs) const; |
| 227 | bool operator!=(const iterator& rhs) const; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 228 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 229 | private: |
| 230 | friend class Tokenizer; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 231 | |
Chih-Hung Hsieh | 4dc5812 | 2017-08-03 16:28:10 -0700 | [diff] [blame] | 232 | iterator(const android::StringPiece& s, char sep, const android::StringPiece& tok, bool end); |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 233 | |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 234 | android::StringPiece str_; |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 235 | char separator_; |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 236 | android::StringPiece token_; |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 237 | bool end_; |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 238 | }; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 239 | |
Chih-Hung Hsieh | 4dc5812 | 2017-08-03 16:28:10 -0700 | [diff] [blame] | 240 | Tokenizer(const android::StringPiece& str, char sep); |
Adam Lesinski | d0f116b | 2016-07-08 15:00:32 -0700 | [diff] [blame] | 241 | |
Adam Lesinski | 448a15c | 2017-07-25 10:59:26 -0700 | [diff] [blame] | 242 | iterator begin() const { |
| 243 | return begin_; |
| 244 | } |
Adam Lesinski | d0f116b | 2016-07-08 15:00:32 -0700 | [diff] [blame] | 245 | |
Adam Lesinski | 448a15c | 2017-07-25 10:59:26 -0700 | [diff] [blame] | 246 | iterator end() const { |
| 247 | return end_; |
| 248 | } |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 249 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 250 | private: |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 251 | const iterator begin_; |
| 252 | const iterator end_; |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 253 | }; |
| 254 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 255 | inline Tokenizer Tokenize(const android::StringPiece& str, char sep) { |
| 256 | return Tokenizer(str, sep); |
| 257 | } |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 258 | |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 259 | // Given a path like: res/xml-sw600dp/foo.xml |
| 260 | // |
| 261 | // Extracts "res/xml-sw600dp/" into outPrefix. |
| 262 | // Extracts "foo" into outEntry. |
| 263 | // Extracts ".xml" into outSuffix. |
| 264 | // |
| 265 | // Returns true if successful. |
Adam Lesinski | d5083f6 | 2017-01-16 15:07:21 -0800 | [diff] [blame] | 266 | bool ExtractResFilePathParts(const android::StringPiece& path, android::StringPiece* out_prefix, |
| 267 | android::StringPiece* out_entry, android::StringPiece* out_suffix); |
Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame] | 268 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 269 | } // namespace util |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 270 | |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame^] | 271 | } // namespace aapt |
| 272 | |
| 273 | namespace std { |
Adam Lesinski | 96ea08f | 2017-11-06 10:44:46 -0800 | [diff] [blame] | 274 | // Stream operator for functions. Calls the function with the stream as an argument. |
| 275 | // In the aapt namespace for lookup. |
| 276 | inline ::std::ostream& operator<<(::std::ostream& out, |
| 277 | const ::std::function<::std::ostream&(::std::ostream&)>& f) { |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 278 | return f(out); |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 279 | } |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame^] | 280 | } // namespace std |
Adam Lesinski | 6f6ceb7 | 2014-11-14 14:48:12 -0800 | [diff] [blame] | 281 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 282 | #endif // AAPT_UTIL_H |