Lines Matching refs:defval
31 int32 ParseInt32WithDefault(const std::string &s, int32 defval) {
32 int32 value = defval;
33 return ParseInt32(s.c_str(), &value) ? value : defval;
36 int64 ParseInt64WithDefault(const std::string &s, int64 defval) {
37 int64 value = defval;
38 return ParseInt64(s.c_str(), &value) ? value : defval;
41 double ParseDoubleWithDefault(const std::string &s, double defval) {
42 double value = defval;
43 return ParseDouble(s.c_str(), &value) ? value : defval;
129 const char *defval) const {
136 return defval;
140 const std::string &defval) const {
141 return Get(name, defval.c_str());
144 int TaskContext::Get(const std::string &name, int defval) const {
146 return ParseInt32WithDefault(value, defval);
149 int64 TaskContext::Get(const std::string &name, int64 defval) const {
151 return ParseInt64WithDefault(value, defval);
154 double TaskContext::Get(const std::string &name, double defval) const {
156 return ParseDoubleWithDefault(value, defval);
159 bool TaskContext::Get(const std::string &name, bool defval) const {
161 return value.empty() ? defval : value == "true";