MCPcopy Create free account
hub / github.com/bloomberg/pystack / formatSequence

Function formatSequence

src/pystack/_pystack/pytypes.cpp:46–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46std::string
47formatSequence(
48 const std::vector<remote_addr_t>& items,
49 const std::shared_ptr<const AbstractProcessManager>& manager,
50 ssize_t max_size)
51{
52 std::vector<std::string> elements;
53 elements.reserve(items.size());
54 ssize_t remaining_size = max_size;
55 for (auto& item : items) {
56 LOG(DEBUG) << "Constructing sequence object " << elements.size()
57 << " from addr: " << std::showbase << std::hex << item;
58 std::string item_str = Object(manager, item).toString(remaining_size);
59 remaining_size -= item_str.size() + 2;
60 if (remaining_size < (ssize_t)(ELLIPSIS.size() + 2)) {
61 elements.push_back(ELLIPSIS);
62 break;
63 }
64 elements.push_back(item_str);
65 }
66 return join(elements, ", ");
67}
68
69static inline bool
70containsOnlyASCII(const std::string& val)

Callers 1

toStringMethod · 0.85

Calls 5

LOGClass · 0.85
ObjectClass · 0.85
joinFunction · 0.85
sizeMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected