summaryrefslogtreecommitdiffstats
path: root/source/core/slang-io.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-05-04 13:46:24 -0400
committerGitHub <noreply@github.com>2020-05-04 10:46:24 -0700
commitf59978893fed309ff19bacd787398c4bab4aa7c8 (patch)
treead28eb79ca5bab13770f035d551c77ac67aa5756 /source/core/slang-io.h
parent5d3a737e75346b6ced204829a60be2837589e9ad (diff)
C++ Extractor (#1337)
* WIP: Doing texing using slangs lexer for cpp-extractor * Node tree for C++ extraction. * Bug fixing. Add dump of hierarchy. * First pass at extracting fields. * Parse template types. * Use diagnostics defs for C++ extractor. * Simplify Diagnostic Defs. * Remove the brace stack. * Added IdentifierLookup. * Add handling for >> style template close. * Improved identifier handling/keywords. * Added ability to check if reader is at cursor position. * Handling of an unspecified root type. * Parsing code comments. Tidy up some parsing - to use advanceIf functions more. * Improve path handling. * Fixes around changes to Path interface. * Working Range, Type and Scope header. * Extract the middle part of marker and put in output. Gives more flexibility at macro injection, and in class definitions. * Split DERIVED types into it's own macro, to provide way to generate for derived types. * Fix clang/g++ compile issue. * Tabs -> spaces. * Fix small bug in getFileNameWithoutExt * Small improvement around naming. Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/core/slang-io.h')
-rw-r--r--source/core/slang-io.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/core/slang-io.h b/source/core/slang-io.h
index a42a6991b..b3d03d9a4 100644
--- a/source/core/slang-io.h
+++ b/source/core/slang-io.h
@@ -11,15 +11,15 @@ namespace Slang
class File
{
public:
- static bool exists(const Slang::String& fileName);
- static Slang::String readAllText(const Slang::String& fileName);
- static Slang::List<unsigned char> readAllBytes(const Slang::String& fileName);
- static void writeAllText(const Slang::String& fileName, const Slang::String& text);
+ static bool exists(const String& fileName);
+ static String readAllText(const String& fileName);
+ static List<unsigned char> readAllBytes(const String& fileName);
+ static void writeAllText(const String& fileName, const String& text);
static SlangResult remove(const String& fileName);
static SlangResult makeExecutable(const String& fileName);
- static SlangResult generateTemporary(const UnownedStringSlice& prefix, Slang::String& outFileName);
+ static SlangResult generateTemporary(const UnownedStringSlice& prefix, String& outFileName);
};
class Path
@@ -27,13 +27,20 @@ namespace Slang
public:
static const char kPathDelimiter = '/';
- static String truncateExt(const String& path);
+
+ /// Returns -1 if no separator is found
+ static Index findLastSeparatorIndex(String const& path);
+ /// Finds the index of the last dot in a path, else returns -1
+ static Index findExtIndex(String const& path);
+
static String replaceExt(const String& path, const char* newExt);
static String getFileName(const String& path);
- static String getFileNameWithoutExt(const String& path);
- static String getFileExt(const String& path);
+ static String getPathWithoutExt(const String& path);
+ static String getPathExt(const String& path);
static String getParentDirectory(const String& path);
+ static String getFileNameWithoutExt(const String& path);
+
static String combine(const String& path1, const String& path2);
static String combine(const String& path1, const String& path2, const String& path3);