Template Managment complete #27
No reviewers
Labels
No Label
bug
Critical Priority
duplicate
enhancement
help wanted
High Priority
invalid
Low Priority
Medium Priority
Meta
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Cavemanon/cavecomm#27
Loading…
Reference in New Issue
No description provided.
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
regarding
bbf526f99f
I am unsure if i am satisfied with this so i might go back to later and force a reentry with a proper name, tho fundamentally i don't think there is an issue with this solution.@ -659,0 +676,4 @@
crow::mustache::context ctx;
if (Utilities::checkCookieLoginState(configuration, cookieCtx)) {
ctx[MUSTACHE_COOKIE_LOGGED_IN] = true;
string name, content, contactdata, contactinformation, currencypreference, priceupfront, priceondeliver;
From what I'm seeing, these strings are all associated with each other, and may be better off held in a struct. This might make some of the later lines with all the splitItem.at() comparisons a bit easier to deal with.
Yeah a struct in this case is quite a good idea
@ -659,0 +697,4 @@
if (splitItem.at(0) == "templatepriceupfront")
priceupfront = splitItem.at(1);
if (splitItem.at(0) == "templatepriceondeliver")
priceondeliver = splitItem.at(1);
could save splitItem.at(0)'s as a variable, then just use a switch statement to cut down on the amount of times splitItem.at() is called.
True, i am kinda pointlessly using at(), [] would have been more appropriate since it directly access the data, maybe i am misunderstanding something but in c++ switch is not capable of evaluating strings and would require an intermediate step that would introduce unnecessary operations.
And i believe saving splitItem.at(0) as a variable would be unnecessary both due to memory and operations, since splitItem[0] should achieve the same thing without the unnecessary performance loss that at() incurs.
@ -698,0 +825,4 @@
priceupfront = splitItem.at(1);
if (splitItem.at(0) == "templatepriceondeliver")
priceondeliver = splitItem.at(1);
}
could save splitItem.at(0)'s as a variable, then just use a switch statement to cut down on the amount of times splitItem.at() is called.
Given that pattern has appeared twice, it may be a good idea to just make a function for this. However, this advise is conditional on if it would be easy to do that or not.
I will be moving it into a separate function partially to minimize the duplication of the parser and partially due to the duplication of hardcoded strings
the commit
9e5f0a68ab
should address it