aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-03 14:21:51 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-04 16:44:41 -0700
commit604d0e58dab76f8ab31eb4f7807f7b561c4d571d (patch)
tree56c5f18eaa5cc9e3fa7129a7479e243c4db44988 /toolsrc/include
parent80e48c2756cc2c453ba221fe38c32f969d5139ea (diff)
downloadvcpkg-604d0e58dab76f8ab31eb4f7807f7b561c4d571d.tar.gz
vcpkg-604d0e58dab76f8ab31eb4f7807f7b561c4d571d.zip
cstring_view -> CStringView
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/CStringView.h30
-rw-r--r--toolsrc/include/cstring_view.h30
-rw-r--r--toolsrc/include/vcpkg_Checks.h4
-rw-r--r--toolsrc/include/vcpkg_Input.h2
-rw-r--r--toolsrc/include/vcpkg_Strings.h6
-rw-r--r--toolsrc/include/vcpkg_System.h20
-rw-r--r--toolsrc/include/vcpkg_paths.h2
-rw-r--r--toolsrc/include/vcpkglib.h8
8 files changed, 51 insertions, 51 deletions
diff --git a/toolsrc/include/CStringView.h b/toolsrc/include/CStringView.h
new file mode 100644
index 000000000..3da76e63f
--- /dev/null
+++ b/toolsrc/include/CStringView.h
@@ -0,0 +1,30 @@
+#pragma once
+#include <string>
+
+namespace vcpkg
+{
+ template<class CharType>
+ struct BasicCStringView
+ {
+ constexpr BasicCStringView() : cstr(nullptr) {}
+ constexpr BasicCStringView(const CharType* cstr) : cstr(cstr) {}
+ BasicCStringView(const std::basic_string<CharType>& str) : cstr(str.c_str()) {}
+
+ constexpr operator const CharType*() const { return cstr; }
+
+ constexpr const CharType* c_str() const { return cstr; }
+
+ private:
+ const CharType* cstr;
+ };
+
+ using CStringView = BasicCStringView<char>;
+ using CWStringView = BasicCStringView<wchar_t>;
+
+ inline const char* to_printf_arg(const CStringView spec) { return spec.c_str(); }
+
+ inline const wchar_t* to_wprintf_arg(const CWStringView spec) { return spec.c_str(); }
+
+ static_assert(sizeof(CStringView) == sizeof(void*), "CStringView must be a simple wrapper around char*");
+ static_assert(sizeof(CWStringView) == sizeof(void*), "CWStringView must be a simple wrapper around wchar_t*");
+}
diff --git a/toolsrc/include/cstring_view.h b/toolsrc/include/cstring_view.h
deleted file mode 100644
index 92f1a6fa5..000000000
--- a/toolsrc/include/cstring_view.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#pragma once
-#include <string>
-
-namespace vcpkg
-{
- template<class CharType>
- struct basic_cstring_view
- {
- constexpr basic_cstring_view() : cstr(nullptr) {}
- constexpr basic_cstring_view(const CharType* cstr) : cstr(cstr) {}
- basic_cstring_view(const std::basic_string<CharType>& str) : cstr(str.c_str()) {}
-
- constexpr operator const CharType*() const { return cstr; }
-
- constexpr const CharType* c_str() const { return cstr; }
-
- private:
- const CharType* cstr;
- };
-
- using cstring_view = basic_cstring_view<char>;
- using cwstring_view = basic_cstring_view<wchar_t>;
-
- inline const char* to_printf_arg(const cstring_view spec) { return spec.c_str(); }
-
- inline const wchar_t* to_wprintf_arg(const cwstring_view spec) { return spec.c_str(); }
-
- static_assert(sizeof(cstring_view) == sizeof(void*), "cstring_view must be a simple wrapper around char*");
- static_assert(sizeof(cwstring_view) == sizeof(void*), "cwstring_view must be a simple wrapper around wchar_t*");
-}
diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h
index 5bcc59fee..8e7a35f4d 100644
--- a/toolsrc/include/vcpkg_Checks.h
+++ b/toolsrc/include/vcpkg_Checks.h
@@ -25,7 +25,7 @@ namespace vcpkg::Checks
// Part of the reason these exist is to not include extra headers in this one to avoid circular #includes.
[[noreturn]]
- void exit_with_message(const LineInfo& line_info, const cstring_view errorMessage);
+ void exit_with_message(const LineInfo& line_info, const CStringView errorMessage);
template <class Arg1, class...Args>
[[noreturn]]
@@ -36,7 +36,7 @@ namespace vcpkg::Checks
void check_exit(const LineInfo& line_info, bool expression);
- void check_exit(const LineInfo& line_info, bool expression, const cstring_view errorMessage);
+ void check_exit(const LineInfo& line_info, bool expression, const CStringView errorMessage);
template <class Arg1, class...Args>
void check_exit(const LineInfo& line_info, bool expression, const char* errorMessageTemplate, const Arg1 errorMessageArg1, const Args&... errorMessageArgs)
diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h
index 4f102d029..868b77a44 100644
--- a/toolsrc/include/vcpkg_Input.h
+++ b/toolsrc/include/vcpkg_Input.h
@@ -8,7 +8,7 @@ namespace vcpkg::Input
package_spec check_and_get_package_spec(
const std::string& package_spec_as_string,
const triplet& default_target_triplet,
- cstring_view example_text);
+ CStringView example_text);
void check_triplet(const triplet& t, const vcpkg_paths& paths);
}
diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h
index e0ad51a8e..03b16975e 100644
--- a/toolsrc/include/vcpkg_Strings.h
+++ b/toolsrc/include/vcpkg_Strings.h
@@ -1,7 +1,7 @@
#pragma once
#include <vector>
-#include "cstring_view.h"
+#include "CStringView.h"
namespace vcpkg::Strings::details
{
@@ -66,9 +66,9 @@ namespace vcpkg::Strings
return details::wformat_internal(fmtstr, to_wprintf_arg(to_wprintf_arg(args))...);
}
- std::wstring utf8_to_utf16(const cstring_view s);
+ std::wstring utf8_to_utf16(const CStringView s);
- std::string utf16_to_utf8(const cwstring_view w);
+ std::string utf16_to_utf8(const CWStringView w);
std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern);
diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h
index 33aad646c..2c2b945f4 100644
--- a/toolsrc/include/vcpkg_System.h
+++ b/toolsrc/include/vcpkg_System.h
@@ -15,13 +15,13 @@ namespace vcpkg::System
std::string output;
};
- int cmd_execute_clean(const cwstring_view cmd_line);
+ int cmd_execute_clean(const CWStringView cmd_line);
- int cmd_execute(const cwstring_view cmd_line);
+ int cmd_execute(const CWStringView cmd_line);
- exit_code_and_output cmd_execute_and_capture_output(const cwstring_view cmd_line);
+ exit_code_and_output cmd_execute_and_capture_output(const CWStringView cmd_line);
- std::wstring create_powershell_script_cmd(const fs::path& script_path, const cwstring_view args = L"");
+ std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = L"");
enum class color
{
@@ -30,10 +30,10 @@ namespace vcpkg::System
warning = 14,
};
- void print(const cstring_view message);
- void println(const cstring_view message);
- void print(const color c, const cstring_view message);
- void println(const color c, const cstring_view message);
+ void print(const CStringView message);
+ void println(const CStringView message);
+ void print(const color c, const CStringView message);
+ void println(const color c, const CStringView message);
template <class Arg1, class...Args>
void print(const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
@@ -59,9 +59,9 @@ namespace vcpkg::System
return println(c, Strings::format(messageTemplate, messageArg1, messageArgs...));
}
- optional<std::wstring> get_environmental_variable(const cwstring_view varname) noexcept;
+ optional<std::wstring> get_environmental_variable(const CWStringView varname) noexcept;
- optional<std::wstring> get_registry_string(HKEY base, const cwstring_view subkey, const cwstring_view valuename);
+ optional<std::wstring> get_registry_string(HKEY base, const CWStringView subkey, const CWStringView valuename);
const fs::path& get_ProgramFiles_32_bit();
diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h
index 474f47255..5bfc91967 100644
--- a/toolsrc/include/vcpkg_paths.h
+++ b/toolsrc/include/vcpkg_paths.h
@@ -11,7 +11,7 @@ namespace vcpkg
{
fs::path dumpbin;
fs::path vcvarsall;
- cwstring_view version;
+ CWStringView version;
};
struct vcpkg_paths
diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h
index bab1c28a1..6acfb6227 100644
--- a/toolsrc/include/vcpkglib.h
+++ b/toolsrc/include/vcpkglib.h
@@ -24,10 +24,10 @@ namespace vcpkg
struct CMakeVariable
{
- CMakeVariable(const cwstring_view varname, const wchar_t* varvalue);
- CMakeVariable(const cwstring_view varname, const std::string& varvalue);
- CMakeVariable(const cwstring_view varname, const std::wstring& varvalue);
- CMakeVariable(const cwstring_view varname, const fs::path& path);
+ CMakeVariable(const CWStringView varname, const wchar_t* varvalue);
+ CMakeVariable(const CWStringView varname, const std::string& varvalue);
+ CMakeVariable(const CWStringView varname, const std::wstring& varvalue);
+ CMakeVariable(const CWStringView varname, const fs::path& path);
std::wstring s;
};