Preparing for XCode project. Removing now obsolete files.

This commit is contained in:
meeh
2018-09-18 15:19:23 +00:00
parent b74abbe4de
commit beede9505e
36 changed files with 0 additions and 605 deletions

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

View File

@@ -1,12 +0,0 @@
CXX=clang++
CXXFLAGS= -std=c++14 -g -Wall -mmacosx-version-min=10.10
INCLUDEDIRS=-I./include -I/usr/local/include -I/usr/include
SOURCES=main.mm StatusItemButton.mm CRunner.cpp
LDFLAGS=-framework CoreFoundation -framework Foundation -framework Cocoa
i2plauncher:
$(CXX) $(CXXFLAGS) $(INCLUDEDIRS) $(LDFLAGS) -o i2plauncher $(SOURCES)
clean:
rm -f i2plauncher

View File

@@ -1,27 +0,0 @@
#pragma once
#import <Cocoa/Cocoa.h>
/**
*
* This is a class representing the "image" in the systray.
*
*
* **/
@class StatusItemButton;
@protocol StatusItemButtonDelegate <NSObject>
- (void) statusItemButtonLeftClick: (StatusItemButton *) button;
- (void) statusItemButtonRightClick: (StatusItemButton *) button;
@end
@interface StatusItemButton : NSView
@property (strong, nonatomic) NSImage *image;
@property (unsafe_unretained) id<StatusItemButtonDelegate> delegate;
- (instancetype) initWithImage: (NSImage *) image;
@end

View File

