Symbol: clean-up of some occasional usages

hereby overlooking the elephant in the room: EntryID could switch to Symbol now
This commit is contained in:
Fischlurch 2017-04-08 00:35:39 +02:00
parent baa4111358
commit 3f17e6558e
7 changed files with 23 additions and 12 deletions

View file

@ -107,7 +107,7 @@
namespace lumiera{
namespace advice {
using lib::Symbol;
using lib::Literal;
using util::isSameObject;
@ -358,7 +358,7 @@ namespace advice {
}
catch(...)
{
Symbol errID = lumiera_error();
Literal errID = lumiera_error();
releaseBuffer (storage, sizeof(Holder));
throw lumiera::error::Fatal ("Failure to store advice data", errID);
}

View file

@ -101,7 +101,7 @@
#include <boost/noncopyable.hpp>
using lib::Symbol;
using lib::Literal;
using lib::DelStash;
using util::unConst;
@ -216,7 +216,7 @@ namespace advice {
catch(...)
{
Symbol errID = lumiera_error();
Literal errID = lumiera_error();
WARN (library, "Problems on deregistration of advice request: %s", errID.c());
}
}

View file

@ -409,8 +409,13 @@ namespace util {
template<>
struct _Fmt::Converter<lib::Symbol>
: _Fmt::Converter<lib::Literal>
{ };
{
static void
dump (lib::Symbol const& symbol, Implementation& impl)
{
format (symbol.c(), impl);
}
};
/** some custom types explicitly provide a string representation */
template<typename VAL>

View file

@ -53,7 +53,7 @@ namespace lumiera {
{
bool isNew = LifecycleRegistry::instance().enrol (eventLabel,callbackFun);
if (isNew && !strcmp(ON_BASIC_INIT, eventLabel))
if (isNew and eventLabel == ON_BASIC_INIT)
callbackFun(); // when this code executes,
// then per definition we are already post "basic init"
// (which happens in the AppState ctor); thus fire it immediately

View file

@ -42,7 +42,6 @@
#define LIB_SYMBOL_H
#include "lib/hash-standard.hpp"
#include "include/logging.h" /////////////TODO only temporarily
#include <string>
#include <cstring>
@ -51,9 +50,7 @@
namespace lib {
/** inline string literal
* @todo improve interaction with Symbol
* @todo make it non-nullable
* @todo maybe use boost/operators Ticket #417
* This is a marker type to handle literally given C-Strings.
*/
class Literal
{
@ -126,6 +123,12 @@ namespace lib {
explicit operator bool() const { return not empty(); }
bool empty() const { return *this == BOTTOM; }
size_t
length() const
{
return std::strlen(c());
}
};

View file

@ -205,7 +205,7 @@ namespace control {
findDefinition (Command const& cmdInstance) const
{
Lock sync(this);
return getValue_or_default (ridx_, &cmdInstance, 0 );
return getValue_or_default (ridx_, &cmdInstance, Symbol::BOTTOM );
} //used as Key

View file

@ -221,6 +221,7 @@ namespace test {
CHECK (c2);
CHECK (c2.canExec());
CHECK (!c2.canUndo());
CHECK (c2.isAnonymous());
CHECK (c1 == c2);
CHECK (!isSameObject(c1, c2));
@ -267,6 +268,8 @@ namespace test {
CHECK (c4);
CHECK (c4.canExec());
CHECK (c4.canUndo());
CHECK (not c4.isAnonymous());
CHECK ( c2.isAnonymous());
CHECK (c4 == c2);
CHECK (c4 != c1);
c4();