mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/code] Handle too many Script default names used
When adding to many scripts without naming them, one can overflow the number of default generated script names, in which case we force the user to enter a name.
This commit is contained in:
@@ -9,16 +9,18 @@ namespace Code {
|
||||
* Script: | AutoImportationStatus | Content |*/
|
||||
|
||||
class Script : public Ion::Storage::Record {
|
||||
private:
|
||||
// Default script names are chosen between script1 and script99
|
||||
static constexpr int k_maxNumberOfDefaultScriptNames = 99;
|
||||
static constexpr int k_defaultScriptNameNumberMaxSize = 2; // Numbers from 1 to 99 have 2 digits max
|
||||
public:
|
||||
static constexpr size_t k_importationStatusSize = 1;
|
||||
static constexpr int k_defaultScriptNameMaxSize = 6 + 2 + 1;
|
||||
/* k_defaultScriptNameMaxSize is the length of a name between script1 and
|
||||
* script99
|
||||
* 6 = strlen("script")
|
||||
* 2 = maxLength of integers between 1 and 99
|
||||
static constexpr int k_defaultScriptNameMaxSize = 6 + k_defaultScriptNameNumberMaxSize + 1;
|
||||
/* 6 = strlen("script")
|
||||
* k_defaultScriptNameNumberMaxSize = maxLength of integers between 1 and 99
|
||||
* 1 = null-terminating char */
|
||||
|
||||
static void DefaultName(char buffer[], size_t bufferSize);
|
||||
static bool DefaultName(char buffer[], size_t bufferSize);
|
||||
static bool nameCompliant(const char * name);
|
||||
|
||||
Script(Ion::Storage::Record r) : Record(r) {}
|
||||
|
||||
Reference in New Issue
Block a user