aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/base')
-rw-r--r--include/cru/base/Exception.h23
-rw-r--r--include/cru/base/Format.h2
-rw-r--r--include/cru/base/SubProcess.h15
-rw-r--r--include/cru/base/io/Stream.h11
4 files changed, 11 insertions, 40 deletions
diff --git a/include/cru/base/Exception.h b/include/cru/base/Exception.h
index f42406e0..e4da91f5 100644
--- a/include/cru/base/Exception.h
+++ b/include/cru/base/Exception.h
@@ -1,5 +1,5 @@
#pragma once
-#include "String.h"
+#include "Base.h"
#include <exception>
#include <optional>
@@ -13,16 +13,10 @@ class CRU_BASE_API Exception : public std::exception {
public:
explicit Exception(std::string message = "",
std::shared_ptr<std::exception> inner = nullptr);
- explicit Exception(StringView message,
- std::shared_ptr<std::exception> inner = nullptr);
~Exception() override;
public:
- [[deprecated("Use GetUtf8Message.")]] String GetMessage() const {
- return String::FromUtf8(message_);
- }
-
std::string GetUtf8Message() const { return this->message_; }
std::exception* GetInner() const noexcept { return inner_.get(); }
@@ -35,16 +29,6 @@ class CRU_BASE_API Exception : public std::exception {
void AppendMessage(std::string_view additional_message);
void AppendMessage(std::optional<std::string_view> additional_message);
- [[deprecated("Use void SetMessage(std::string message) instead.")]]
- void SetMessage(StringView message);
- [[deprecated(
- "Use void AppendMessage(std::string_view additional_message) instead.")]]
- void AppendMessage(StringView additional_message);
- [[deprecated(
- "Use void AppendMessage(std::optional<std::string_view> "
- "additional_message) instead.")]]
- void AppendMessage(std::optional<StringView> additional_message);
-
private:
std::string message_;
std::shared_ptr<std::exception> inner_;
@@ -71,11 +55,6 @@ class ErrnoException : public Exception {
*/
explicit ErrnoException(std::string_view message);
ErrnoException(std::string_view message, int errno_code);
- /**
- * @brief will retrieve errno automatically.
- */
- explicit ErrnoException(StringView message);
- ErrnoException(StringView message, int errno_code);
int GetErrnoCode() const { return errno_code_; }
diff --git a/include/cru/base/Format.h b/include/cru/base/Format.h
index 2d95b2fd..4f56d189 100644
--- a/include/cru/base/Format.h
+++ b/include/cru/base/Format.h
@@ -128,7 +128,7 @@ void FormatAppendFromFormatTokenList(
return;
} else {
throw Exception(
- u"Currently do not support positional or named place holder.");
+ "Currently do not support positional or named place holder.");
}
} else {
current += token.data;
diff --git a/include/cru/base/SubProcess.h b/include/cru/base/SubProcess.h
index 482edb6e..1562769e 100644
--- a/include/cru/base/SubProcess.h
+++ b/include/cru/base/SubProcess.h
@@ -1,7 +1,6 @@
#pragma once
#include "Base.h"
#include "Exception.h"
-#include "String.h"
#include "io/Stream.h"
#include <chrono>
@@ -48,9 +47,9 @@ class CRU_BASE_API SubProcessInternalException : public SubProcessException {
};
struct SubProcessStartInfo {
- String program;
- std::vector<String> arguments;
- std::unordered_map<String, String> environments;
+ std::string program;
+ std::vector<std::string> arguments;
+ std::unordered_map<std::string, std::string> environments;
};
enum class SubProcessExitType {
@@ -216,12 +215,12 @@ class CRU_BASE_API SubProcess : public Object {
public:
static SubProcess Create(
- String program, std::vector<String> arguments = {},
- std::unordered_map<String, String> environments = {});
+ std::string program, std::vector<std::string> arguments = {},
+ std::unordered_map<std::string, std::string> environments = {});
static SubProcessExitResult Call(
- String program, std::vector<String> arguments = {},
- std::unordered_map<String, String> environments = {});
+ std::string program, std::vector<std::string> arguments = {},
+ std::unordered_map<std::string, std::string> environments = {});
public:
SubProcess(SubProcessStartInfo start_info);
diff --git a/include/cru/base/io/Stream.h b/include/cru/base/io/Stream.h
index 2f02a8c2..f082b490 100644
--- a/include/cru/base/io/Stream.h
+++ b/include/cru/base/io/Stream.h
@@ -1,24 +1,17 @@
#pragma once
#include "../Base.h"
-
+#include "../Buffer.h"
#include "../Exception.h"
-#include "../String.h"
#include <cstddef>
namespace cru::io {
class CRU_BASE_API StreamOperationNotSupportedException : public Exception {
public:
- explicit StreamOperationNotSupportedException(StringView operation);
explicit StreamOperationNotSupportedException(std::string operation);
public:
- [[deprecated("Use GetOperationUtf8 instead.")]]
- String GetOperation() const {
- return String::FromUtf8(operation_);
- }
-
std::string GetOperationUtf8() const { return operation_; }
public:
@@ -101,7 +94,7 @@ class CRU_BASE_API Stream : public Object {
virtual Buffer ReadToEnd(Index grow_size = 256);
// Utf8 encoding.
- String ReadToEndAsUtf8String();
+ std::string ReadToEndAsUtf8String();
protected:
virtual bool DoCanSeek();