Skip to content

Commit

Permalink
Better Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Jul 3, 2024
1 parent 415cebf commit f20e37f
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 109 deletions.
6 changes: 3 additions & 3 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ ALIASES =
# members will be omitted, etc.
# The default value is: NO.

OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_FOR_C = NO

# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
# Python sources only. Doxygen will then generate output that is more tailored
Expand Down Expand Up @@ -891,7 +891,7 @@ WARN_NO_PARAMDOC = NO
# will automatically be disabled.
# The default value is: NO.

WARN_IF_UNDOC_ENUM_VAL = NO
WARN_IF_UNDOC_ENUM_VAL = YES

# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
Expand Down Expand Up @@ -1996,7 +1996,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.

GENERATE_LATEX = YES
GENERATE_LATEX = NO

# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
Expand Down
8 changes: 4 additions & 4 deletions include/filesystem/fileaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ namespace Nickvision::Filesystem
*/
enum class FileAction
{
Added = 1,
Removed,
Modified,
Renamed
Added = 1, ///< A file was added to the file system object.
Removed, ///< A file was removed from the file system object.
Modified, ///< A file was modified in the file system object.
Renamed ///< A file was renamed in the file system object.
};
}

Expand Down
28 changes: 14 additions & 14 deletions include/filesystem/userdirectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ namespace Nickvision::Filesystem
*/
enum class UserDirectory
{
Home,
Config,
ApplicationConfig,
Cache,
ApplicationCache,
LocalData,
ApplicationLocalData,
Desktop,
Documents,
Downloads,
Music,
Pictures,
Templates,
Videos
Home, ///< The home directory.
Config, ///< The configuration directory.
ApplicationConfig, ///< The application configuration directory.
Cache, ///< The cache directory.
ApplicationCache, ///< The application cache directory.
LocalData, ///< The local data directory.
ApplicationLocalData, ///< The application local data directory.
Desktop, ///< The desktop directory.
Documents, ///< The documents directory.
Downloads, ///< The downloads directory.
Music, ///< The music directory.
Pictures, ///< The pictures directory.
Templates, ///< The templates directory.
Videos ///< The videos directory.
};
}

Expand Down
12 changes: 6 additions & 6 deletions include/filesystem/watcherflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ namespace Nickvision::Filesystem
*/
enum class WatcherFlags
{
FileName = 1,
DirectoryName = 2,
Attributes = 4,
Size = 8,
LastWrite = 16,
LastAccess = 32
FileName = 1, ///< The name of a file in the file system object has changed.
DirectoryName = 2, ///< The name of a directory in the file system object has changed.
Attributes = 4, ///< The attributes of an item in the file system object have changed.
Size = 8, ///< The size of an item in the file system object has changed.
LastWrite = 16, ///< The last write time of an item in the file system object has changed.
LastAccess = 32 ///< The last access time of an item in the file system object has changed.
};

constexpr WatcherFlags operator~(WatcherFlags a)
Expand Down
8 changes: 4 additions & 4 deletions include/keyring/credentialcheckstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ namespace Nickvision::Keyring
*/
enum class CredentialCheckStatus
{
Valid = 1,
EmptyName = 2,
EmptyUsernamePassword = 4,
InvalidUri = 8
Valid = 1, ///< The credential is valid.
EmptyName = 2, ///< The credential has an empty name.
EmptyUsernamePassword = 4, ///< The credential has an empty username or password.
InvalidUri = 8 ///< The credential has an invalid URI.
};

constexpr CredentialCheckStatus operator~(CredentialCheckStatus a)
Expand Down
8 changes: 4 additions & 4 deletions include/keyring/passwordcontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ namespace Nickvision::Keyring
*/
enum class PasswordContent
{
Numeric = 1,
Uppercase = 2,
Lowercase = 4,
Special = 8
Numeric = 1, ///< The password contains numeric characters.
Uppercase = 2, ///< The password contains uppercase characters.
Lowercase = 4, ///< The password contains lowercase characters.
Special = 8 ///< The password contains special characters.
};

constexpr PasswordContent operator~(PasswordContent a)
Expand Down
12 changes: 6 additions & 6 deletions include/keyring/passwordstrength.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace Nickvision::Keyring
*/
enum class PasswordStrength
{
Blank = 0,
VeryWeak,
Weak,
Medium,
Strong,
VeryStrong
Blank = 0, ///< A blank password.
VeryWeak, ///< A very weak password.
Weak, ///< A weak password.
Medium, ///< A medium password.
Strong, ///< A strong password.
VeryStrong ///< A very strong password.
};

/**
Expand Down
10 changes: 5 additions & 5 deletions include/logging/loglevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace Nickvision::Logging
*/
enum class LogLevel
{
Debug,
Info,
Warning,
Error,
Critical
Debug, ///< A debug message.
Info, ///< An informational message.
Warning, ///< A warning message.
Error, ///< An error message.
Critical // /<A critical message.
};
}

Expand Down
6 changes: 3 additions & 3 deletions include/network/networkstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace Nickvision::Network
*/
enum class NetworkState
{
Disconnected = 0,
ConnectedLocal,
ConnectedGlobal
Disconnected = 0, ///< The network is disconnected.
ConnectedLocal, ///< The network is connected locally.
ConnectedGlobal ///< The network is connected globally.
};
}

