Skip to content

Commit 7268e53

Browse files
committed
resolved merge conflict
2 parents ab2cab7 + 0d1a93f commit 7268e53

File tree

21 files changed

+816
-175
lines changed

21 files changed

+816
-175
lines changed

.github/workflows/cpp-packaging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ jobs:
194194
strategy:
195195
fail-fast: false
196196
matrix:
197-
stl: ["c++", "gnustl", "stlport"]
197+
stl: ["c++", "gnustl"]
198198
steps:
199199
- name: fetch SDK
200200
uses: actions/[email protected]

.github/workflows/integration_tests.yml

Lines changed: 121 additions & 69 deletions
Large diffs are not rendered by default.

app/src/include/firebase/app.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ namespace internal {
5555
class AppInternal;
5656
} // namespace internal
5757

58-
#ifdef _STLPORT_VERSION
59-
#warning "Firebase support for STLPort is deprecated and will be removed in \
60-
the next major release. Please use libc++ instead."
58+
#if FIREBASE_PLATFORM_ANDROID && defined(__GLIBCXX__)
59+
#warning "Firebase support for gnustl is deprecated and will be removed in \
60+
the next major release. Please use libc++ instead."
6161
#endif
6262
6363
/// @brief Reports whether a Firebase module initialized successfully.

build_scripts/android/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sourcepath=$2
55
stl=$3
66

77
if [[ -z "${buildpath}" || -z "${sourcepath}" ]]; then
8-
echo "Usage: $0 <build path> <source path> [c++|gnustl|stlport]"
8+
echo "Usage: $0 <build path> <source path> [c++|gnustl]"
99
exit 1
1010
fi
1111

@@ -14,11 +14,11 @@ if [[ ! -d "${sourcepath}" ]]; then
1414
exit 2
1515
fi
1616

17-
if [[ "${stl}" == "c++" || "${stl}" == "gnustl" || "${stl}" == "stlport" ]]; then
17+
if [[ "${stl}" == "c++" || "${stl}" == "gnustl" ]]; then
1818
export FIREBASE_ANDROID_STL="${stl}"_static
1919
elif [[ ! -z "${stl}" ]]; then
2020
echo "Invalid STL specified."
21-
echo "Valid STLs are: 'c++' (default), 'gnustl', or 'stlport'"
21+
echo "Valid STLs are: 'c++' (default) or 'gnustl'"
2222
exit 2
2323
fi
2424

build_scripts/android/package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22

3-
readonly -a allowed_stl_variants=("c++" "gnustl" "stlport")
3+
readonly -a allowed_stl_variants=("c++" "gnustl")
44
builtpath=$1
55
packagepath=$2
66
stl=$3

build_scripts/desktop/get_variant.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ for c in $(echo "${filename}" | tr "[:upper:]" "[:lower:]" | tr "_.-" "\n\n\n");
125125
gnustl)
126126
stl=gnustl
127127
;;
128-
stlport)
129-
stl=stlport
130-
;;
131128
cxx11)
132129
linux_abi=cxx11
133130
;;

database/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ else()
170170
${UWEBSOCKETS_SOURCE_DIR}/..)
171171