@@ -1,39 +0,0 @@
#import <AppKit/AppKit.h>
#import "StatusItemButton.h"
@implementation StatusItemButton
- (instancetype) initWithImage: (NSImage *) image {
self = [super initWithFrame:NSMakeRect(0, 0, image.size.width, image.size.height)];
if (self) {
self.image = image;
}
return self;
}
- (void) setImage:(NSImage *)image {
_image = image;
[self setNeedsDisplay:YES];
}
- (void) drawRect: (NSRect) dirtyRect {
NSSize imageSize = self.image.size;
CGFloat x = (self.bounds.size.width - imageSize.width)/2;
CGFloat y = (self.bounds.size.height - imageSize.height) /2;
NSRect drawnRect = NSMakeRect(x, y, imageSize.width, imageSize.height);
[self.image drawInRect:drawnRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
}
- (void) mouseDown:(NSEvent *)theEvent {
[self.delegate statusItemButtonLeftClick:self];
}
- (void) rightMouseDown:(NSEvent *)theEvent {
[self.delegate statusItemButtonRightClick:self];
}
@end

View File

@@ -1,56 +0,0 @@
cxx = clang++
cflags = -std=c++14 -g -Wall -I./include -I./include/neither -I/usr/local/include -I/usr/include $
-Wno-unused-function -Wno-incomplete-implementation -Wno-unused-variable -mmacosx-version-min=10.10
ldflags = -framework CoreFoundation -framework Foundation -framework Cocoa -g -rdynamic
pool link_pool
depth = 4
rule cxx
command = $cxx $cflags -c $in -o $out
description = CC $out
rule link
command = $cxx $ldflags -o $out $in
description = LINK $out
pool = link_pool
rule ar
command = ar crsT $out $in
description = AR $out
rule cleanup
command = rm -fr *.o clauncher I2PLauncher.app base.zip
# TODO: There must exists a cleaner way to solve this.
rule bundledir
command = mkdir -p I2PLauncher.app/Contents/{MacOS,Resources,Frameworks} $
&& cp Info.plist I2PLauncher.app/Contents/Info.plist $
&& cd ../../../pkg-temp && zip -r7 ../base.zip * && cd - && mv ../../../base.zip base.zip $
&& cp base.zip I2PLauncher.app/Contents/Resources/base.zip $
&& cp ../target/scala-2.11/routerLauncher-assembly-0.1.0-SNAPSHOT.jar I2PLauncher.app/Contents/Resources/launcher.jar
rule copytobundledir
command = cp clauncher I2PLauncher.app/Contents/MacOS/I2PLauncher
rule copyimgtobundle
command = cp ItoopieTransparent.png I2PLauncher.app/Contents/Resources/ItoopieTransparent.png
rule builddir
command = mkdir -p build
build main.o: cxx main.mm
build StatusItemButton.o: cxx StatusItemButton.mm
build RouterTask.o: cxx RouterTask.mm
build clean: cleanup
build bundle: bundledir
build copytobundle: copytobundledir | bundle clauncher
build clauncher: link main.o StatusItemButton.o RouterTask.o
build appbundle: copyimgtobundle | clauncher bundle copytobundle
default appbundle

View File

@@ -1,264 +0,0 @@
#ifndef NEITHER_EITHER_HPP
#define NEITHER_EITHER_HPP
#include <memory>
#include <type_traits>
#include "traits.hpp"
#include "maybe.hpp"
#include "traits.hpp"
#include "maybe.hpp"
namespace neither {
template<class T>
constexpr T max(T x, T y) {
return x>y ? x : y;
}
template<class T>
struct Left {
T value;
};
template<class T>
constexpr Left<T> left(T const& x) {
return {x};
}
template<class T>
Left<T> left(T&& x) {
return { std::move(x) };
}
template<class T>
struct Right {
T value;
};
template<class T>
constexpr Right<T> right(T const& x) {
return {x};
}
template<class T>
Right<T> right(T&& x) {
return { std::move(x) };
}
template<class L, class R>
struct Either {
union {
L leftValue;
R rightValue;
};
bool const isLeft = 0;
constexpr Either( Left<L> const& l )
: leftValue{l.value}
, isLeft(1)
{}
constexpr Either( Right<R> const& r )
: rightValue{r.value}
, isLeft(0)
{}
Either(Left<L> && l )
: leftValue{std::move(l.value)}
, isLeft(1)
{}
Either( Right<R> && r )
: rightValue{std::move(r.value)}
, isLeft(0)
{}
constexpr Either( Either<L, R> const& e )
: isLeft(e.isLeft) {
if (isLeft) {
new (&leftValue)L(e.leftValue);
} else {
new (&rightValue)R(e.rightValue);
}
}
Either( Either<L, R>&& e )
: isLeft(e.isLeft) {
if (isLeft) {
new (&leftValue)L(std::move(e.leftValue));
} else {
new (&rightValue)R(std::move(e.rightValue));
}
}
~Either() {
if (isLeft) {
leftValue.~L();
} else {
rightValue.~R();
}
}
constexpr auto left() const -> Maybe<L> {
return isLeft ?
maybe(leftValue) :
maybe();
}
constexpr auto right() const -> Maybe<R> {
return isLeft ?
maybe() :
maybe(rightValue);
}
static constexpr auto leftOf( L const& l ) {
return Either<L, R>{ neither::left(l) };
}
static constexpr auto rightOf( R const& r ) {
return Either<L, R>{ neither::right(r) };
}
static constexpr auto leftOf( L && l ) {
return Either<L, R>{ neither::left(std::move(l)) };
}
static constexpr auto rightOf( R && r ) {
return Either<L, R>{ neither::right(std::move(r)) };
}
template<
class L2 = L,
class R2 = R>
constexpr auto join() const
-> decltype(
isCopyable((L2)leftValue, (R2)rightValue),
std::declval<std::common_type_t<L2, R2>>()
) {
return isLeft ? leftValue : rightValue;
}
template<
class L2 = L,
class R2 = R>
auto join()&&
-> std::common_type_t<L2, R2> {
return isLeft ? std::move(leftValue) : std::move(rightValue);
}
template<class LeftF, class RightF>
constexpr auto join(LeftF const& leftCase, RightF const& rightCase) const
-> decltype( isLeft? leftCase( leftValue ) : rightCase( rightValue ) ) {
return isLeft ? leftCase( leftValue ) : rightCase( rightValue );
}
template<class F, class L2=L, class R2=R>
constexpr auto leftMap(F const& leftCase) const&
-> Either<decltype(leftCase( isCopyable((L2)leftValue, (R2)rightValue) )), R2> {
using NextEither = Either<decltype(leftCase(leftValue)), R2>;
return isLeft ?
NextEither::leftOf( leftCase( leftValue ) ) :
NextEither::rightOf( rightValue );
}
template<class F, class L2=L, class R2=R>
auto leftMap(F const& leftCase)&& -> Either<decltype(leftCase(std::move(leftValue))), R2> {
using NextEither = Either<decltype(leftCase(std::move(leftValue))), R2>;
return isLeft ?
NextEither::leftOf(leftCase(std::move(leftValue))) :
NextEither::rightOf( std::move(rightValue) );
}
template<class F, class L2=L, class R2=R>
constexpr auto rightMap(F const& rightCase) const& -> Either<L, decltype(rightCase(isCopyable((R2)rightValue, (L2)leftValue)))> {
using NextEither = Either<L, decltype(rightCase(rightValue))>;
return isLeft ?
NextEither::leftOf( leftValue ) :
NextEither::rightOf( rightCase( rightValue ) );
}
template<class F, class L2=L, class R2=R>
auto rightMap(F const& rightCase)&& -> Either<L2, decltype(rightCase(std::move((R2)rightValue)))> {
using NextEither = Either<L, decltype(rightCase(std::move(rightValue)))>;
return isLeft ?
NextEither::leftOf( std::move(leftValue) ) :
NextEither::rightOf( rightCase( std::move(rightValue) ) );
}
template<class LeftCase, class L2=L, class R2=R>
constexpr auto leftFlatMap(LeftCase const& leftCase) const&
-> decltype( ensureEitherRight(leftCase(isCopyable((L2)leftValue)), isCopyable((R2)rightValue))) {
using NextEither = decltype(leftCase(leftValue));
if (!*this) {
return leftCase( leftValue );
}
return NextEither::rightOf(rightValue);
}
template<class RightCase, class L2 = L, class R2 = R>
constexpr auto rightFlatMap(RightCase const& rightCase) const&
-> decltype( ensureEitherLeft(rightCase(isCopyable((R2)rightValue)), isCopyable((L2)leftValue))) {
using NextEither = decltype(rightCase(rightValue));
if (*this) {
return rightCase( rightValue );
}
return NextEither::leftOf(leftValue);
}
template<class LeftCase, class L2 = L, class R2 = R>
auto leftFlatMap(LeftCase const& leftCase)&&
-> decltype( ensureEitherRight(leftCase(std::move(leftValue)), std::move(rightValue))) {
using NextEither = decltype(leftCase(std::move(leftValue)));
if (!*this) {
return leftCase( std::move(leftValue) );
}
return NextEither::rightOf(std::move(rightValue));
}
template<class RightCase, class L2=L, class R2=R>
auto rightFlatMap(RightCase const& rightCase)&&
-> decltype( ensureEitherLeft(rightCase(std::move(rightValue)), std::move(leftValue))) {
using NextEither = decltype(rightCase(std::move(rightValue)));
if (*this) {
return rightCase(std::move(rightValue));
}
return NextEither::leftOf(std::move(leftValue));
}
constexpr operator bool()const { return !isLeft; }
};
template <typename L, typename R>
bool operator == (Either<L, R> const& a, Either<L, R> const& b) {
if (a.isLeft) {
if (b.isLeft) {
return a.left() == b.left();
}
} else {
if (!b.isLeft) {
return a.right() == b.right();
}
}
return false;
}
template <typename L, typename R>
bool operator != (Either<L, R> const& a, Either<L, R> const& b) {
return !(a == b);
}
}
#endif

View File

@@ -1,60 +0,0 @@
#include "either.hpp"
namespace neither {
template<class L, class R>
constexpr bool hasValue(Either<L,R> const& e) {
return e;
}
template<class T>
constexpr bool hasValue(Maybe<T> const& m) {
return m;
}
template<class T>
constexpr bool hasValue(T) {
return true;
}
template<class L, class R>
constexpr R unpack(Either<L, R> const& e) {
return e.rightValue;
}
template<class T>
constexpr T unpack(Maybe<T> const& m) {
return m.value;
}
template<class T>
constexpr T unpack(T const& x) {
return x;
}
constexpr auto allTrue(bool x=true, bool y=true) {
return x && y;
}
template<class X, class...Xs>
auto allTrue(X x, Xs...xs) {
return allTrue(x, allTrue(xs...));
}
template<class F>
auto lift(F const& f) {
return [f](auto...x) -> decltype(maybe(f(unpack(x)...))) {
if ( allTrue(hasValue(x)...) ) {
return f(unpack(x)...);
}
return maybe();
};
}
}

View File

@@ -1,117 +0,0 @@
#ifndef NEITHER_MAYBE_HPP
#define NEITHER_MAYBE_HPP
#include <memory>
#include <cassert>
#include "traits.hpp"
namespace neither {
template <class T> struct Maybe;
template <> struct Maybe<void> {};
template <class T> struct Maybe {
union {
T value;
};
bool const hasValue = 0;
constexpr Maybe() : hasValue{0} {}
constexpr Maybe(T const& value) : value{value}, hasValue{1} {}
constexpr Maybe(T&& value) : value{std::move(value)}, hasValue{1} {}
constexpr Maybe(Maybe<void>) : hasValue{0} {}
constexpr Maybe(Maybe<T> const &o) : hasValue{o.hasValue} {
if (o.hasValue) {
new (&value)T(o.value);
}
}
~Maybe() {
if (hasValue) {
value.~T();
}
}
constexpr T get(T defaultValue) {
return hasValue ? value : defaultValue;
}
constexpr T unsafeGet() {
assert(hasValue && "unsafeGet must not be called on an empty Maybe");
return value;
}
template<class F>
constexpr auto map(F const &f) const&
-> Maybe<decltype(f(isCopyable(value)))> {
using ReturnType = decltype(f(value));
if (!hasValue) {
return Maybe<ReturnType>();
}
return Maybe<ReturnType>(f(value));
}
template<class F>
auto map(F const& f)&&
-> Maybe<decltype(f(std::move(value)))> {
using ReturnType = decltype(f(std::move(value)));
if (!hasValue) {
return Maybe<ReturnType>();
}
return Maybe<ReturnType>(f(std::move(value)));
}
template <class F>
constexpr auto flatMap(F const& f) const&
-> decltype(ensureMaybe(f(value))) {
using ReturnType = decltype(f(value));
if (!hasValue) {
return ReturnType();
}
return f(value);
}
template <class F>
constexpr auto flatMap(F const& f)&&
-> decltype(ensureMaybe(f(std::move(value)))) {
using ReturnType = decltype(f(std::move(value)));
if (!hasValue) {
return ReturnType();
}
return f(std::move(value));
}
constexpr operator bool() const { return hasValue; }
};
template <typename T>
auto maybe(T value) -> Maybe<T> { return {value}; }
template <typename T = void>
auto maybe() -> Maybe<T> { return {}; }
template <typename T>
bool operator == (Maybe<T> const& a, Maybe<T> const& b) {
if (a.hasValue) {
return b.hasValue && a.value == b.value;
}
return !b.hasValue;
}
template <typename T>
bool operator != (Maybe<T> const& a, Maybe<T> const& b) {
return !(a == b);
}
}
#endif

View File

@@ -1,10 +0,0 @@
#ifndef NEITHER_NEITHER_HPP
#define NEITHER_NEITHER_HPP
#include "either.hpp"
#include "lift.hpp"
#include "maybe.hpp"
#include "traits.hpp"
#include "try.hpp"
#endif

View File

@@ -1,20 +0,0 @@
#ifndef NEITHER_TRY_HPP
#define NEITHER_TRY_HPP
#include <functional>
#include "either.hpp"
namespace neither {
template <class E, class F, class... X>
auto Try(F const &f, X &&... x)
-> Either<E, decltype(f(std::forward<X>(x)...))> {
try {
return right(f(std::forward<X>(x)...));
} catch (E const &e) {
return left(e);
}
}
}
#endif