Skip to content

Commit af4605d

Browse files
committed
Start to commenting functions
1 parent 6eba7d9 commit af4605d

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

SubnetCalcAppDelegate.swift

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
1919
static let NETWORK_BITS_MIN:Int = 8
2020
static let NETWORK_BITS_MAX:Int = 32
2121
}
22-
22+
//*******************
2323
//General UI elements
24+
//*******************
2425
@IBOutlet var window: NSWindow!
2526
@IBOutlet var addrField: NSTextField!
2627
@IBOutlet var exportButton: NSPopUpButton!
2728
@IBOutlet var tabView: NSTabView!
2829
@IBOutlet var darkModeMenu: NSMenuItem!
2930
@IBOutlet var NSApp: NSApplication!
3031

32+
//****************
3133
//IPv4 UI elements
34+
//****************
3235
@IBOutlet var classBinaryMap: NSTextField!
3336
@IBOutlet var classBitMap: NSTextField!
3437
@IBOutlet var classHexaMap: NSTextField!
@@ -65,7 +68,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
6568
@IBOutlet var subnetNameVLSM: NSTextField!
6669
@IBOutlet var viewVLSM: NSTableView!
6770

71+
//****************
6872
//IPv6 UI elements
73+
//****************
6974
@IBOutlet var ipv6Address: NSTextField!
7075
@IBOutlet var ipv6to4Address: NSTextField!
7176
@IBOutlet var ipv6maskBitsCombo: NSComboBox!
@@ -80,14 +85,16 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
8085
@IBOutlet var ipv6Compact: NSButton!
8186
@IBOutlet var ipv6to4Box: NSBox!
8287

83-
88+
//*******************
8489
//Private global vars
90+
//*******************
8591
private var ipsc: IPSubnetCalc?
8692
private var subnetsVLSM = [(Int, String, String)]()
8793
private var globalMaskVLSM: UInt32!
8894

89-
95+
//**********************
9096
//Private IPv4 functions
97+
//**********************
9198
private func initCIDRTab() {
9299
for bits in (1...32) {
93100
supernetMaskBitsCombo.addItem(withObjectValue: String(bits))
@@ -388,7 +395,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
388395
}
389396
}
390397

398+
//**********************
391399
//Private IPv6 functions
400+
//**********************
392401
private func initIPv6Tab() {
393402
var total = Decimal()
394403
var number: Decimal = 2
@@ -485,8 +494,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
485494
}
486495
}
487496

488-
497+
//***************
489498
//IPv4 UI actions
499+
//***************
490500
@IBAction func changeAddrClassType(_ sender: AnyObject)
491501
{
492502
if (sender.indexOfSelectedItem() == 0)
@@ -776,8 +786,18 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
776786
return 0
777787
}
778788

779-
//Invoked when editing a value from a TabView
780-
//Used only for VLSM Subnet Name
789+
/**
790+
Invoked when editing a value from a TabView
791+
792+
Used only for VLSM Subnet Name
793+
794+
- Parameters:
795+
- tableView: NSTableView
796+
- object: new String value for the edited object
797+
- tableColumn: Optionnal Column
798+
- row: row index
799+
800+
*/
781801
func tableView(_ tableView: NSTableView, setObjectValue object: Any?, for tableColumn: NSTableColumn?, row: Int)
782802
{
783803
if (tableView == viewVLSM) {
@@ -788,7 +808,17 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
788808
}
789809
}
790810

791-
//Display all subnets info in the TableView Subnet/Hosts
811+
/**
812+
Display all subnets info in the TableView Subnet/Hosts
813+
814+
- Parameters:
815+
- tableView: NSTableView
816+
- tableColumn: Optionnal Column
817+
- row: row index
818+
819+
- Returns:
820+
Object to display for the correponding column and row
821+
*/
792822
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?,
793823
row: Int) -> Any?
794824
{
@@ -1043,7 +1073,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
10431073
self.doAddressMap()
10441074
}
10451075

1076+
//***************
10461077
//IPv6 UI actions
1078+
//***************
10471079
@IBAction func changeIPv6Format(_ sender: AnyObject)
10481080
{
10491081
self.doIPv6()
@@ -1091,7 +1123,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
10911123
}
10921124
}
10931125

1126+
//******************
10941127
//General UI actions
1128+
//******************
10951129
@IBAction func calc(_ sender: AnyObject)
10961130
{
10971131
if (addrField.stringValue.contains(":")) {

0 commit comments

Comments
 (0)