Skip to content

Commit

Permalink
Wrap FLValue_NewString and FLValue_NewData in the C++ API
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Jun 6, 2024
1 parent 333c3e0 commit b2adeee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions API/fleece/Mutable.hh
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ namespace fleece {
RetainedValue(MutableDict &&v) noexcept :Value(v) {v._val = nullptr;}
~RetainedValue() {FLValue_Release(_val);}

static RetainedValue newString(slice s) {return RetainedValue(FLValue_NewString(s), false);}
static RetainedValue newData(slice d) {return RetainedValue(FLValue_NewData(d), false);}

RetainedValue& operator= (const Value &v) & {
FLValue_Retain(v);
FLValue_Release(_val);
Expand All @@ -256,6 +259,9 @@ namespace fleece {
_val = nullptr;
return *this;
}

private:
RetainedValue(FLValue v, bool) :Value(v) { }
};

// NOTE: The RetainedArray and RetainedDict classes are copycats of the RetainedValue class
Expand Down

0 comments on commit b2adeee

Please sign in to comment.