dash/contrib/auto_gdb/simple_class_obj.py
dustinface ae506bae66
refactor: PrivateSend -> CoinJoin + Move the tab (#4038)
* qt|wallet|privatesend: Rename PrivateSend to CoinJoin in GUI strings

* qt: Move CoinJoin next to Transactions

* qt: Adjust status tip of privateSendCoinsMenuAction

Co-authored-by: thephez <thephez@users.noreply.github.com>

* rename: privateSend -> coinJoin

* rename: privatesend -> coinjoin

* rename: PrivateSend -> CoinJoin

* rename: use_ps -> use_cj

* rename: PRIVATESEND -> COINJOIN

* rename: privatesend -> coinjoin for files and folders

* refactor: Re-order coinjoin files in cmake/make files

* refactor: Re-order coinjoin includes where it makes sense

* test: Update lint-circular-dependencies.sh

* Few cleanups

* test: test/coinjoin_tests.cpp -> wallet/test/coinjoin_test.cpp

* s/AdvancedPSUI/AdvancedCJUI/g

* s/privateSentAmountChanged/coinJoinAmountChanged/g

* wallet: Rename "ps_salt" backwards compatible

* Minimal PrivateSend -> CoinJoin migration for settings and cmd-line

* wallet: Fix privatesendrounds -> coinjoinrounds migration

* qt: Migrate nPrivateSendAmount -> nCoinJoinAmount

* `-coinjoindenoms` never existed

* Migrate all PS options/settings

* rpc: Formatting only

* qt: Make Send/CoinJoin tabs a bit more distinguishable

Co-authored-by: thephez <thephez@users.noreply.github.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2021-03-17 18:36:11 -04:00

55 lines
1.8 KiB
Python

#!/usr/bin/env python3
#
import sys
import os
import common_helpers
sys.path.append(os.getcwd())
simple_types = ["CMasternode", "CMasternodeVerification",
"CMasternodeBroadcast", "CMasternodePing",
"CMasternodeMan", "CDarksendQueue", "CDarkSendEntry",
"CTransaction", "CMutableTransaction", "CCoinJoinBaseSession",
"CCoinJoinBaseManager", "CCoinJoinClientSession",
"CCoinJoinClientManager", "CCoinJoinServer", "CMasternodePayments",
"CMasternodePaymentVote", "CMasternodeBlockPayees",
"CMasternodePayee", "CInstantSend", "CTxLockRequest",
"CTxLockVote", "CTxLockCandidate", "COutPoint",
"COutPointLock", "CSporkManager", "CMasternodeSync",
"CGovernanceManager", "CRateCheckBuffer", "CGovernanceObject",
"CGovernanceVote", "CGovernanceObjectVoteFile"]
simple_templates = ["CacheMultiMap", "CacheMap"]
class SimpleClassObj:
def __init__ (self, gobj):
self.obj = gobj
@classmethod
def is_this_type(cls, obj_type):
str_type = str(obj_type)
if str_type in simple_types:
return True
for templ in simple_templates:
if str_type.find(templ + "<") == 0:
return True
return False
def get_used_size(self):
size = 0
fields = self.obj.type.fields()
for f in fields:
# check if it is static field
if not hasattr(f, "bitpos"):
continue
# process base class size
if f.is_base_class:
size += common_helpers.get_instance_size(self.obj.cast(f.type.strip_typedefs()))
continue
# process simple field
size += common_helpers.get_instance_size(self.obj[f.name])
return size