summaryrefslogtreecommitdiffstats
path: root/source/core/slang-io.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-08 11:54:27 -0700
committerGitHub <noreply@github.com>2022-06-08 11:54:27 -0700
commit1146920bc9ed9bef2b5bb91b3cdec4700eb09881 (patch)
treee8d94a3aad0d204f7c33f38b42b9e03d862cc3c8 /source/core/slang-io.h
parentff2ae7e0c1b48fa222f14dc84f15d0178ed056a1 (diff)
Add smoke test for language server. (#2266)
Diffstat (limited to 'source/core/slang-io.h')
-rw-r--r--source/core/slang-io.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/core/slang-io.h b/source/core/slang-io.h
index de761cf4b..51b1d45e5 100644
--- a/source/core/slang-io.h
+++ b/source/core/slang-io.h
@@ -157,6 +157,23 @@ namespace Slang
static SlangResult remove(const String& path);
};
+ struct URI
+ {
+ String uri;
+ bool operator==(const URI& other) const { return uri == other.uri; }
+ bool operator!=(const URI& other) const { return uri != other.uri; }
+
+ HashCode getHashCode() const { return uri.getHashCode(); }
+
+ bool isLocalFile() { return uri.startsWith("file://"); };
+ String getPath() const;
+ StringSlice getProtocol() const;
+
+ static URI fromLocalFilePath(UnownedStringSlice path);
+ static URI fromString(UnownedStringSlice uriString);
+ static bool isSafeURIChar(char ch);
+ };
+
// Helper class to clean up temporary files on dtor
class TemporaryFileSet: public RefObject
{