Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/wabt/filenames.h
1 /* 2 * Copyright 2016 WebAssembly Community Group participants 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 WABT_FILENAMES_H_ 18 #define WABT_FILENAMES_H_ 19 20 #include "wabt/common.h" 21 22 namespace wabt { 23 24 extern const char* kWasmExtension; 25 extern const char* kWatExtension; 26 27 // Return only the file extension, e.g.: 28 // 29 // "foo.txt", => ".txt" 30 // "foo" => "" 31 // "/foo/bar/foo.wasm" => ".wasm" 32 std::string_view GetExtension(std::string_view filename); 33 34 // Strip extension, e.g.: 35 // 36 // "foo", => "foo" 37 // "foo.bar" => "foo" 38 // "/path/to/foo.bar" => "/path/to/foo" 39 // "\\path\\to\\foo.bar" => "\\path\\to\\foo" 40 std::string_view StripExtension(std::string_view s); 41 42 // Strip everything up to and including the last slash, e.g.: 43 // 44 // "/foo/bar/baz", => "baz" 45 // "/usr/local/include/stdio.h", => "stdio.h" 46 // "foo.bar", => "foo.bar" 47 std::string_view GetBasename(std::string_view filename); 48 49 } // namespace wabt 50 51 #endif /* WABT_FILENAMES_H_ */