-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: comments are now more specific in code style. (#964)
- Loading branch information
1 parent
359ce61
commit af1af42
Showing
8 changed files
with
91 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* @brief This is a function that does some cool stuff. | ||
* More stuff here will still go in brief! | ||
* @warning This does nothing! | ||
*/ | ||
func_name(); | ||
|
||
/* | ||
* @brief This turns a name into a meme name! | ||
* | ||
* @param name The name of the user that you want to meme-ify. | ||
* @return a meme name! | ||
*/ | ||
std::string name_to_meme(const std::string& name) const; | ||
|
||
/* -------------------- .cpp file -------------------- */ | ||
|
||
int main() { | ||
/* We are now going to do some cool stuff. */ | ||
func_name(); | ||
|
||
/* Going to turn brain into a meme name. | ||
* Why? | ||
* Because why not. That's why. | ||
*/ | ||
std::cout << name_to_meme("Brain") << "\n"; | ||
} |
20 changes: 20 additions & 0 deletions
20
docpages/example_code/coding_style_standards/curly_braces.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
void foo() { | ||
if (a == b) { | ||
c(); | ||
} else { | ||
d(); | ||
} | ||
|
||
while (true) { | ||
// ... | ||
} | ||
|
||
switch (a) { | ||
case 1: | ||
c(); | ||
break; | ||
case 2: | ||
d(); | ||
break; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
docpages/example_code/coding_style_standards/dot_notation.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
stuff{} | ||
.add_stuff() | ||
.add_stuff(); | ||
|
||
event.reply("This reply function isn't indented!"); |
18 changes: 18 additions & 0 deletions
18
docpages/example_code/coding_style_standards/fluent_design.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class DPP_EXPORT my_new_class { | ||
public: | ||
int hats; | ||
int clowns; | ||
|
||
my_new_class& set_hats(int new_hats); | ||
my_new_class& set_clowns(int new_clowns); | ||
}; | ||
|
||
my_new_class& my_new_class::set_hats(int new_hats) { | ||
hats = new_hats; | ||
return *this; | ||
} | ||
|
||
my_new_class& my_new_class::set_clowns(int new_clowns) { | ||
clowns = new_clowns; | ||
return *this; | ||
} |
2 changes: 2 additions & 0 deletions
2
docpages/example_code/coding_style_standards/fluent_design2.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dpp::my_new_class nc; | ||
nc.set_hats(3).set_clowns(9001); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
std::vector<std::string> clowns = { "pennywise", "bobo" }; | ||
|
||
evaluate_clown(clowns[0], evilness(2.5, factor)); |
5 changes: 5 additions & 0 deletions
5
docpages/example_code/coding_style_standards/symbol_exporting.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class DPP_EXPORT my_new_class { | ||
public: | ||
int hats; | ||
int clowns; | ||
}; |