1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 13:24:09 +02:00

DeleteDictionaryAndKeysAndItems to DeleteDictionaryAndKeysAndValues

This commit is contained in:
Brian Fiete 2021-01-04 04:56:44 -08:00
parent d78cb3182a
commit f9b9b15214
15 changed files with 38 additions and 23 deletions

View file

@ -53,8 +53,8 @@ namespace Beefy.gfx
[CallingConvention(.Stdcall), CLink] [CallingConvention(.Stdcall), CLink]
static extern int32 FTFont_GetKerning(FTFont* font, int32 char8CodeA, int32 char8CodeB); static extern int32 FTFont_GetKerning(FTFont* font, int32 char8CodeA, int32 char8CodeB);
static Dictionary<String, String> sFontNameMap ~ DeleteDictionaryAndKeysAndItems!(_); static Dictionary<String, String> sFontNameMap ~ DeleteDictionaryAndKeysAndValues!(_);
static Dictionary<String, String> sFontFailMap ~ DeleteDictionaryAndKeysAndItems!(_); static Dictionary<String, String> sFontFailMap ~ DeleteDictionaryAndKeysAndValues!(_);
static Monitor sMonitor = new .() ~ delete _; static Monitor sMonitor = new .() ~ delete _;
struct FTFont struct FTFont
@ -201,7 +201,7 @@ namespace Beefy.gfx
{ {
using (sMonitor.Enter()) using (sMonitor.Enter())
{ {
DeleteDictionaryAndKeysAndItems!(sFontNameMap); DeleteDictionaryAndKeysAndValues!(sFontNameMap);
sFontNameMap = null; sFontNameMap = null;
} }
} }

View file

@ -19,7 +19,7 @@ namespace System.Diagnostics
String mDirectory = new String() ~ delete _; String mDirectory = new String() ~ delete _;
String mVerb = new String("Open") ~ delete _; String mVerb = new String("Open") ~ delete _;
public Dictionary<String, String> mEnvironmentVariables ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, String> mEnvironmentVariables ~ DeleteDictionaryAndKeysAndValues!(_);
public bool UseShellExecute { get { return mUseShellExecute; } set { mUseShellExecute = value; } }; public bool UseShellExecute { get { return mUseShellExecute; } set { mUseShellExecute = value; } };
public bool RedirectStandardInput { get { return mRedirectStandardInput; } set { mRedirectStandardInput = value; } }; public bool RedirectStandardInput { get { return mRedirectStandardInput; } set { mRedirectStandardInput = value; } };

View file

