Skip to content

Instantly share code, notes, and snippets.

View argv0's full-sized avatar

Andy Gross argv0

View GitHub Profile
%% @author David Reid <dreid@mochimedia.com>
%% @copyright 2011 Mochi Media, Inc.
%% @doc Stub MochiWeb HTTP Request module implementation for testing.
-module(stub_mochiweb_request).
-record(stub_mochiweb_request, {options, headers, response_pid}).
%% Constructors and static method exports
#include <cstdio>
#include <stdexcept>
template <class T>
struct Maybe {
Maybe( const T& val ) : val_(val), valid_(true) { }
Maybe() : valid_(false) { }
const T& get() const {
if (valid_) return val_;
throw std::logic_error("lol type systems");