Adding of _t to (u)int types, and WChar to char32_t

See: eaae0bb5e
This commit is contained in:
Jonathan G Rennison
2024-01-07 16:41:53 +00:00
parent 55d78a23be
commit 97e6f3062e
655 changed files with 7555 additions and 7555 deletions

View File

@@ -16,9 +16,9 @@
#include <initializer_list>
#include <vector>
enum SaveToConfigFlags : uint32;
enum SaveToConfigFlags : uint32_t;
enum SettingFlag : uint32 {
enum SettingFlag : uint32_t {
SF_NONE = 0,
SF_GUI_0_IS_SPECIAL = 1 << 0, ///< A value of zero is possible and has a custom string (the one after "strval").
SF_GUI_NEGATIVE_IS_SPECIAL = 1 << 1, ///< A negative value has another string (the one after "strval").
@@ -100,11 +100,11 @@ struct SettingOnGuiCtrlData {
struct IniItem;
typedef bool OnGuiCtrl(SettingOnGuiCtrlData &data); ///< callback prototype for GUI operations
typedef int64 OnXrefValueConvert(int64 val); ///< callback prototype for xref value conversion
typedef int64_t OnXrefValueConvert(int64_t val); ///< callback prototype for xref value conversion
/** The last entry in an array of struct SettingDescEnumEntry must use STR_NULL. */
struct SettingDescEnumEntry {
int32 val;
int32_t val;
StringID str;
};
@@ -185,24 +185,24 @@ struct IntSettingDesc : SettingDesc {
* @param value The prospective new value for the setting.
* @return True when the setting is accepted.
*/
typedef bool PreChangeCheck(int32 &value);
typedef bool PreChangeCheck(int32_t &value);
/**
* A callback to denote that a setting has been changed.
* @param The new value for the setting.
*/
typedef void PostChangeCallback(int32 value);
typedef void PostChangeCallback(int32_t value);
IntSettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, int32 def,
int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val,
IntSettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, int32_t def,
int32_t min, uint32_t max, int32_t interval, StringID str, StringID str_help, StringID str_val,
SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback, const SettingDescEnumEntry *enumlist) :
SettingDesc(save, name, flags, guiproc, startup, patx_name), def(def), min(min), max(max), interval(interval),
str(str), str_help(str_help), str_val(str_val), cat(cat), pre_check(pre_check),
post_callback(post_callback), enumlist(enumlist) {}
int32 def; ///< default value given when none is present
int32 min; ///< minimum values
uint32 max; ///< maximum values
int32 interval; ///< the interval to use between settings in the 'settings' window. If interval is '0' the interval is dynamically determined
int32_t def; ///< default value given when none is present
int32_t min; ///< minimum values
uint32_t max; ///< maximum values
int32_t interval; ///< the interval to use between settings in the 'settings' window. If interval is '0' the interval is dynamically determined
StringID str; ///< (translated) string with descriptive text; gui and console
StringID str_help; ///< (Translated) string with help text; gui only.
StringID str_val; ///< (Translated) first string describing the value.
@@ -219,20 +219,20 @@ struct IntSettingDesc : SettingDesc {
virtual bool IsBoolSetting() const { return false; }
bool IsIntSetting() const override { return true; }
void ChangeValue(const void *object, int32 newvalue, SaveToConfigFlags ini_save_flags) const;
void MakeValueValidAndWrite(const void *object, int32 value) const;
void ChangeValue(const void *object, int32_t newvalue, SaveToConfigFlags ini_save_flags) const;
void MakeValueValidAndWrite(const void *object, int32_t value) const;
virtual size_t ParseValue(const char *str) const;
void FormatValue(char *buf, const char *last, const void *object) const override;
virtual void FormatIntValue(char *buf, const char *last, uint32 value) const;
virtual void FormatIntValue(char *buf, const char *last, uint32_t value) const;
void ParseValue(const IniItem *item, void *object) const override;
bool IsSameValue(const IniItem *item, void *object) const override;
bool IsDefaultValue(void *object) const override;
int32 Read(const void *object) const;
int32_t Read(const void *object) const;
private:
void MakeValueValid(int32 &value) const;
void Write(const void *object, int32 value) const;
void MakeValueValid(int32_t &value) const;
void Write(const void *object, int32_t value) const;
};
/** Boolean setting. */
@@ -246,7 +246,7 @@ struct BoolSettingDesc : IntSettingDesc {
bool IsBoolSetting() const override { return true; }
size_t ParseValue(const char *str) const override;
void FormatIntValue(char *buf, const char *last, uint32 value) const override;
void FormatIntValue(char *buf, const char *last, uint32_t value) const override;
};
/** One of many setting. */
@@ -254,7 +254,7 @@ struct OneOfManySettingDesc : IntSettingDesc {
typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error
OneOfManySettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name,
int32 def, int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
int32_t def, int32_t max, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
PreChangeCheck pre_check, PostChangeCallback post_callback,
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
IntSettingDesc(save, name, flags, guiproc, startup, patx_name, def, 0, max, 0, str, str_help, str_val, cat, pre_check, post_callback, nullptr), many_cnvt(many_cnvt)
@@ -269,20 +269,20 @@ struct OneOfManySettingDesc : IntSettingDesc {
char *FormatSingleValue(char *buf, const char *last, uint id) const;
size_t ParseValue(const char *str) const override;
void FormatIntValue(char *buf, const char *last, uint32 value) const override;
void FormatIntValue(char *buf, const char *last, uint32_t value) const override;
};
/** Many of many setting. */
struct ManyOfManySettingDesc : OneOfManySettingDesc {
ManyOfManySettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name,
int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
int32_t def, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
PreChangeCheck pre_check, PostChangeCallback post_callback,
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
OneOfManySettingDesc(save, name, flags, guiproc, startup, patx_name, def, (1 << many.size()) - 1, str, str_help,
str_val, cat, pre_check, post_callback, many, many_cnvt) {}
size_t ParseValue(const char *str) const override;
void FormatIntValue(char *buf, const char *last, uint32 value) const override;
void FormatIntValue(char *buf, const char *last, uint32_t value) const override;
};
/** String settings. */
@@ -303,12 +303,12 @@ struct StringSettingDesc : SettingDesc {
typedef void PostChangeCallback(const std::string &value);
StringSettingDesc(const SaveLoad &save, const char *name, SettingFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, const char *def,
uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
uint32_t max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
SettingDesc(save, name, flags, guiproc, startup, patx_name), def(def == nullptr ? "" : def), max_length(max_length),
pre_check(pre_check), post_callback(post_callback) {}
std::string def; ///< Default value given when none is present
uint32 max_length; ///< Maximum length of the string, 0 means no maximum length
uint32_t max_length; ///< Maximum length of the string, 0 means no maximum length
PreChangeCheck *pre_check; ///< Callback to check for the validity of the setting.
PostChangeCallback *post_callback; ///< Callback when the setting has been changed.
@@ -360,7 +360,7 @@ inline const SettingDesc *GetSettingFromName(const std::string &name)
return GetSettingFromName(name.c_str());
}
bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame = false);
bool SetSettingValue(const IntSettingDesc *sd, int32_t value, bool force_newgame = false);
bool SetSettingValue(const StringSettingDesc *sd, const std::string value, bool force_newgame = false);
void IterateSettingsTables(std::function<void(const SettingTable &, void *)> handler);
@@ -430,7 +430,7 @@ struct IterateSettingTables {
SettingTablesIterator end() { return SettingTablesIterator(this->tables, this->tables.end(), SettingTable::iterator()); }
};
enum class SettingsCompatType : uint8 {
enum class SettingsCompatType : uint8_t {
Null,
Setting,
Xref,
@@ -439,7 +439,7 @@ enum class SettingsCompatType : uint8 {
struct SettingsCompat {
std::string name; ///< Name of the field.
SettingsCompatType type; ///< Compat type
uint16 length; ///< Length of the NULL field.
uint16_t length; ///< Length of the NULL field.
SaveLoadVersion version_from; ///< Save/load the variable starting from this savegame version.
SaveLoadVersion version_to; ///< Save/load the variable before this savegame version.
SlXvFeatureTest ext_feature_test; ///< Extended feature test