172172
set(additional_link_LIB
173-
flatbuffers
174173
firebase_rest_lib
175174
leveldb
176175
libuWS

database/src/common/query_spec.h

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define FIREBASE_DATABASE_CLIENT_CPP_SRC_COMMON_QUERY_SPEC_H_
1717

1818
#include "app/src/include/firebase/variant.h"
19+
#include "app/src/optional.h"
1920
#include "app/src/path.h"
2021

2122
namespace firebase {
@@ -43,6 +44,18 @@ struct QueryParams {
4344
limit_first == other.limit_first && limit_last == other.limit_last;
4445
}
4546

47+
template <typename T>
48+
int OptionalCmp(const Optional<T>& a, const Optional<T>& b) const {
49+
if (a.has_value() && b.has_value()) {
50+
if (*a < *b) return -1;
51+
if (*a > *b) return 1;
52+
return 0;
53+
}
54+
if (!a.has_value() && b.has_value()) return -1;
55+
if (a.has_value() && !b.has_value()) return 1;
56+
return 0;
57+
}
58+
4659
// Less-than operator, required so we can place QuerySpec instances in an
4760
// std::map. This is an arbitrary operation, but must be consistent.
4861
bool operator<(const QueryParams& other) const {
@@ -52,18 +65,32 @@ struct QueryParams {
5265
if (order_by_child < other.order_by_child) return true;
5366
if (order_by_child > other.order_by_child) return false;
5467
}
55-
if (start_at_value < other.start_at_value) return true;
56-
if (start_at_value > other.start_at_value) return false;
57-
if (start_at_child_key < other.start_at_child_key) return true;
58-
if (start_at_child_key > other.start_at_child_key) return false;
59-
if (end_at_value < other.end_at_value) return true;
60-
if (end_at_value > other.end_at_value) return false;
61-
if (end_at_child_key < other.end_at_child_key) return true;
62-
if (end_at_child_key > other.end_at_child_key) return false;
63-
if (equal_to_value < other.equal_to_value) return true;
64-
if (equal_to_value > other.equal_to_value) return false;
65-
if (equal_to_child_key < other.equal_to_child_key) return true;
66-
if (equal_to_child_key > other.equal_to_child_key) return false;
68+
// clang-format off
69+
switch (OptionalCmp(start_at_value, other.start_at_value)) {
70+
case -1: return true;
71+
case 1: return false;
72+
}
73+
switch (OptionalCmp(start_at_child_key, other.start_at_child_key)) {
74+
case -1: return true;
75+
case 1: return false;
76+
}
77+
switch (OptionalCmp(end_at_value, other.end_at_value)) {
78+
case -1: return true;
79+
case 1: return false;
80+
}
81+
switch (OptionalCmp(end_at_child_key, other.end_at_child_key)) {
82+
case -1: return true;
83+
case 1: return false;
84+
}
85+
switch (OptionalCmp(equal_to_value, other.equal_to_value)) {
86+
case -1: return true;
87+
case 1: return false;
88+
}
89+
switch (OptionalCmp(equal_to_child_key, other.equal_to_child_key)) {
90+
case -1: return true;
91+
case 1: return false;
92+
}
93+
// clang-format on
6794
if (limit_first < other.limit_first) return true;
6895
if (limit_first > other.limit_first) return false;
6996
if (limit_last < other.limit_last) return true;
@@ -82,19 +109,19 @@ struct QueryParams {
82109
std::string order_by_child;
83110

84111
// Set by Query::StartAt(). Variant::Null() if unspecified.
85-
Variant start_at_value;
112+
Optional<Variant> start_at_value;
86113
// Set by Query::StartAt() with child specified. Blank if unspecified.
87-
std::string start_at_child_key;
114+
Optional<std::string> start_at_child_key;
88115

89116
// Set by Query::EndAt(). Variant::Null() if unspecified.
90-
Variant end_at_value;
117+
Optional<Variant> end_at_value;
91118
// Set by Query::EndAt() with child specified. Blank if unspecified.
92-
std::string end_at_child_key;
119+
Optional<std::string> end_at_child_key;
93120

94121
// Set by Query::EqualTo(). Variant::Null() if unspecified.
95-
Variant equal_to_value;
122+
Optional<Variant> equal_to_value;
96123
// Set by Query::EqualTo() with child specified. Blank if unspecified.
97-
std::string equal_to_child_key;
124+
Optional<std::string> equal_to_child_key;
98125

99126
// Set by Query::LimitToFirst(). 0 means no limit.
100127
size_t limit_first;

database/src/desktop/persistence/flatbuffer_conversions.cc

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,25 @@ Offset<persistence::PersistedQueryParams> FlatbufferFromQueryParams(
258258
return CreatePersistedQueryParams(
259259
*builder, static_cast<persistence::OrderBy>(params.order_by),
260260
builder->CreateString(params.order_by_child),
261-
builder->CreateVector(VariantToFlexbuffer(params.start_at_value)),
262-
builder->CreateString(params.start_at_child_key),
263-
builder->CreateVector(VariantToFlexbuffer(params.end_at_value)),
264-
builder->CreateString(params.end_at_child_key),
265-
builder->CreateVector(VariantToFlexbuffer(params.equal_to_value)),
266-
builder->CreateString(params.equal_to_child_key), params.limit_first,
267-
params.limit_last);
261+
params.start_at_value.has_value()
262+
? builder->CreateVector(VariantToFlexbuffer(*params.start_at_value))
263+
: 0,
264+
params.start_at_child_key.has_value()
265+
? builder->CreateString(params.start_at_child_key->c_str())
266+
: 0,
267+
params.end_at_value.has_value()
268+
? builder->CreateVector(VariantToFlexbuffer(*params.end_at_value))
269+
: 0,
270+
params.end_at_child_key.has_value()
271+
? builder->CreateString(params.end_at_child_key->c_str())
272+
: 0,
273+
params.equal_to_value.has_value()
274+
? builder->CreateVector(VariantToFlexbuffer(*params.equal_to_value))
275+
: 0,
276+
params.equal_to_child_key.has_value()
277+
? builder->CreateString(params.equal_to_child_key->c_str())
278+
: 0,
279+
params.limit_first, params.limit_last);
268280
}
269281

270282
Offset<persistence::PersistedQuerySpec> FlatbufferFromQuerySpec(

database/src/desktop/query_desktop.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ QueryInternal* QueryInternal::StartAt(const Variant& value,
358358
}
359359
return nullptr;
360360
}
361-
FIREBASE_ASSERT_RETURN(nullptr, child_key != nullptr);
362361
QuerySpec spec = query_spec_;
363362
spec.params.start_at_value = value;
364-
spec.params.start_at_child_key = child_key;
363+
spec.params.start_at_child_key =
364+
child_key ? Optional<std::string>(child_key) : Optional<std::string>();
365365
if (!ValidateQueryEndpoints(spec.params, logger)) {
366366
return nullptr;
367367
}
@@ -407,10 +407,10 @@ QueryInternal* QueryInternal::EndAt(const Variant& value,
407407
}
408408
return nullptr;
409409
}
410-
FIREBASE_ASSERT_RETURN(nullptr, child_key != nullptr);
411410
QuerySpec spec = query_spec_;
412411
spec.params.end_at_value = value;
413-
spec.params.end_at_child_key = child_key;
412+
spec.params.end_at_child_key =
413+
child_key ? Optional<std::string>(child_key) : Optional<std::string>();
414414
if (!ValidateQueryEndpoints(spec.params, logger)) {
415415
return nullptr;
416416
}
@@ -452,7 +452,8 @@ QueryInternal* QueryInternal::EqualTo(const Variant& value,
452452
}
453453
QuerySpec spec = query_spec_;
454454
spec.params.equal_to_value = value;
455-
spec.params.equal_to_child_key = child_key;
455+
spec.params.equal_to_child_key =
456+
child_key ? Optional<std::string>(child_key) : Optional<std::string>();
456457
if (!ValidateQueryEndpoints(spec.params, logger)) {
457458
return nullptr;
458459
}

0 commit comments

Comments
 (0)