Lines Matching refs:std
65 LOG_DEBUG("startTime :%{private}s", std::to_string(event.startTime).c_str());
66 LOG_DEBUG("endTime :%{private}s", std::to_string(event.endTime).c_str());
89 valuesBucket.Put("location_longitude", std::to_string(location.longitude.value()));
93 valuesBucket.Put("location_latitude", std::to_string(location.latitude.value()));
110 std::string GetUTCTime(const int64_t &timeValue)
116 std::tm expireTime = {0};
124 std::stringstream out;
126 out << std::setfill('0') << std::setw(strLen) << expireTime.tm_mon + monOffset;
127 out << std::setfill('0') << std::setw(strLen) << expireTime.tm_mday;
129 out << std::setfill('0') << std::setw(strLen) << expireTime.tm_hour;
130 out << std::setfill('0') << std::setw(strLen) << expireTime.tm_min;
131 out << std::setfill('0') << std::setw(strLen) << expireTime.tm_sec;
137 std::string GetUTCTimes(const std::vector<int64_t> &timeValues)
139 std::stringstream out;
160 std::string GetRule(const Event &event)
163 const std::tm *time = std::localtime(&now);
164 std::string rrule;
188 std::string GetEventRRule(const Event &event)
191 std::string rrule;
196 rrule += ";COUNT=" + std::to_string(recurrenceRule.count.value());
199 rrule += ";INTERVAL=" + std::to_string(recurrenceRule.interval.value());
204 std::string GetWeeklyRule(const Event &event, const std::tm &time)
206 std::string rrule;
209 const std::vector<string> weekList = {"SU", "MO", "TU", "WE", "TH", "FR", "SA"};
223 std::string GetMonthlyRule(const Event &event, const std::tm &time)
226 std::string rrule;
242 rrule += std::to_string(time.tm_mday);
247 std::string GetYearlyRule(const Event &event, const std::tm &time)
251 std::string rrule;
255 std::string days = GetRRuleSerial(MIN_DAY_OF_YEAR, MAX_DAY_OF_YEAR, rruleValue.daysOfYear.value());
261 std::string weeks = GetRRuleSerial(MIN_WEEK_OF_YEAR, MAX_WEEK_OF_YEAR, weekOfYearList);
263 std::string weekdays = GetDaysOfWeekRule(MIN_DAY_OF_WEEK, MAX_DAY_OF_WEEK, daysOfWeekList);
270 std::string days = GetRRuleSerial(MIN_DAY_OF_MONTH, MAX_DAY_OF_MONTH, daysOfMonthList);
271 std::string months = GetRRuleSerial(MIN_MONTH_OF_YEAR, MAX_MONTH_OF_YEAR, monthsOfYearList);
280 std::string months = GetRRuleSerial(MIN_MONTH_OF_YEAR, MAX_MONTH_OF_YEAR, monthsOfYearList);
281 std::string daysOfWeekMonth = GetDaysOfWeekMonthRule(daysOfWeekList, weeksOfMonthList);
286 rrule += std::to_string(time.tm_mday);
288 rrule += std::to_string(time.tm_mon + monOffset);
293 std::string GetDaysOfWeekRule(int minValue, int maxValue, const std::vector<int64_t> &daysOfWeekList)
295 std::string rrule;
296 const std::vector<string> weekDayList = {"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
309 std::string GetDaysOfWeekMonthRule(
310 const std::vector<int64_t> &daysOfWeekList, const std::vector<int64_t> &weeksOfMonthList)
312 std::string rrule;
313 const std::vector<string> weekDayList = {"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
319 rrule = rrule + std::to_string(weeksOfMonthList[i]) + weekDayList[daysOfWeekList[i] - 1];
322 rrule = rrule + std::to_string(weeksOfMonthList[i]) + weekDayList[daysOfWeekList[i] - 1] + ",";
329 std::string GetRRuleSerial(int minValue, int maxValue, const std::vector<int64_t> &serialList)
331 std::string rrule;
335 rrule = rrule + std::to_string(serial);
338 rrule = rrule + std::to_string(serial) + ",";
350 std::string rrule = GetRule(event);
422 int GetIndexValue(const DataShareResultSetPtr &resultSet, int index, std::string& out)
437 int GetValue(DataShareResultSetPtr &resultSet, string_view fieldName, std::string& out)
449 std::vector<std::shared_ptr<Calendar>> ResultSetToCalendars(DataShareResultSetPtr &resultSet)
451 std::vector<std::shared_ptr<Calendar>> result;
469 std::string nameValue;
474 std::string typeValue;
480 std::string displayNameValue;
491 result.emplace_back(std::make_shared<Calendar>(curAccount, idValue));
496 std::optional<Location> ResultSetToLocation(DataShareResultSetPtr &resultSet)
501 out.location = std::make_optional<string>(value);
504 std::stringstream str2digit;
508 out.longitude = std::make_optional<double>(longitudeValue);
516 out.latitude = std::make_optional<double>(latitudeValue);
520 return std::nullopt;
522 return std::make_optional<Location>(out);
525 std::optional<EventService> ResultSetToEventService(DataShareResultSetPtr &resultSet)
531 return std::nullopt;
533 const std::set<std::string> serviceType = {"Meeting", "Watching", "Repayment", "Live", "Shopping",
538 return std::nullopt;
542 return std::nullopt;
547 out.description = std::make_optional<string>(value);
549 return std::make_optional<EventService>(out);
552 int StringToInt(const std::string &str)
555 return std::stoi(str);
556 } catch (std::exception &ex) {
562 std::time_t TimeToUTC(const std::string &strTime)
576 std::tm expireTime = { 0 };
580 if (strTime.find("T") != std::string::npos) {
590 std::time_t utcTime = mktime(&expireTime) * micSecond; //精确到微秒
595 std::vector<std::string> SplitString(const std::string &str, const std::string &flag)
597 std::vector<std::string> result;
598 std::string::size_type pos1 = 0;
599 std::string::size_type pos2 = str.find(flag);
600 while (std::string::npos != pos2) {
612 std::optional<vector<int64_t>> ResultSetToExcludedDates(DataShareResultSetPtr &resultSet)
614 std::string value;
617 return std::nullopt;
619 std::vector<string> strListExDate = SplitString(value, ",");
621 std::vector<int64_t> excludedDates;
627 return std::make_optional<vector<int64_t>>(excludedDates);
630 void ConvertRecurrenceFrequency(const std::string &frequency, RecurrenceRule &rule)
649 std::optional<RecurrenceRule> ResultSetToRecurrenceRule(DataShareResultSetPtr &resultSet)
654 std::string value;
657 return std::nullopt;
659 std::map<std::string, std::string> ruleMap;
660 std::vector<std::string> strListRule = SplitString(value, ";");
662 std::vector<std::string> keyAndValue = SplitString(str, "=");
664 ruleMap.insert(std::pair<std::string, std::string>(keyAndValue[0], keyAndValue[1]));
670 return std::make_optional<RecurrenceRule>(out);
673 void SetVecNum(std::optional<std::vector<int64_t>> &ruleVec, const std::string &ruleStr)
675 std::vector<std::string> weekNumList = SplitString(ruleStr, ",");
681 void SetRRuleValue(const std::map<std::string, std::string> &ruleMap, RecurrenceRule &out)
683 std::map<std::string, std::string>::const_iterator iter;
690 out.count = std::make_optional<int64_t>(StringToInt(iter->second));
694 out.interval = std::make_optional<int64_t>(StringToInt(iter->second));
698 out.expire = std::make_optional<int64_t>(TimeToUTC(iter->second));
701 std::vector<std::string> weekDayList = SplitString(iter->second, ",");
705 out.weeksOfYear = std::make_optional<std::vector<int64_t>>();
709 out.daysOfMonth = std::make_optional<std::vector<int64_t>>();
713 out.daysOfYear = std::make_optional<std::vector<int64_t>>();
717 out.monthsOfYear = std::make_optional<std::vector<int64_t>>();
723 void SetByDayOfRRule(const std::vector<std::string> &weekDayList, RecurrenceRule &out)
726 const std::vector<string> dayOfWeekList = {"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
727 out.daysOfWeek = std::make_optional<vector<int64_t>>();
728 out.weeksOfMonth = std::make_optional<vector<int64_t>>();
731 std::string weekDayStr = weekday.substr(weekday.length() - weekStrLen, weekStrLen);
732 std::string WeekNumStr = weekday.substr(0, weekday.length() - weekStrLen);
733 auto it = std::find(dayOfWeekList.begin(), dayOfWeekList.end(), weekDayStr);
740 auto it = std::find(dayOfWeekList.begin(), dayOfWeekList.end(), weekday);
749 void ResultSetToEvent(Event &event, DataShareResultSetPtr &resultSet, const std::set<std::string>& columns)
800 int ResultSetToEvents(std::vector<Event> &events, DataShareResultSetPtr &resultSet,
801 const std::set<std::string>& columns)
822 int ResultSetToAttendees(std::vector<Attendee> &attendees, DataShareResultSetPtr &resultSet)
842 attendee.role = std::make_optional<RoleType>(PARTICIPANT);
844 attendee.role = std::make_optional<RoleType>(ORGANIZER);
852 int ResultSetToReminders(std::vector<int> &reminders, DataShareResultSetPtr &resultSet)
873 bool IsValidHexString(const std::string& colorStr)
887 bool ColorParse(const std::string& colorStr, variant<string, int64_t>& colorValue)
906 std::string colorStrSub = colorStr.substr(1);
913 colorValue.emplace<1>(std::stoll(colorStrSub, NULL, 16)); // 16 is convert hex string to number
914 if (std::get_if<1>(&colorValue)) {
915 LOG_DEBUG("colorStrSub -> colorValue colorValue:%{public}s", std::to_string(std::get<1>(colorValue)).c_str());
922 void SetFieldInfo(const std::vector<string>& eventKey, std::vector<string>& queryField,
923 std::set<string>& resultSetField, const std::map<string, string> eventField)
972 void SetField(const std::vector<string>& eventKey, std::vector<string>& queryField, std::set<string>& resultSetField)
974 const std::map<string, string> eventField = { { "id", "_id" },