Expand Down
8 changes: 4 additions & 4 deletions include/notifications/notificationseverity.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ namespace Nickvision::Notifications
*/
enum class NotificationSeverity
{
Informational = 0,
Success,
Warning,
Error
Informational = 0, ///< An informational notification.
Success, ///< A success notification.
Warning, ///< A warning notification.
Error ///< An error notification.
};
}

Expand Down
4 changes: 2 additions & 2 deletions include/notifications/notifyiconmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ namespace Nickvision::Notifications
*/
enum class NotifyIconMenuItemType
{
Action = 0,
Separator = 1
Action = 0, ///< A menu item that can be clicked.
Separator = 1 ///< A separator menu item.
};

/**
Expand Down
6 changes: 3 additions & 3 deletions include/system/deploymentmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace Nickvision::System
*/
enum class DeploymentMode
{
Local,
Flatpak,
Snap
Local, ///< Local deployment.
Flatpak, ///< Flatpak deployment.
Snap ///< Snap deployment.
};
}

Expand Down
8 changes: 4 additions & 4 deletions include/system/operatingsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ namespace Nickvision::System
*/
enum class OperatingSystem
{
Windows,
Linux,
MacOS,
Other
Windows, ///< The Windows operating system.
Linux, ///< The Linux operating system.
MacOS, ///< The MacOS operating system.
Other ///< A unknown operating system.
};
}

Expand Down
10 changes: 5 additions & 5 deletions include/taskbar/progressstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ namespace Nickvision::Taskbar
*/
enum class ProgressState
{
NoProgress = 0,
Indeterminate = 1,
Normal = 2,
Error = 4,
Paused = 8
NoProgress = 0, ///< The taskbar item is in a no progress state.
Indeterminate = 1, ///< The taskbar item is in an indeterminate progress state.
Normal = 2, ///< The taskbar item is in a normal progress state.
Error = 4, ///< The taskbar item is in an error progress state.
Paused = 8 ///< The taskbar item is in a paused progress state.
};
}

Expand Down
4 changes: 2 additions & 2 deletions include/update/versiontype.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace Nickvision::Update
*/
enum class VersionType
{
Stable = 0,
Preview
Stable = 0, ///< A stable version.
Preview ///< preview version.
};
}

Expand Down
11 changes: 5 additions & 6 deletions manual/datafiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Here are some key points when defining your own configuration objects:
Here is an example of a custom configuration object using `DataFileBase`:
```cpp
using namespace Nickvision::App;
using namespace Nickvision::Events;

class AppConfig : public DataFileBase
{
Expand All @@ -32,11 +33,8 @@ public:
m_json["PreviousCount"] = count;
}
};
```
This object can now be used with the `DataFileManager`:
```cpp
using namespace Nickvision::App;
using namespace Nickvision::Events;

//This object can now be used with the DataFileManager:

int main()
{
Expand All @@ -48,6 +46,7 @@ int main()
std::cout << config.getPreviousCount() << std::endl;
}
config.setPreviousCount(6);
config.save(); //lambda will be invoked on success
config.save(); //above lambda will be invoked on success
return 0;
}
```
56 changes: 31 additions & 25 deletions manual/events.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
# Defining Events In Your Classes
libnick events are designed to easily integrate within your classes to easily notify consumers of changes in state of an object.

Let's take a look at `ConfigurationBase` and how it defines and uses events.
Let's take a look at `Nickvision::App::DataFileBase` and how it defines and uses events.

```cpp
class ConfigurationBase
namespace Nickvision::App
{
public:
...
Events::Event<Events::EventArgs>& saved()
{
return m_saved;
}

bool save()
{
...
saved({}); //Same as saved.invoke({});
...
}

private:
...
Events::Event<Events::EventArgs> m_saved;
};
class DataFileBase
{
public:
...
Events::Event<Events::EventArgs>& saved()
{
return m_saved;
}

bool save()
{
...
saved({}); //Same as saved.invoke({});
...
}

private:
...
Events::Event<Events::EventArgs> m_saved;
};
}
```
Here we can see how `ConfigurationBase` defines a `saved` event, exposes it to the consumer, and triggers/invokes the event within its `save` method.
Here we can see how `Nickvision::App::DataFileBase` defines a `saved` event, exposes it to the consumer, and triggers/invokes the event within its `save` method.
A consumer of `ConfigurationBase` can easily subscribe to the event and have its handler called when the configuration object is saved:
A consumer of `Nickvision::App::DataFileBase` can easily subscribe to the event and have its handler called when the configuration object is saved:
```cpp
void handler(const Nickvision::Events::EventArgs& e)
using namespace Nickvision::App;
using namespace Nickvision::Events;
void handler(const EventArgs& e)
{
std::cout << "Config saved." << std::endl;
}
int main()
{
ConfigurationBase base{ ... };
DataFileBase base{ ... };
base.saved() += handler;
base.save();
}
```

This program will print "Config saved." as a result of the event being invoke once the save method was called.
This program will print `Config saved.` as a result of the event being invoke once the save method was called.
Loading

0 comments on commit f20e37f

Please sign in to comment.