mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 05:06:30 +04:00
Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
46
lib/app-scened-template/record_controller.hpp
Normal file
46
lib/app-scened-template/record_controller.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
#include <furi/record.h>
|
||||
|
||||
/**
|
||||
* @brief Class for opening, casting, holding and closing records
|
||||
*
|
||||
* @tparam TRecordClass record class
|
||||
*/
|
||||
template <typename TRecordClass> class RecordController {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Record Controller object for record with record name
|
||||
*
|
||||
* @param record_name record name
|
||||
*/
|
||||
RecordController(const char* record_name) {
|
||||
name = record_name;
|
||||
value = static_cast<TRecordClass*>(furi_record_open(name));
|
||||
};
|
||||
|
||||
~RecordController() {
|
||||
furi_record_close(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Record getter
|
||||
*
|
||||
* @return TRecordClass* record value
|
||||
*/
|
||||
TRecordClass* get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Record getter (by cast)
|
||||
*
|
||||
* @return TRecordClass* record value
|
||||
*/
|
||||
operator TRecordClass*() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
private:
|
||||
const char* name;
|
||||
TRecordClass* value;
|
||||
};
|
||||
Reference in New Issue
Block a user