format to 80 columns for terminal display
This commit is contained in:
@@ -44,7 +44,11 @@ obelisk::KnowledgeBase::~KnowledgeBase()
|
||||
void obelisk::KnowledgeBase::enableForeignKeys()
|
||||
{
|
||||
char* errmsg;
|
||||
int result = sqlite3_exec(dbConnection_, "PRAGMA foreign_keys = ON;", NULL, NULL, &errmsg);
|
||||
int result = sqlite3_exec(dbConnection_,
|
||||
"PRAGMA foreign_keys = ON;",
|
||||
NULL,
|
||||
NULL,
|
||||
&errmsg);
|
||||
if (result != SQLITE_OK)
|
||||
{
|
||||
if (errmsg)
|
||||
@@ -86,7 +90,9 @@ void obelisk::KnowledgeBase::addEntities(std::vector<obelisk::Entity>& entities)
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
// ignore unique constraint error
|
||||
if (std::strcmp(exception.what(), "UNIQUE constraint failed: entity.name") != 0)
|
||||
if (std::strcmp(exception.what(),
|
||||
"UNIQUE constraint failed: entity.name")
|
||||
!= 0)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@@ -105,7 +111,9 @@ void obelisk::KnowledgeBase::addVerbs(std::vector<obelisk::Verb>& verbs)
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
// ignore unique constraint error
|
||||
if (std::strcmp(exception.what(), "UNIQUE constraint failed: verb.name") != 0)
|
||||
if (std::strcmp(exception.what(),
|
||||
"UNIQUE constraint failed: verb.name")
|
||||
!= 0)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@@ -124,7 +132,9 @@ void obelisk::KnowledgeBase::addActions(std::vector<obelisk::Action>& actions)
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
// ignore unique constraint error
|
||||
if (std::strcmp(exception.what(), "UNIQUE constraint failed: action.name") != 0)
|
||||
if (std::strcmp(exception.what(),
|
||||
"UNIQUE constraint failed: action.name")
|
||||
!= 0)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@@ -153,7 +163,8 @@ void obelisk::KnowledgeBase::addFacts(std::vector<obelisk::Fact>& facts)
|
||||
}
|
||||
}
|
||||
|
||||
void obelisk::KnowledgeBase::addSuggestActions(std::vector<obelisk::SuggestAction>& suggestActions)
|
||||
void obelisk::KnowledgeBase::addSuggestActions(
|
||||
std::vector<obelisk::SuggestAction>& suggestActions)
|
||||
{
|
||||
for (auto& suggestAction : suggestActions)
|
||||
{
|
||||
@@ -185,7 +196,9 @@ void obelisk::KnowledgeBase::addRules(std::vector<obelisk::Rule>& rules)
|
||||
catch (obelisk::DatabaseConstraintException& exception)
|
||||
{
|
||||
// ignore unique constraint error
|
||||
if (std::strcmp(exception.what(), "UNIQUE constraint failed: rule.fact, rule.reason") != 0)
|
||||
if (std::strcmp(exception.what(),
|
||||
"UNIQUE constraint failed: rule.fact, rule.reason")
|
||||
!= 0)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
@@ -213,7 +226,8 @@ void obelisk::KnowledgeBase::getFact(obelisk::Fact& fact)
|
||||
fact.selectById(dbConnection_);
|
||||
}
|
||||
|
||||
void obelisk::KnowledgeBase::getSuggestAction(obelisk::SuggestAction& suggestAction)
|
||||
void obelisk::KnowledgeBase::getSuggestAction(
|
||||
obelisk::SuggestAction& suggestAction)
|
||||
{
|
||||
suggestAction.selectById(dbConnection_);
|
||||
}
|
||||
@@ -245,7 +259,9 @@ void obelisk::KnowledgeBase::updateIsTrue(obelisk::Fact& fact)
|
||||
fact.updateIsTrue(dbConnection_);
|
||||
}
|
||||
|
||||
void obelisk::KnowledgeBase::getFloat(float& result1, float& result2, double var)
|
||||
void obelisk::KnowledgeBase::getFloat(float& result1,
|
||||
float& result2,
|
||||
double var)
|
||||
{
|
||||
result1 = (float) var;
|
||||
result2 = (float) (var - (double) result1);
|
||||
|
Reference in New Issue
Block a user