Skip to content

Commit

Permalink
Clearer types in code rather than void pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Jan 6, 2024
1 parent 8b6e2b5 commit 8e93a47
Show file tree
Hide file tree
Showing 21 changed files with 100 additions and 135 deletions.
2 changes: 1 addition & 1 deletion changes/change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ string changes_change (Webserver_Request& webserver_request)
{
Database_Modifications database_modifications {};
Database_Notes database_notes = Database_Notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


// Note unsubscribe handler.
Expand Down
6 changes: 3 additions & 3 deletions email/receive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ void email_receive ()
// Messages start at number 1 instead of 0.
for (int i = 1; i <= emailcount; i++) {

Webserver_Request request;
Confirm_Worker confirm_worker = Confirm_Worker (&request);
Notes_Logic notes_logic = Notes_Logic (&request);
Webserver_Request webserver_request;
Confirm_Worker confirm_worker = Confirm_Worker (&webserver_request);
Notes_Logic notes_logic (webserver_request);

error.clear ();
string message = email_receive_message (error);
Expand Down
2 changes: 1 addition & 1 deletion notes/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool notes_actions_acl (Webserver_Request& webserver_request)
string notes_actions (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic = Notes_Logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/assign-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool notes_assign_1_acl (Webserver_Request& webserver_request)
string notes_assign_1 (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);
Database_NoteAssignment database_noteassignment;


Expand Down
2 changes: 1 addition & 1 deletion notes/bb-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool notes_bible_1_acl (Webserver_Request& webserver_request)
string notes_bible_1 (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/bb-n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool notes_bible_n_acl (Webserver_Request& webserver_request)
string notes_bible_n (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/bulk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ bool notes_bulk_acl (Webserver_Request& webserver_request)
string notes_bulk (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);
Database_NoteAssignment database_noteassignment;


Expand Down
2 changes: 1 addition & 1 deletion notes/click.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool notes_click_acl (Webserver_Request& webserver_request)
string notes_click (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


if (webserver_request.query.count ("open")) {
Expand Down
2 changes: 1 addition & 1 deletion notes/comment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool notes_comment_acl (Webserver_Request& webserver_request)
string notes_comment (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool notes_create_acl (Webserver_Request& webserver_request)
string notes_create (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);

string page;

Expand Down
2 changes: 1 addition & 1 deletion notes/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool notes_edit_acl (Webserver_Request& webserver_request)
string notes_edit (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
187 changes: 75 additions & 112 deletions notes/logic.cpp

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions notes/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <config/libraries.h>
#include <filter/passage.h>

class Webserver_Request;

class Notes_Logic
{
public:
Notes_Logic (void * webserver_request_in);
Notes_Logic (Webserver_Request& webserver_request);
static constexpr int lowNoteIdentifier = 100000000;
static constexpr int highNoteIdentifier = 999999999;
static constexpr int notifyNoteNew = 1;
Expand Down Expand Up @@ -56,7 +58,7 @@ class Notes_Logic
bool handleEmailComment (std::string from, std::string subject, std::string body);
std::string generalBibleName ();
private:
void * webserver_request {nullptr};
Webserver_Request& m_webserver_request;
void notifyUsers (int identifier, int notification);
void emailUsers (int identifier, const std::string& label, std::string bible, const std::vector <std::string> & users, bool postpone);
};
Expand Down
2 changes: 1 addition & 1 deletion notes/severity-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool notes_severity_1_acl (Webserver_Request& webserver_request)
string notes_severity_1 (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/status-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ bool notes_status_1_acl (Webserver_Request& webserver_request)
string notes_status_1 (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/summary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ bool notes_summary_acl (Webserver_Request& webserver_request)
string notes_summary (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion notes/verses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool notes_verses_acl (Webserver_Request& webserver_request)
string notes_verses (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion public/comment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool public_comment_acl (Webserver_Request& webserver_request)
string public_comment (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion public/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bool public_create_acl (Webserver_Request& webserver_request)
string public_create (Webserver_Request& webserver_request)
{
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


string page;
Expand Down
2 changes: 1 addition & 1 deletion sync/notes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ string sync_notes (Webserver_Request& webserver_request)
{
Sync_Logic sync_logic = Sync_Logic (std::addressof(webserver_request));
Database_Notes database_notes (webserver_request);
Notes_Logic notes_logic = Notes_Logic (std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);


if (!sync_logic.security_okay ()) {
Expand Down
2 changes: 1 addition & 1 deletion unittests/notes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void test_database_notes ()
Webserver_Request webserver_request;
Database_Notes database_notes (webserver_request);
database_notes.create ();
Notes_Logic notes_logic = Notes_Logic(std::addressof(webserver_request));
Notes_Logic notes_logic (webserver_request);
Database_Mail database_mail = Database_Mail (std::addressof(webserver_request));
database_mail.create ();

Expand Down

0 comments on commit 8e93a47

Please sign in to comment.