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 5, 2024
1 parent 4218bfe commit 4b256ca
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions assets/page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ using namespace std;
namespace assets_page {


string header (const string & title, void * webserver_request)
string header (const string & title, Webserver_Request& webserver_request)
{
Webserver_Request * request = static_cast<Webserver_Request *>(webserver_request);
Assets_Header header = Assets_Header (title, *request);
Assets_Header header = Assets_Header (title, webserver_request);
string page = header.run ();
return page;
}
Expand Down
4 changes: 3 additions & 1 deletion assets/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>

class Webserver_Request;

namespace assets_page {

std::string header (const std::string & title, void * webserver_request);
std::string header (const std::string & title, Webserver_Request& webserver_request);
std::string success (const std::string & message);
std::string error (const std::string & message);
std::string message (const std::string & message);
Expand Down
2 changes: 1 addition & 1 deletion bb/chapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool bible_chapter_acl (Webserver_Request& webserver_request)

std::string bible_chapter (Webserver_Request& webserver_request)
{
std::string page = assets_page::header (translate ("Chapter"), std::addressof(webserver_request));
std::string page = assets_page::header (translate ("Chapter"), webserver_request);

Assets_View view {};

Expand Down
2 changes: 1 addition & 1 deletion checks/suppress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ string checks_suppress (Webserver_Request& webserver_request)


string page {};
page = assets_page::header (translate ("Suppressed checking results"), std::addressof(webserver_request));
page = assets_page::header (translate ("Suppressed checking results"), webserver_request);
Assets_View view {};


Expand Down
2 changes: 1 addition & 1 deletion client/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ std::string client_index (Webserver_Request& webserver_request)

// Since the role of the user may change after a successful connection to the server,
// the menu generation in the header should be postponed till when the actual role is known.
page = assets_page::header (translate ("Server"), std::addressof(webserver_request));
page = assets_page::header (translate ("Server"), webserver_request);

page += view.render ("client", "index");

Expand Down
2 changes: 1 addition & 1 deletion index/listing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bool index_listing_acl (Webserver_Request& webserver_request, string url)
string index_listing (Webserver_Request& webserver_request, string url)
{
string page;
page = assets_page::header (translate ("Bibledit"), std::addressof(webserver_request));
page = assets_page::header (translate ("Bibledit"), webserver_request);
// No breadcrumbs because the user can arrive here from more than one place.
Assets_View view;
url = filter_url_urldecode (url);
Expand Down
2 changes: 1 addition & 1 deletion paratext/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool paratext_index_acl (Webserver_Request& webserver_request)
string paratext_index (Webserver_Request& webserver_request)
{
string page;
page = assets_page::header (translate ("Paratext"), std::addressof(webserver_request));
page = assets_page::header (translate ("Paratext"), webserver_request);
Assets_View view;
string success;
string error;
Expand Down

0 comments on commit 4b256ca

Please sign in to comment.