aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-04-12 22:48:52 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-04-12 22:48:52 -0700
commit7069fbbebc750a7c8a64adc8c30269527cbec9bd (patch)
tree94d08f8fd3f04be1167f274c7aab37d0100a693b /toolsrc/include
parent7326b6c64dc6b04b6d8512f13dddf67bf7498bf1 (diff)
downloadvcpkg-7069fbbebc750a7c8a64adc8c30269527cbec9bd.tar.gz
vcpkg-7069fbbebc750a7c8a64adc8c30269527cbec9bd.zip
[vcpkg] Remove+indirect nearly all uses of iostreams
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/BinaryParagraph.h2
-rw-r--r--toolsrc/include/SourceParagraph.h2
-rw-r--r--toolsrc/include/StatusParagraph.h2
-rw-r--r--toolsrc/include/StatusParagraphs.h4
-rw-r--r--toolsrc/include/vcpkg_Files.h1
-rw-r--r--toolsrc/include/vcpkg_Strings.h8
6 files changed, 14 insertions, 5 deletions
diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h
index e29e0f51b..6cf740920 100644
--- a/toolsrc/include/BinaryParagraph.h
+++ b/toolsrc/include/BinaryParagraph.h
@@ -25,5 +25,5 @@ namespace vcpkg
std::vector<std::string> depends;
};
- std::ostream& operator<<(std::ostream& os, const BinaryParagraph& pgh);
+ void serialize(const BinaryParagraph& pgh, std::string& out_str);
}
diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h
index 65ba478ee..b66fa131b 100644
--- a/toolsrc/include/SourceParagraph.h
+++ b/toolsrc/include/SourceParagraph.h
@@ -13,7 +13,7 @@ namespace vcpkg
std::string qualifier;
};
- std::ostream& operator<<(std::ostream& os, const Dependency& p);
+ const std::string& to_string(const Dependency& dep);
struct SourceParagraph
{
diff --git a/toolsrc/include/StatusParagraph.h b/toolsrc/include/StatusParagraph.h
index bc2766aa2..a71fb7893 100644
--- a/toolsrc/include/StatusParagraph.h
+++ b/toolsrc/include/StatusParagraph.h
@@ -33,7 +33,7 @@ namespace vcpkg
InstallState state;
};
- std::ostream& operator<<(std::ostream& os, const StatusParagraph& pgh);
+ void serialize(const StatusParagraph& pgh, std::string& out_str);
std::string to_string(InstallState f);
diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h
index c5ece9616..fcfe99b5a 100644
--- a/toolsrc/include/StatusParagraphs.h
+++ b/toolsrc/include/StatusParagraphs.h
@@ -29,7 +29,7 @@ namespace vcpkg
iterator insert(std::unique_ptr<StatusParagraph>);
- friend std::ostream& operator<<(std::ostream&, const StatusParagraphs&);
+ friend void serialize(const StatusParagraphs& pgh, std::string& out_str);
iterator end()
{
@@ -55,5 +55,5 @@ namespace vcpkg
std::vector<std::unique_ptr<StatusParagraph>> paragraphs;
};
- std::ostream& operator<<(std::ostream&, const StatusParagraphs&);
+ void serialize(const StatusParagraphs& pgh, std::string& out_str);
}
diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h
index dde5cf5ee..7bf13e973 100644
--- a/toolsrc/include/vcpkg_Files.h
+++ b/toolsrc/include/vcpkg_Files.h
@@ -14,6 +14,7 @@ namespace vcpkg::Files
virtual std::vector<fs::path> non_recursive_find_all_files_in_dir(const fs::path& dir) const = 0;
virtual void write_all_lines(const fs::path& file_path, const std::vector<std::string>& lines) = 0;
+ virtual void write_contents(const fs::path& file_path, const std::string& data) = 0;
virtual void rename(const fs::path& oldpath, const fs::path& newpath) = 0;
virtual bool remove(const fs::path& path) = 0;
virtual bool remove(const fs::path& path, std::error_code& ec) = 0;
diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h
index 7b031608c..d152eccf5 100644
--- a/toolsrc/include/vcpkg_Strings.h
+++ b/toolsrc/include/vcpkg_Strings.h
@@ -119,4 +119,12 @@ namespace vcpkg::Strings
void trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings);
std::vector<std::string> split(const std::string& s, const std::string& delimiter);
+
+ template<class T>
+ std::string serialize(const T& t)
+ {
+ std::string ret;
+ serialize(t, ret);
+ return ret;
+ }
}