aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/scheme
diff options
context:
space:
mode:
authorosado <osado@yandex-team.ru>2022-02-10 16:49:18 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:18 +0300
commit58cd0b86ed99a72df22479e26a20bc1c1e57e65e (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/scheme
parent3ed175181ceac225ee14e4519492ad2967a7bd73 (diff)
downloadydb-58cd0b86ed99a72df22479e26a20bc1c1e57e65e.tar.gz
Restoring authorship annotation for <osado@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/scheme')
-rw-r--r--library/cpp/scheme/scheme.h8
-rw-r--r--library/cpp/scheme/scimpl.h30
-rw-r--r--library/cpp/scheme/util/scheme_holder.cpp2
-rw-r--r--library/cpp/scheme/util/scheme_holder.h150
-rw-r--r--library/cpp/scheme/util/utils.cpp44
-rw-r--r--library/cpp/scheme/util/utils.h44
-rw-r--r--library/cpp/scheme/util/ya.make26
7 files changed, 152 insertions, 152 deletions
diff --git a/library/cpp/scheme/scheme.h b/library/cpp/scheme/scheme.h
index 5548ce4297..3d7c59f3c9 100644
--- a/library/cpp/scheme/scheme.h
+++ b/library/cpp/scheme/scheme.h
@@ -15,7 +15,7 @@ namespace NSc {
// todo: try to remove some rarely used methods
class TValue {
public:
- enum class EType {
+ enum class EType {
Null = 0 /* "Null" */,
Bool /* "Bool" */,
IntNumber /* "Int" */,
@@ -396,9 +396,9 @@ namespace NSc {
static const TArray& DefaultArray();
static const TDict& DefaultDict();
static const TValue& DefaultValue();
- static const TValue& Null() {
- return DefaultValue();
- }
+ static const TValue& Null() {
+ return DefaultValue();
+ }
void DoWriteJsonImpl(IOutputStream&, const TJsonOpts&, NImpl::TKeySortContext&, NImpl::TSelfLoopContext&) const;
diff --git a/library/cpp/scheme/scimpl.h b/library/cpp/scheme/scimpl.h
index b7aaa02592..4f68f16290 100644
--- a/library/cpp/scheme/scimpl.h
+++ b/library/cpp/scheme/scimpl.h
@@ -12,7 +12,7 @@ namespace NSc {
TStringBuf String;
TDict Dict;
TArray Array;
- TValue::EType ValueType = TValue::EType::Null;
+ TValue::EType ValueType = TValue::EType::Null;
TScCore(TPoolPtr& p)
: Pool(p)
@@ -22,31 +22,31 @@ namespace NSc {
}
bool IsNull() const {
- return TValue::EType::Null == ValueType;
+ return TValue::EType::Null == ValueType;
}
bool IsBool() const {
- return TValue::EType::Bool == ValueType;
+ return TValue::EType::Bool == ValueType;
}
bool IsIntNumber() const {
- return TValue::EType::IntNumber == ValueType || IsBool();
+ return TValue::EType::IntNumber == ValueType || IsBool();
}
bool IsNumber() const {
- return TValue::EType::FloatNumber == ValueType || IsIntNumber();
+ return TValue::EType::FloatNumber == ValueType || IsIntNumber();
}
bool IsString() const {
- return TValue::EType::String == ValueType;
+ return TValue::EType::String == ValueType;
}
bool IsArray() const {
- return TValue::EType::Array == ValueType;
+ return TValue::EType::Array == ValueType;
}
bool IsDict() const {
- return TValue::EType::Dict == ValueType;
+ return TValue::EType::Dict == ValueType;
}
bool HasChildren() const {
@@ -54,7 +54,7 @@ namespace NSc {
}
void SetNull() {
- ValueType = TValue::EType::Null;
+ ValueType = TValue::EType::Null;
}
void SetArray() {
@@ -62,7 +62,7 @@ namespace NSc {
return;
}
- ValueType = TValue::EType::Array;
+ ValueType = TValue::EType::Array;
Array.clear();
}
@@ -71,22 +71,22 @@ namespace NSc {
return;
}
- ValueType = TValue::EType::Dict;
+ ValueType = TValue::EType::Dict;
Dict.clear();
}
void SetNumber(double n) {
- ValueType = TValue::EType::FloatNumber;
+ ValueType = TValue::EType::FloatNumber;
FloatNumber = n;
}
void SetIntNumber(i64 n) {
- ValueType = TValue::EType::IntNumber;
+ ValueType = TValue::EType::IntNumber;
IntNumber = n;
}
void SetBool(bool b) {
- ValueType = TValue::EType::Bool;
+ ValueType = TValue::EType::Bool;
IntNumber = b;
}
@@ -95,7 +95,7 @@ namespace NSc {
}
void SetOwnedString(TStringBuf s) {
- ValueType = TValue::EType::String;
+ ValueType = TValue::EType::String;
String = s;
}
diff --git a/library/cpp/scheme/util/scheme_holder.cpp b/library/cpp/scheme/util/scheme_holder.cpp
index 30f32db09c..33232acc50 100644
--- a/library/cpp/scheme/util/scheme_holder.cpp
+++ b/library/cpp/scheme/util/scheme_holder.cpp
@@ -1 +1 @@
-#include "scheme_holder.h"
+#include "scheme_holder.h"
diff --git a/library/cpp/scheme/util/scheme_holder.h b/library/cpp/scheme/util/scheme_holder.h
index eae7e1fcc3..f2fa16d1cd 100644
--- a/library/cpp/scheme/util/scheme_holder.h
+++ b/library/cpp/scheme/util/scheme_holder.h
@@ -1,76 +1,76 @@
-#pragma once
-
+#pragma once
+
#include <library/cpp/scheme/scheme.h>
-
-
-// Scheme adapter that holds referenced value
-template <typename TScheme>
-class TSchemeHolder {
-public:
- TSchemeHolder()
- : Value_(NSc::Null())
- , Scheme_(&Value_)
- {
- }
-
- explicit TSchemeHolder(NSc::TValue&& value)
- : Value_(std::move(value))
- , Scheme_(&Value_)
- {
- }
-
- explicit TSchemeHolder(const NSc::TValue& value)
- : Value_(value)
- , Scheme_(&Value_)
- {
- }
-
- TSchemeHolder(TSchemeHolder<TScheme>&& rhs)
- : Value_(std::move(rhs.Value_))
- , Scheme_(&Value_)
- {
- }
-
- TSchemeHolder(const TSchemeHolder<TScheme>& rhs)
- : Value_(rhs.Value_)
- , Scheme_(&Value_)
- {
- }
-
- TSchemeHolder<TScheme>& operator=(TSchemeHolder<TScheme>&& rhs) {
- Value_ = std::move(rhs.Value_);
- return *this;
- }
- TSchemeHolder<TScheme>& operator=(const TSchemeHolder<TScheme>& rhs) {
- Value_ = rhs.Value_;
- return *this;
- }
-
- TScheme& Scheme() {
- return Scheme_;
- }
- const TScheme& Scheme() const {
- return Scheme_;
- }
- TScheme& operator->() {
- return Scheme_;
- }
- const TScheme& operator->() const {
- return Scheme_;
- }
-
- NSc::TValue& Value() {
- return Value_;
- }
- const NSc::TValue& Value() const {
- return Value_;
- }
-
- bool IsNull() const {
- return Value_.IsNull();
- }
-
-private:
- NSc::TValue Value_;
- TScheme Scheme_;
-};
+
+
+// Scheme adapter that holds referenced value
+template <typename TScheme>
+class TSchemeHolder {
+public:
+ TSchemeHolder()
+ : Value_(NSc::Null())
+ , Scheme_(&Value_)
+ {
+ }
+
+ explicit TSchemeHolder(NSc::TValue&& value)
+ : Value_(std::move(value))
+ , Scheme_(&Value_)
+ {
+ }
+
+ explicit TSchemeHolder(const NSc::TValue& value)
+ : Value_(value)
+ , Scheme_(&Value_)
+ {
+ }
+
+ TSchemeHolder(TSchemeHolder<TScheme>&& rhs)
+ : Value_(std::move(rhs.Value_))
+ , Scheme_(&Value_)
+ {
+ }
+
+ TSchemeHolder(const TSchemeHolder<TScheme>& rhs)
+ : Value_(rhs.Value_)
+ , Scheme_(&Value_)
+ {
+ }
+
+ TSchemeHolder<TScheme>& operator=(TSchemeHolder<TScheme>&& rhs) {
+ Value_ = std::move(rhs.Value_);
+ return *this;
+ }
+ TSchemeHolder<TScheme>& operator=(const TSchemeHolder<TScheme>& rhs) {
+ Value_ = rhs.Value_;
+ return *this;
+ }
+
+ TScheme& Scheme() {
+ return Scheme_;
+ }
+ const TScheme& Scheme() const {
+ return Scheme_;
+ }
+ TScheme& operator->() {
+ return Scheme_;
+ }
+ const TScheme& operator->() const {
+ return Scheme_;
+ }
+
+ NSc::TValue& Value() {
+ return Value_;
+ }
+ const NSc::TValue& Value() const {
+ return Value_;
+ }
+
+ bool IsNull() const {
+ return Value_.IsNull();
+ }
+
+private:
+ NSc::TValue Value_;
+ TScheme Scheme_;
+};
diff --git a/library/cpp/scheme/util/utils.cpp b/library/cpp/scheme/util/utils.cpp
index 202a9e3166..40cceceacd 100644
--- a/library/cpp/scheme/util/utils.cpp
+++ b/library/cpp/scheme/util/utils.cpp
@@ -1,23 +1,23 @@
-#include "utils.h"
-
+#include "utils.h"
+
#include <library/cpp/string_utils/base64/base64.h>
-
-namespace NScUtils {
-
-void CopyField(const NSc::TValue& from, NSc::TValue& to) {
- to = from;
-}
-
-} // namespace NScUtils
-
-void TSerializer<NSc::TValue>::Save(IOutputStream* out, const NSc::TValue& v) {
- TString json = Base64Encode(v.ToJson());
- ::Save(out, json);
-}
-
-void TSerializer<NSc::TValue>::Load(IInputStream* in, NSc::TValue& v) {
- TString json;
- ::Load(in, json);
- json = Base64Decode(json);
- v = NSc::TValue::FromJsonThrow(json);
-}
+
+namespace NScUtils {
+
+void CopyField(const NSc::TValue& from, NSc::TValue& to) {
+ to = from;
+}
+
+} // namespace NScUtils
+
+void TSerializer<NSc::TValue>::Save(IOutputStream* out, const NSc::TValue& v) {
+ TString json = Base64Encode(v.ToJson());
+ ::Save(out, json);
+}
+
+void TSerializer<NSc::TValue>::Load(IInputStream* in, NSc::TValue& v) {
+ TString json;
+ ::Load(in, json);
+ json = Base64Decode(json);
+ v = NSc::TValue::FromJsonThrow(json);
+}
diff --git a/library/cpp/scheme/util/utils.h b/library/cpp/scheme/util/utils.h
index 6613215305..f7d666f67a 100644
--- a/library/cpp/scheme/util/utils.h
+++ b/library/cpp/scheme/util/utils.h
@@ -1,23 +1,23 @@
-#pragma once
-
+#pragma once
+
#include <library/cpp/scheme/scheme.h>
-
-#include <util/generic/strbuf.h>
-#include <util/ysaveload.h>
-
-namespace NScUtils {
-
-void CopyField(const NSc::TValue& from, NSc::TValue& to);
-
-template <typename... Args>
-void CopyField(const NSc::TValue& from, NSc::TValue& to, TStringBuf path, Args... args) {
- CopyField(from[path], to[path], args...);
-}
-
-} // namespace NScUtils
-
-template<>
-struct TSerializer<NSc::TValue> {
- static void Save(IOutputStream* out, const NSc::TValue& v);
- static void Load(IInputStream* in, NSc::TValue& v);
-};
+
+#include <util/generic/strbuf.h>
+#include <util/ysaveload.h>
+
+namespace NScUtils {
+
+void CopyField(const NSc::TValue& from, NSc::TValue& to);
+
+template <typename... Args>
+void CopyField(const NSc::TValue& from, NSc::TValue& to, TStringBuf path, Args... args) {
+ CopyField(from[path], to[path], args...);
+}
+
+} // namespace NScUtils
+
+template<>
+struct TSerializer<NSc::TValue> {
+ static void Save(IOutputStream* out, const NSc::TValue& v);
+ static void Load(IInputStream* in, NSc::TValue& v);
+};
diff --git a/library/cpp/scheme/util/ya.make b/library/cpp/scheme/util/ya.make
index e2f71e9bfa..dffd1c8070 100644
--- a/library/cpp/scheme/util/ya.make
+++ b/library/cpp/scheme/util/ya.make
@@ -1,14 +1,14 @@
-LIBRARY()
-
-OWNER(g:cards_serivce)
-
-SRCS(
- scheme_holder.cpp
- utils.cpp
-)
-
-PEERDIR(
+LIBRARY()
+
+OWNER(g:cards_serivce)
+
+SRCS(
+ scheme_holder.cpp
+ utils.cpp
+)
+
+PEERDIR(
library/cpp/string_utils/base64
-)
-
-END()
+)
+
+END()