@ -4,7 +4,7 @@ namespace System
{ {
class PropertyBag class PropertyBag
{ {
public Dictionary<String, Object> mProperties ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Object> mProperties ~ DeleteDictionaryAndKeysAndValues!(_);
public void Add<T>(String key, T value) where T : struct public void Add<T>(String key, T value) where T : struct
{ {

View file

@ -153,7 +153,7 @@ static
} }
[NoShow] [NoShow]
[Obsolete("This mixin has been replaced by ClearAndDeleteItems", false)] [Obsolete("Replaced by ClearAndDeleteItems", false)]
public static mixin DeleteAndClearItems(var container) public static mixin DeleteAndClearItems(var container)
{ {
for (var value in container) for (var value in container)
@ -187,7 +187,7 @@ static
} }
} }
public static mixin DeleteDictionaryAndItems(var container) public static mixin DeleteDictionaryAndValues(var container)
{ {
if (container != null) if (container != null)
{ {
@ -199,6 +199,8 @@ static
} }
} }
[NoShow]
[Obsolete("Replaced by DeleteDictionaryAndKeysAndValues", false)]
public static mixin DeleteDictionaryAndKeysAndItems(var container) public static mixin DeleteDictionaryAndKeysAndItems(var container)
{ {
if (container != null) if (container != null)
@ -212,6 +214,19 @@ static
} }
} }
public static mixin DeleteDictionaryAndKeysAndValues(var container)
{
if (container != null)
{
for (var value in container)
{
delete value.key;
delete value.value;
}
delete container;
}
}
public static mixin DeleteAndNullify(var val) public static mixin DeleteAndNullify(var val)
{ {
delete val; delete val;

View file

@ -224,7 +224,7 @@ namespace System {
} }
#if FEATURE_WIN32_REGISTRY #if FEATURE_WIN32_REGISTRY
public Dictionary<String, TimeZoneInfo> m_systemTimeZones ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, TimeZoneInfo> m_systemTimeZones ~ DeleteDictionaryAndKeysAndValues!(_);
//public ReadOnlyCollection<TimeZoneInfo> m_readOnlySystemTimeZones; //public ReadOnlyCollection<TimeZoneInfo> m_readOnlySystemTimeZones;
public bool m_allSystemTimeZonesRead; public bool m_allSystemTimeZonesRead;

View file

@ -14,7 +14,7 @@ namespace IDE
public Monitor mMonitor = new .() ~ delete _; public Monitor mMonitor = new .() ~ delete _;
static String sVersionStr = "///@singleFileVersion "; static String sVersionStr = "///@singleFileVersion ";
static String sSectionStr = "///@embed "; static String sSectionStr = "///@embed ";
public Dictionary<String, String> mData = new .() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, String> mData = new .() ~ DeleteDictionaryAndKeysAndValues!(_);
public String mFilePath ~ delete _; public String mFilePath ~ delete _;
public bool mPendingSave; public bool mPendingSave;
public bool mHasChanges; public bool mHasChanges;

View file

@ -52,7 +52,7 @@ namespace IDE
// One watcher per directory // One watcher per directory
public static int32 sDbgFileCreateDelay; public static int32 sDbgFileCreateDelay;
Dictionary<String, WatcherEntry> mWatchers = new Dictionary<String, WatcherEntry>(); Dictionary<String, WatcherEntry> mWatchers = new Dictionary<String, WatcherEntry>();
Dictionary<String, DepInfo> mWatchedFiles = new Dictionary<String, DepInfo>() ~ DeleteDictionaryAndKeysAndItems!(_); // Including ref count Dictionary<String, DepInfo> mWatchedFiles = new Dictionary<String, DepInfo>() ~ DeleteDictionaryAndKeysAndValues!(_); // Including ref count
List<ChangeRecord> mChangeList = new .() ~ DeleteContainerAndItems!(_); List<ChangeRecord> mChangeList = new .() ~ DeleteContainerAndItems!(_);
Dictionary<String, ChangeRecord> mChangeMap = new .() ~ delete _; Dictionary<String, ChangeRecord> mChangeMap = new .() ~ delete _;
List<Object> mDependencyChangeList = new List<Object>() ~ delete _; List<Object> mDependencyChangeList = new List<Object>() ~ delete _;

View file

@ -446,7 +446,7 @@ namespace IDE
public String mFileName ~ delete _; public String mFileName ~ delete _;
public String mArgs ~ delete _; public String mArgs ~ delete _;
public String mWorkingDir ~ delete _; public String mWorkingDir ~ delete _;
public Dictionary<String, String> mEnvVars ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, String> mEnvVars ~ DeleteDictionaryAndKeysAndValues!(_);
public ArgsFileKind mUseArgsFile; public ArgsFileKind mUseArgsFile;
public int32 mParallelGroup = -1; public int32 mParallelGroup = -1;
public bool mIsTargetRun; public bool mIsTargetRun;

View file

@ -1253,7 +1253,7 @@ namespace IDE
public class Config public class Config
{ {
public Dictionary<String, Options> mPlatforms = new Dictionary<String, Options>() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Options> mPlatforms = new Dictionary<String, Options>() ~ DeleteDictionaryAndKeysAndValues!(_);
} }
public class Dependency public class Dependency
@ -1284,7 +1284,7 @@ namespace IDE
public int32 mCurResVer; public int32 mCurResVer;
public int32 mLastGeneratedResVer; public int32 mLastGeneratedResVer;
public Dictionary<String, Config> mConfigs = new Dictionary<String, Config>() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Config> mConfigs = new Dictionary<String, Config>() ~ DeleteDictionaryAndKeysAndValues!(_);
public GeneralOptions mGeneralOptions = new GeneralOptions() ~ delete _; public GeneralOptions mGeneralOptions = new GeneralOptions() ~ delete _;
public BeefGlobalOptions mBeefGlobalOptions = new BeefGlobalOptions() ~ delete _; public BeefGlobalOptions mBeefGlobalOptions = new BeefGlobalOptions() ~ delete _;
@ -1913,7 +1913,7 @@ namespace IDE
} }
} }
DeleteDictionaryAndKeysAndItems!(mConfigs); DeleteDictionaryAndKeysAndValues!(mConfigs);
mConfigs = new Dictionary<String, Config>(); mConfigs = new Dictionary<String, Config>();
for (var configNameSV in data.Enumerate("Configs")) for (var configNameSV in data.Enumerate("Configs"))

