Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
e6ce4ddd
Commit
e6ce4ddd
authored
Nov 14, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
40deb7ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
154 deletions
+0
-154
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+0
-39
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+0
-115
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
e6ce4ddd
...
...
@@ -34,19 +34,6 @@ using namespace golang;
#include <memory>
#if 0
// error
error error::New(const string &text) {
error err;
err._err = text;
return err;
}
string error::Error() const {
return _err;
}
#endif
// io::
namespace
io
{
...
...
@@ -250,32 +237,6 @@ vector<string> split(const string &s, char sep) {
}
// strings::
#if 0
// context::
namespace context {
const error canceled = error::New("context canceled");
const error deadlineExceeded = error::New("deadline exceeded");
struct _Background : Context {
chan<structZ> done() {
return nil;
}
error err() {
return nil;
}
};
static _Background _bg;
Context* background() {
return &_bg; // NOTE nil is not valid in C++ (IContext* also carries vtab ptr)
}
} // context::
#endif
// xstrconv:: (strconv-like)
namespace
xstrconv
{
...
...
wcfs/internal/wcfs_misc.h
View file @
e6ce4ddd
...
...
@@ -53,37 +53,6 @@ using std::vector;
// nil is synonym for nullptr and NULL.
const
nullptr_t
nil
=
nullptr
;
#if 0
// error mimics error from Go.
class error {
string _err;
public:
string Error() const;
error() {}
error(nullptr_t) {} // = nil
// == nil
bool operator==(nullptr_t) const {
return _err.empty();
}
bool operator!=(nullptr_t) const {
return !(*this==NULL);
}
// == error
bool operator==(const error &rhs) const {
return (_err == rhs._err);
}
bool operator!=(const error &rhs) const {
return !(*this==rhs);
}
// New creats error with text
static error New(const string &text);
};
#endif
// io::
namespace
io
{
...
...
@@ -183,93 +152,9 @@ vector<string> split(const string &s, char sep);
}
// strings::
#if 0
// context::
namespace context {
struct Context {
virtual chan<structZ> done() = 0;
virtual error err() = 0;
};
// XXX doc
Context* background();
// XXX doc
extern const error canceled;
extern const error deadlineExceeded;
} // context::
#endif
#if 0
interface(Context) {
ifunc(chan<structZ> done());
ifunc(error err());
};
I<io::Reader>(f)
// XXX wrap T* as IContext
template<typename T>
class Context : public IContext {
T *obj;
public:
Context(T *obj) : obj(obj) {}
chan<structZ> done() { return obj->done(); }
error err() { return obj->err(); }
};
#endif
// ---- misc ----
#if 0
#include <unordered_map>
#include <unordered_set>
// dict wraps unordered_map into ergonomic interface.
template<typename Key, typename Value>
struct dict : std::unordered_map<Key, Value> {
// has returns whether dict has element k.
bool has(const Key &k) const {
const dict &d = *this;
return d.find(k) != d.end();
}
// get implements `d[k] -> (v, ok)`.
tuple<Value, bool> get(const Key &k) const {
const dict &d = *this;
auto _ = d.find(k);
if (_ == d.end())
return make_tuple(Value(), false);
return make_tuple(_->second, true);
}
// pop implements `d[k] -> (v, ok); del d[k]`.
tuple<Value, bool> pop(const Key &k) {
dict &d = *this;
auto _ = d.find(k);
if (_ == d.end())
return make_tuple(Value(), false);
Value v = _->second;
d.erase(_);
return make_tuple(v, true);
}
};
// set wraps unordered_set into ergonomic interface.
template<typename Key>
struct set : std::unordered_set<Key> {
// has returns whether set has element k.
bool has(const Key &k) const {
const set &s = *this;
return s.find(k) != s.end();
}
};
#endif
// xstrconv::
namespace
xstrconv
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment