summaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/dom/node.cpp
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-10-09 12:25:18 +0300
committervvvv <[email protected]>2025-10-09 12:57:17 +0300
commitcb77d014972b2cdb27d2e6d979fc3a2772b27ad4 (patch)
tree7f3bcd8ce71c6bd0f3ccc11e31b9f665475b819e /yql/essentials/minikql/dom/node.cpp
parentd58a8990d353b051c27e1069141117fdfde64358 (diff)
YQL-20086 minikql
commit_hash:e96f7390db5fcbe7e9f64f898141a263ad522daa
Diffstat (limited to 'yql/essentials/minikql/dom/node.cpp')
-rw-r--r--yql/essentials/minikql/dom/node.cpp54
1 files changed, 34 insertions, 20 deletions
diff --git a/yql/essentials/minikql/dom/node.cpp b/yql/essentials/minikql/dom/node.cpp
index 2f04bf59173..d0ca43414b4 100644
--- a/yql/essentials/minikql/dom/node.cpp
+++ b/yql/essentials/minikql/dom/node.cpp
@@ -18,13 +18,14 @@ inline bool StringEquals(const TPair& x, const TPair& y) {
return x.first.AsStringRef() == y.first.AsStringRef();
}
-}
+} // namespace
template <bool NoSwap>
TMapNode::TIterator<NoSwap>::TIterator(const TMapNode* parent)
: Parent_(const_cast<TMapNode*>(parent))
, Index_(-1)
-{}
+{
+}
template <bool NoSwap>
bool TMapNode::TIterator<NoSwap>::Skip() {
@@ -38,8 +39,9 @@ bool TMapNode::TIterator<NoSwap>::Skip() {
template <bool NoSwap>
bool TMapNode::TIterator<NoSwap>::Next(TUnboxedValue& key) {
- if (!Skip())
+ if (!Skip()) {
return false;
+ }
if constexpr (NoSwap) {
key = Parent_->Items_[Index_].first;
} else {
@@ -50,8 +52,9 @@ bool TMapNode::TIterator<NoSwap>::Next(TUnboxedValue& key) {
template <bool NoSwap>
bool TMapNode::TIterator<NoSwap>::NextPair(TUnboxedValue& key, TUnboxedValue& payload) {
- if (!Next(key))
+ if (!Next(key)) {
return false;
+ }
if constexpr (NoSwap) {
payload = Parent_->Items_[Index_].second;
} else {
@@ -61,7 +64,9 @@ bool TMapNode::TIterator<NoSwap>::NextPair(TUnboxedValue& key, TUnboxedValue& pa
}
TMapNode::TMapNode(TMapNode&& src)
- : Count_(src.Count_), UniqueCount_(src.UniqueCount_), Items_(src.Items_)
+ : Count_(src.Count_)
+ , UniqueCount_(src.UniqueCount_)
+ , Items_(src.Items_)
{
src.Count_ = src.UniqueCount_ = 0U;
src.Items_ = nullptr;
@@ -119,8 +124,9 @@ TUnboxedValue TMapNode::Lookup(const TUnboxedValuePod& key) const {
TUnboxedValue TMapNode::Lookup(const TStringRef& key) const {
const auto it = LowerBound(Items_, Items_ + UniqueCount_, key, StringRefLess);
- if (it == Items_ + UniqueCount_ || static_cast<TStringBuf>(it->first.AsStringRef()) != static_cast<TStringBuf>(key))
+ if (it == Items_ + UniqueCount_ || static_cast<TStringBuf>(it->first.AsStringRef()) != static_cast<TStringBuf>(key)) {
return {};
+ }
return it->second;
}
@@ -142,12 +148,16 @@ void* TMapNode::GetResource() {
}
TAttrNode::TAttrNode(const TUnboxedValue& map, TUnboxedValue&& value)
- : TMapNode(std::move(*static_cast<TMapNode*>(map.AsBoxed().Get()))), Value_(std::move(value))
-{}
+ : TMapNode(std::move(*static_cast<TMapNode*>(map.AsBoxed().Get())))
+ , Value_(std::move(value))
+{
+}
TAttrNode::TAttrNode(TUnboxedValue&& value, const TPair* items, ui32 count)
- : TMapNode(items, count), Value_(std::move(value))
-{}
+ : TMapNode(items, count)
+ , Value_(std::move(value))
+{
+}
TUnboxedValue TAttrNode::GetVariantItem() const {
return Value_;
@@ -155,9 +165,10 @@ TUnboxedValue TAttrNode::GetVariantItem() const {
TDebugPrinter::TDebugPrinter(const TUnboxedValuePod& node)
: Node(node)
-{}
+{
+}
-IOutputStream& TDebugPrinter::Out(IOutputStream &o) const {
+IOutputStream& TDebugPrinter::Out(IOutputStream& o) const {
switch (GetNodeType(Node)) {
case ENodeType::Entity:
o << "entity (#)";
@@ -175,24 +186,27 @@ IOutputStream& TDebugPrinter::Out(IOutputStream &o) const {
o << "floating point (" << Node.Get<double>() << ") value";
break;
case ENodeType::String:
- if (const std::string_view str(Node.AsStringRef()); str.empty())
+ if (const std::string_view str(Node.AsStringRef()); str.empty()) {
o << "empty string";
- else if(Node.IsEmbedded() && str.cend() == std::find_if(str.cbegin(), str.cend(), [](char c){ return !std::isprint(c); }))
+ } else if (Node.IsEmbedded() && str.cend() == std::find_if(str.cbegin(), str.cend(), [](char c) { return !std::isprint(c); })) {
o << "string '" << str << "' value";
- else
+ } else {
o << "string value of size " << str.size();
+ }
break;
case ENodeType::List:
- if (Node.IsBoxed())
+ if (Node.IsBoxed()) {
o << "list of size " << Node.GetListLength();
- else
+ } else {
o << "empty list";
+ }
break;
case ENodeType::Dict:
- if (Node.IsBoxed())
+ if (Node.IsBoxed()) {
o << "dict of size " << Node.GetDictLength();
- else
+ } else {
o << "empty dict";
+ }
break;
case ENodeType::Attr:
return TDebugPrinter(Node.GetVariantItem()).Out(o);
@@ -203,4 +217,4 @@ IOutputStream& TDebugPrinter::Out(IOutputStream &o) const {
return o;
}
-}
+} // namespace NYql::NDom