aboutsummaryrefslogtreecommitdiffstats
path: root/c_ldirs.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-11 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-11 20:20:20 +0100
commit5cf98e006814a1afc625ac25269d710d9991e6dc (patch)
treed07bf9ea44752165f225144acb630abdcf8451ce /c_ldirs.go
parentcool (diff)
downloadhardflip-5cf98e006814a1afc625ac25269d710d9991e6dc.tar.gz
hardflip-5cf98e006814a1afc625ac25269d710d9991e6dc.tar.bz2
hardflip-5cf98e006814a1afc625ac25269d710d9991e6dc.tar.xz
hardflip-5cf98e006814a1afc625ac25269d710d9991e6dc.tar.zst
hardflip-5cf98e006814a1afc625ac25269d710d9991e6dc.zip
ok ye
Diffstat (limited to 'c_ldirs.go')
-rw-r--r--c_ldirs.go60
1 files changed, 37 insertions, 23 deletions
diff --git a/c_ldirs.go b/c_ldirs.go
index 1a4157c..3de40e5 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_ldirs.go
- * Tue Jan 09 12:06:44 2024
+ * Thu Jan 11 18:35:31 2024
* Joe
*
* the directories linked list
@@ -51,8 +51,6 @@
package main
-import "fmt"
-
type DirsNode struct {
ID int
Name string
@@ -148,6 +146,18 @@ func (dir *DirsNode) path() string {
return path
}
+// returns the next directory in line with the same or lower depth
+func (dir *DirsNode) get_next_level(folds map[*DirsNode]*ItemsList) *DirsNode {
+ if dir == nil {
+ return nil
+ }
+ ptr := dir.next
+ for ptr != nil && ptr.Depth > dir.Depth {
+ ptr = ptr.next
+ }
+ return ptr
+}
+
// returns the number of hosts of the dir
func (dir *DirsNode) count_hosts() int {
if dir.lhost.head == nil || dir.lhost.last == nil {
@@ -155,24 +165,28 @@ func (dir *DirsNode) count_hosts() int {
}
return dir.lhost.last.ID + 1
}
-
// return the number of hosts and subfolders of the dir
-func (dir *DirsNode) count_elements(skip_folds bool,
- folds map[*DirsNode]*ItemsList) int {
- items := 0
-
- items += dir.count_hosts()
- for ptr := dir.next; ptr != nil && ptr.Depth > dir.Depth; ptr = ptr.next {
- if lfold := folds[ptr]; skip_folds == true && lfold != nil {
- count := lfold.last.ID - lfold.head.ID
- fmt.Println(count)
- // FIX: here
- for i := 1; ptr != nil && i < count; i++ {
- ptr = ptr.next
- }
- } else {
- items += ptr.count_hosts() + 1
- }
- }
- return items
-}
+// func (item *ItemsNode) count_elements(skip_folds bool,
+// folds map[*DirsNode]*ItemsList) (*ItemsNode, int) {
+// if item.is_dir() == false || item.Dirs == nil {
+// return nil, 0
+// }
+// items := 0
+//
+// items += item.Dirs.count_hosts()
+// for ptr := item; ptr != nil; ptr = ptr.next {
+// ptr.Dirs.Depth > item.Dirs.Depth
+// }
+// for ptr := dir.next; ptr != nil && ptr.Depth > dir.Depth; ptr = ptr.next {
+// if lfold := folds[ptr]; skip_folds == true && lfold != nil {
+// count := lfold.last.ID - lfold.head.ID
+// for i := 0; ptr != nil && i < count; i++ {
+// ptr = ptr.next
+// }
+// } else {
+// items += ptr.count_hosts() + 1
+// }
+// }
+// return items
+// // FIX: this needs fixin
+// }