Add dstream

This commit is contained in:
Vinnie Falco
2016-05-09 20:13:20 -04:00
parent c0952e54db
commit b5dc8eb9ce
3 changed files with 144 additions and 96 deletions

View File

@@ -1,73 +0,0 @@
//
// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_DETAIL_TEMP_DIR_H_INCLUDED
#define BEAST_DETAIL_TEMP_DIR_H_INCLUDED
#include <boost/filesystem.hpp>
#include <string>
namespace beast {
namespace detail {
/** RAII temporary directory.
The directory and all its contents are deleted when
the instance of `temp_dir` is destroyed.
*/
class temp_dir
{
boost::filesystem::path path_;
public:
#if ! GENERATING_DOCS
temp_dir(const temp_dir&) = delete;
temp_dir& operator=(const temp_dir&) = delete;
#endif
/// Construct a temporary directory.
temp_dir()
{
auto const dir =
boost::filesystem::temp_directory_path();
do
{
path_ =
dir / boost::filesystem::unique_path();
}
while(boost::filesystem::exists(path_));
boost::filesystem::create_directory (path_);
}
/// Destroy a temporary directory.
~temp_dir()
{
boost::filesystem::remove_all (path_);
}
/// Get the native path for the temporary directory
std::string
path() const
{
return path_.string();
}
/** Get the native path for the a file.
The file does not need to exist.
*/
std::string
file(std::string const& name) const
{
return (path_ / name).string();
}
};
} // detail
} // beast
#endif

View File

@@ -1,23 +0,0 @@
//
// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BEAST_DETAIL_UNIT_TEST_H_INCLUDED
#define BEAST_DETAIL_UNIT_TEST_H_INCLUDED
#include <beast/detail/unit_test/amount.h>
#include <beast/detail/unit_test/print.h>
#include <beast/detail/unit_test/global_suites.h>
#include <beast/detail/unit_test/match.h>
#include <beast/detail/unit_test/recorder.h>
#include <beast/detail/unit_test/reporter.h>
#include <beast/detail/unit_test/results.h>
#include <beast/detail/unit_test/runner.h>
#include <beast/detail/unit_test/suite.h>
#include <beast/detail/unit_test/suite_info.h>
#include <beast/detail/unit_test/suite_list.h>
#endif