develop #15

Merged
cromer merged 64 commits from develop into master 2023-02-23 01:11:48 -03:00
3 changed files with 34 additions and 19 deletions
Showing only changes of commit 991fe84c01 - Show all commits

View File

@ -38,8 +38,8 @@ namespace obelisk
/** /**
* @brief Enable foreign key functionality in the open database. * @brief Enable foreign key functionality in the open database.
* *
* This must always be done when the connection is opened or it will not * This must always be done when the connection is opened or it will
* enforce the foreign key constraints. * not enforce the foreign key constraints.
*/ */
void enableForeignKeys(); void enableForeignKeys();
@ -54,7 +54,8 @@ namespace obelisk
/** /**
* @brief Construct a new Knowledge Base object. * @brief Construct a new Knowledge Base object.
* *
* @param[in] filename The name of the file to save the knowledge base as. * @param[in] filename The name of the file to save the knowledge
* base as.
* @param[in] flags The flags to open the knowledge base with. * @param[in] flags The flags to open the knowledge base with.
*/ */
KnowledgeBase(const char* filename, int flags); KnowledgeBase(const char* filename, int flags);
@ -62,7 +63,8 @@ namespace obelisk
/** /**
* @brief Construct a new Knowledge Base object. * @brief Construct a new Knowledge Base object.
* *
* @param[in] filename The name of the file to save the knowledge base as. * @param[in] filename The name of the file to save the knowledge
* base as.
*/ */
KnowledgeBase(const char* filename) : KnowledgeBase(const char* filename) :
KnowledgeBase(filename, KnowledgeBase(filename,
@ -80,7 +82,6 @@ namespace obelisk
/** /**
* @brief Add entities to the knowledge base. * @brief Add entities to the knowledge base.
* *
* @todo make entities const?
* @param[in] entities The entities to add. * @param[in] entities The entities to add.
*/ */
void addEntities(std::vector<obelisk::Entity>& entities); void addEntities(std::vector<obelisk::Entity>& entities);
@ -102,29 +103,34 @@ namespace obelisk
/** /**
* @brief Get an entity object based on the ID it contains. * @brief Get an entity object based on the ID it contains.
* *
* @param[out] entity The Entity object should contain just the ID and the rest will be filled in. * @param[out] entity The Entity object should contain just the ID
* and the rest will be filled in.
*/ */
void getEntity(obelisk::Entity& entity); void getEntity(obelisk::Entity& entity);
/** /**
* @brief Get a verb object based on the ID it contains. * @brief Get a verb object based on the ID it contains.
* *
* @param[in] verb The Verb object should contain just the ID and the rest will be filled in. * @param[out] verb The Verb object should contain just the ID and
* the rest will be filled in.
*/ */
void getVerb(obelisk::Verb& verb); void getVerb(obelisk::Verb& verb);
/** /**
* @brief Get a fact object based on the ID it contains. * @brief Get a fact object based on the ID it contains.
* *
* @param[in] fact The fact object should contain just the ID and the rest will be filled in. * @param[out] fact The fact object should contain just the ID and
* the rest will be filled in.
*/ */
void getFact(obelisk::Fact& fact); void getFact(obelisk::Fact& fact);
/** /**
* @brief Take a float and divide it into 2 floats. * @brief Take a float and divide it into 2 floats.
* *
* This is useful to store doubles in SQLite since SQLite doesn't have a double type. * This is useful to store doubles in SQLite since SQLite doesn't
* Instead just store the 2 floats in the database. Then after selecting them combine them. * have a double type.
* Instead just store the 2 floats in the database. Then after
* selecting them combine them.
* *
* @param[out] result1 The first float generated from the double. * @param[out] result1 The first float generated from the double.
* @param[out] result2 The second float generated from the double. * @param[out] result2 The second float generated from the double.
@ -135,7 +141,8 @@ namespace obelisk
/** /**
* @brief Combines 2 separated floats back into a double. * @brief Combines 2 separated floats back into a double.
* *
* This will recombine the separated floats from the getFloat method. * This will recombine the separated floats from the getFloat
* method.
* *
* @param[out] result The double generated from the combined floats. * @param[out] result The double generated from the combined floats.
* @param[in] var1 The first float to combine. * @param[in] var1 The first float to combine.

View File

@ -49,19 +49,22 @@ namespace obelisk
/** /**
* @brief Comment the rest of the line. * @brief Comment the rest of the line.
* *
* @param[in] lastChar The char to check to see if it in the end of the line. * @param[in] lastChar The char to check to see if it in the end of
* the line.
*/ */
void commentLine(int* lastChar); void commentLine(int* lastChar);
public: public:
/** /**
* @brief These token represent recognized language keywords and language functionality. * @brief These token represent recognized language keywords and
* language functionality.
* *
*/ */
enum Token enum Token
{ {
/** /**
* @brief End of file is returned when the source code is finished. * @brief End of file is returned when the source code is
* finished.
* *
*/ */
kTokenEof = -1, kTokenEof = -1,
@ -72,7 +75,8 @@ namespace obelisk
*/ */
kTokenFact = -2, kTokenFact = -2,
/** /**
* @brief A rule which is a relationship between a new fact a existing fact. * @brief A rule which is a relationship between a new fact a
* existing fact.
* *
*/ */
kTokenRule = -3, kTokenRule = -3,
@ -113,14 +117,16 @@ namespace obelisk
* @brief Gets the next token in the source code. * @brief Gets the next token in the source code.
* *
* @throws LexerException when an invalid token is found. * @throws LexerException when an invalid token is found.
* @return int Returns a Token value or char if no known token was found. * @return int Returns a Token value or char if no known token was
* found.
*/ */
int getToken(); int getToken();
/** /**
* @brief Get the last identifier. * @brief Get the last identifier.
* *
* @return const std::string& Returns a string that contains the last found identifier. * @return const std::string& Returns a string that contains the
* last found identifier.
*/ */
const std::string& getIdentifier(); const std::string& getIdentifier();
@ -168,7 +174,8 @@ namespace obelisk
/** /**
* @brief Return the exception's error message. * @brief Return the exception's error message.
* *
* @return const char* Returns a string containing the error message. * @return const char* Returns a string containing the error
* message.
*/ */
const char* what() const noexcept const char* what() const noexcept
{ {

View File

@ -1,5 +1,6 @@
/** /**
* @brief The obelisk namespace contains everything needed to compile obelisk code. * @brief The obelisk namespace contains everything needed to compile obelisk
* code.
* *
*/ */
namespace obelisk namespace obelisk