Skip to content

Commit

Permalink
added forgotten facilities from LBase for LConnectionPool
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Berbizier (dbdl) committed Feb 1, 2016
1 parent 7bb9423 commit a37ebbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Source/LBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,28 @@ void LBase::set( const String& r, int lua_type, int pos ) {
if ( LUA::set(this, r.toRawUTF8(), pos) )
this->registered.set(r, true);
}
void LBase::put( const String& r ) {
if ( LUA::put(this, r.toRawUTF8()) )
this->registered.set(r, true);
}

void LBase::unset( const String& r ) {
LUA::unset(this, r.toRawUTF8());
this->registered.set(r, false);
}

bool LBase::get( const String& r ) {
return LUA::get(this, r.toRawUTF8());
}

int LBase::callback( const String& k, int nb_ret, const std::list<var>& args ) const {
return LUA::call_cb(this, k.toRawUTF8(), nb_ret, args);
}

bool LBase::push_callback( const String& k ) const {
return LUA::getCallback(this, k.toRawUTF8());
}

bool LBase::hasCallback( const String& k ) const {
return this->registered[k];
}
Expand Down
3 changes: 3 additions & 0 deletions Source/LBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ class LBase : public LSelfKill
HashMap<String, bool> registered;
void set( const String& r, int lua_type = LUA_TFUNCTION, int pos = -1);
void unset( const String& r );
void put( const String& r );
bool get( const String& r );

// avoid this constructor, it's causing issues with some compilers
//int callback(const String& k, int nb_ret = 0, const std::list<var>& args = {}) const;
int callback(const String& k, int nb_ret = 0, const std::list<var>& args = std::list<var>()) const;
bool push_callback(const String& k) const;
bool hasCallback(const String&) const;

private:
Expand Down

0 comments on commit a37ebbb

Please sign in to comment.