由于std::shared_ptr
对象的Gtk::Builder
对象是受保护的,而用于对象创建的静态方法却返回Glib::RefPtr<Gtk::Builder>
,如何为std::shared_ptr<Gtk::Builder> builder;
builder = std::make_shared<Gtk::Builder>();
对象创建const SUNDAY_DAY_NUMBER = 0;
const SATURDAY_DAY_NUMBER = 6;
/**
* @example
* const dateQuery = getDateQueryForCurrentWeek();
* const matchObject = { CREATED_ON: dateQuery };
* const findResult = db.getCollection('collection').aggregate([{ $match: matchObject }]).toArray();
*/
const getDateQueryForCurrentWeek = () => {
const now = new Date();
const numDaysToBeginningOfWeek = SUNDAY_DAY_NUMBER - now.getDay();
const numDaysToEndOfWeek = SATURDAY_DAY_NUMBER - now.getDay();
const firstDayOfCurrentWeek = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + numDaysToBeginningOfWeek,
0,
0,
0,
0
);
const lastDayOfCurrentWeek = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + numDaysToEndOfWeek,
24,
0,
0,
-1
);
const query = {
$gte: firstDayOfCurrentWeek,
$lte: lastDayOfCurrentWeek
};
return query;
};
?
它不起作用:
{{1}}