Skip to content

Commit 0e9fb34

Browse files
committed
chore: move internal functions to anonymous namespace
1 parent da8d60a commit 0e9fb34

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

google/cloud/bigtable/value.cc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,14 @@ std::ostream& operator<<(std::ostream& os, Value const& v) {
339339
return StreamHelper(os, v.value_, v.type_, StreamMode::kScalar);
340340
}
341341

342-
Status Value::MakeDepthExceededError() {
342+
Status MakeDepthExceededError() {
343343
return internal::InternalError("Nested value depth exceeds 10 levels");
344344
}
345345

346346
// NOLINTNEXTLINE(misc-no-recursion)
347-
Status Value::TypeAndArrayValuesMatch(google::bigtable::v2::Type const& type,
348-
google::bigtable::v2::Value const& value,
349-
int depth) {
347+
Status TypeAndArrayValuesMatch(google::bigtable::v2::Type const& type,
348+
google::bigtable::v2::Value const& value,
349+
int depth) {
350350
if (depth > 10) {
351351
return MakeDepthExceededError();
352352
}
@@ -356,8 +356,8 @@ Status Value::TypeAndArrayValuesMatch(google::bigtable::v2::Type const& type,
356356
}
357357
auto const& vals = value.array_value().values();
358358
for (auto const& val : vals) {
359-
auto const element_match_result =
360-
TypeAndValuesMatch(type.array_type().element_type(), val, depth + 1);
359+
auto const element_match_result = Value::TypeAndValuesMatch(
360+
type.array_type().element_type(), val, depth + 1);
361361
if (!element_match_result.ok()) {
362362
return element_match_result;
363363
}
@@ -366,9 +366,9 @@ Status Value::TypeAndArrayValuesMatch(google::bigtable::v2::Type const& type,
366366
}
367367

368368
// NOLINTNEXTLINE(misc-no-recursion)
369-
Status Value::TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
370-
google::bigtable::v2::Value const& value,
371-
int depth) {
369+
Status TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
370+
google::bigtable::v2::Value const& value,
371+
int depth) {
372372
if (depth > 10) {
373373
return MakeDepthExceededError();
374374
}
@@ -387,13 +387,14 @@ Status Value::TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
387387
auto map_key = val.array_value().values(0);
388388
auto map_value = val.array_value().values(1);
389389
// NOLINTNEXTLINE(misc-no-recursion)
390-
auto key_match_result = TypeAndValuesMatch(key_type, map_key, depth + 1);
390+
auto key_match_result =
391+
Value::TypeAndValuesMatch(key_type, map_key, depth + 1);
391392
if (!key_match_result.ok()) {
392393
return key_match_result;
393394
}
394395
// NOLINTNEXTLINE(misc-no-recursion)
395396
auto value_match_result =
396-
TypeAndValuesMatch(value_type, map_value, depth + 1);
397+
Value::TypeAndValuesMatch(value_type, map_value, depth + 1);
397398
if (!value_match_result.ok()) {
398399
return value_match_result;
399400
}
@@ -402,9 +403,9 @@ Status Value::TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
402403
}
403404

404405
// NOLINTNEXTLINE(misc-no-recursion)
405-
Status Value::TypeAndStructValuesMatch(google::bigtable::v2::Type const& type,
406-
google::bigtable::v2::Value const& value,
407-
int depth) {
406+
Status TypeAndStructValuesMatch(google::bigtable::v2::Type const& type,
407+
google::bigtable::v2::Value const& value,
408+
int depth) {
408409
if (depth > 10) {
409410
return MakeDepthExceededError();
410411
}
@@ -423,7 +424,7 @@ Status Value::TypeAndStructValuesMatch(google::bigtable::v2::Type const& type,
423424
for (int i = 0; i < fields.size(); ++i) {
424425
auto const& f1 = fields.Get(i);
425426
auto const& v = values[i];
426-
auto match_result = TypeAndValuesMatch(f1.type(), v, depth + 1);
427+
auto match_result = Value::TypeAndValuesMatch(f1.type(), v, depth + 1);
427428
if (!match_result.ok()) {
428429
return match_result;
429430
}

google/cloud/bigtable/value.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -315,26 +315,11 @@ class Value {
315315
return value.kind_case() == google::bigtable::v2::Value::KIND_NOT_SET;
316316
}
317317

318-
static Status TypeAndValuesMatch(google::bigtable::v2::Type const& type,
319-
google::bigtable::v2::Value const& value) {
320-
return TypeAndValuesMatch(type, value, 1);
321-
}
322-
323-
private:
324-
static Status MakeDepthExceededError();
325318
static Status TypeAndValuesMatch(google::bigtable::v2::Type const& type,
326319
google::bigtable::v2::Value const& value,
327-
int depth);
328-
static Status TypeAndArrayValuesMatch(
329-
google::bigtable::v2::Type const& type,
330-
google::bigtable::v2::Value const& value, int depth);
331-
static Status TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
332-
google::bigtable::v2::Value const& value,
333-
int depth);
334-
static Status TypeAndStructValuesMatch(
335-
google::bigtable::v2::Type const& type,
336-
google::bigtable::v2::Value const& value, int depth);
320+
int depth = 1);
337321

322+
private:
338323
// Metafunction that returns true if `T` is an `absl::optional<U>`
339324
template <typename T>
340325
struct IsOptional : std::false_type {};

0 commit comments

Comments
 (0)