View file

@ -39,8 +39,8 @@ namespace IDE
public Object mTargetObject; public Object mTargetObject;
} }
public Dictionary<String, Target> mTargets = new .() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Target> mTargets = new .() ~ DeleteDictionaryAndKeysAndValues!(_);
public Dictionary<String, Cmd> mCmds = new .() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Cmd> mCmds = new .() ~ DeleteDictionaryAndKeysAndValues!(_);
} }
public enum CmdFlags public enum CmdFlags

View file

@ -314,11 +314,11 @@ namespace IDE
public class Config public class Config
{ {
public Dictionary<String, Options> mPlatforms = new Dictionary<String, Options>() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Options> mPlatforms = new Dictionary<String, Options>() ~ DeleteDictionaryAndKeysAndValues!(_);
} }
public BeefGlobalOptions mBeefGlobalOptions = new BeefGlobalOptions() ~ delete _; public BeefGlobalOptions mBeefGlobalOptions = new BeefGlobalOptions() ~ delete _;
public Dictionary<String, Config> mConfigs = new Dictionary<String, Config>() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, Config> mConfigs = new Dictionary<String, Config>() ~ DeleteDictionaryAndKeysAndValues!(_);
public HashSet<String> mExtraPlatforms = new .() ~ DeleteContainerAndItems!(_); public HashSet<String> mExtraPlatforms = new .() ~ DeleteContainerAndItems!(_);
public class ProjectSourceCompileInstance public class ProjectSourceCompileInstance
@ -892,7 +892,7 @@ namespace IDE
public void Deserialize(StructuredData data) public void Deserialize(StructuredData data)
{ {
DeleteDictionaryAndKeysAndItems!(mConfigs); DeleteDictionaryAndKeysAndValues!(mConfigs);
mConfigs = new Dictionary<String, Config>(); mConfigs = new Dictionary<String, Config>();
using (data.Open("Workspace")) using (data.Open("Workspace"))

View file

@ -17,7 +17,7 @@ namespace IDE.ui
{ {
public String mDocString = new String(256) ~ delete _; public String mDocString = new String(256) ~ delete _;
public String mBriefString ~ delete _; public String mBriefString ~ delete _;
public Dictionary<String, String> mParamInfo ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, String> mParamInfo ~ DeleteDictionaryAndKeysAndValues!(_);
public String ShowDocString public String ShowDocString
{ {

View file

@ -56,7 +56,7 @@ namespace IDE.ui
delete _; delete _;
}; };
public static int32 sCurrentMRUIndex = 1; public static int32 sCurrentMRUIndex = 1;
static Dictionary<String, TimeEntry> sTimeCache = new .() ~ DeleteDictionaryAndKeysAndItems!(_); static Dictionary<String, TimeEntry> sTimeCache = new .() ~ DeleteDictionaryAndKeysAndValues!(_);
protected EntryListView mFileList; protected EntryListView mFileList;
EditWidget mEditWidget; EditWidget mEditWidget;

View file

@ -38,7 +38,7 @@ namespace IDE.ui
} }
public Project mProject; public Project mProject;
Dictionary<String, ValueContainer<bool>> mDependencyValuesMap ~ DeleteDictionaryAndKeysAndItems!(_); Dictionary<String, ValueContainer<bool>> mDependencyValuesMap ~ DeleteDictionaryAndKeysAndValues!(_);
Project.Options[] mCurProjectOptions ~ delete _; Project.Options[] mCurProjectOptions ~ delete _;
float mLockFlashPct; float mLockFlashPct;
public int32 mNewDebugSessionCountdown; public int32 mNewDebugSessionCountdown;

View file

@ -162,7 +162,7 @@ namespace IDE.ui
public String mFileName ~ delete _; public String mFileName ~ delete _;
public String mBackupFileName ~ delete _; // Didn't match hash public String mBackupFileName ~ delete _; // Didn't match hash
public String mFoundPath ~ delete _; public String mFoundPath ~ delete _;
public Dictionary<String, String> mRemapMap = new .() ~ DeleteDictionaryAndKeysAndItems!(_); public Dictionary<String, String> mRemapMap = new .() ~ DeleteDictionaryAndKeysAndValues!(_);
public ~this() public ~this()
{ {