您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CAL_ENSURE_MEMORY函数代码示例

51自学网 2021-06-01 19:56:40
  C++
这篇教程C++ CAL_ENSURE_MEMORY函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CAL_ENSURE_MEMORY函数的典型用法代码示例。如果您正苦于以下问题:C++ CAL_ENSURE_MEMORY函数的具体用法?C++ CAL_ENSURE_MEMORY怎么用?C++ CAL_ENSURE_MEMORY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CAL_ENSURE_MEMORY函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NS_ENSURE_ARG_POINTER

NS_IMETHODIMPcalIcalComponent::GetNextProperty(const nsACString &kind, calIIcalProperty **prop){    NS_ENSURE_ARG_POINTER(prop);    icalproperty_kind propkind =        icalproperty_string_to_kind(PromiseFlatCString(kind).get());    if (propkind == ICAL_NO_PROPERTY)        return NS_ERROR_INVALID_ARG;    icalproperty *icalprop = nullptr;    if (propkind == ICAL_X_PROPERTY) {        for (icalprop =                 icalcomponent_get_next_property(mComponent, ICAL_X_PROPERTY);             icalprop;             icalprop = icalcomponent_get_next_property(mComponent,                                                        ICAL_X_PROPERTY)) {            if (kind.Equals(icalproperty_get_x_name(icalprop)))                break;        }    } else {        icalprop = icalcomponent_get_next_property(mComponent, propkind);    }    if (!icalprop) {        *prop = nullptr;        return NS_OK;    }    *prop = new calIcalProperty(icalprop, this);    CAL_ENSURE_MEMORY(*prop);    NS_ADDREF(*prop);    return NS_OK;}
开发者ID:Shaif95,项目名称:releases-comm-central,代码行数:35,


示例2: NS_ENSURE_ARG_POINTER

/* readonly attribute string className; */NS_IMETHODIMPcalDateTime::GetClassName(char ** aClassName){    NS_ENSURE_ARG_POINTER(aClassName);    *aClassName = static_cast<char *>(nsMemory::Clone(CAL_STRLEN_ARGS("calDateTime") +1));    CAL_ENSURE_MEMORY(*aClassName);    return NS_OK;}
开发者ID:mikeconley,项目名称:comm-central,代码行数:9,


示例3: NS_ENSURE_ARG_POINTER

NS_IMETHODIMPcalDateTime::Clone(calIDateTime **aResult){    NS_ENSURE_ARG_POINTER(aResult);    icaltimetype itt;    ToIcalTime(&itt);    calDateTime * const cdt = new calDateTime(&itt, mTimezone);    CAL_ENSURE_MEMORY(cdt);    NS_ADDREF(*aResult = cdt);    return NS_OK;}
开发者ID:dualsky,项目名称:FossaMail,代码行数:11,


示例4: ToIcalTime

NS_IMETHODIMPcalDateTime::GetIcalString(nsACString& aResult){    icaltimetype t;    ToIcalTime(&t);    // note that ics is owned by libical, so we don't need to free    char const * const ics = icaltime_as_ical_string(t);    CAL_ENSURE_MEMORY(ics);    aResult.Assign(ics);    return NS_OK;}
开发者ID:dualsky,项目名称:FossaMail,代码行数:12,


示例5: calRecurrenceRule

NS_IMETHODIMPcalRecurrenceRule::Clone(calIRecurrenceItem **aResult){    calRecurrenceRule * const crc = new calRecurrenceRule();    CAL_ENSURE_MEMORY(crc);    crc->mIsNegative = mIsNegative;    crc->mIsByCount = mIsByCount;    crc->mIcalRecur = mIcalRecur;    NS_ADDREF(*aResult = crc);    return NS_OK;}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:13,


示例6: NS_ENSURE_ARG_POINTER

NS_IMETHODIMPcalDateTime::GetEndOfMonth(calIDateTime ** aResult){    NS_ENSURE_ARG_POINTER(aResult);    icaltimetype icalt;    ToIcalTime(&icalt);    icalt.day = icaltime_days_in_month(icalt.month, icalt.year);    icalt.is_date = 1;    calDateTime * const cdt = new calDateTime(&icalt, mTimezone);    CAL_ENSURE_MEMORY(cdt);    NS_ADDREF(*aResult = cdt);    return NS_OK;}
开发者ID:SecareLupus,项目名称:Drood,代码行数:15,


示例7: ClearAllProperties

nsresult calIcalComponent::SetDateTimeAttribute(icalproperty_kind kind,                                                calIDateTime * dt){    ClearAllProperties(kind);    bool isValid;    if (!dt || NS_FAILED(dt->GetIsValid(&isValid)) || !isValid) {        return NS_OK;    }    icalproperty *prop = icalproperty_new(kind);    CAL_ENSURE_MEMORY(prop);    nsresult rc = calIcalProperty::setDatetime_(this, prop, dt);    if (NS_SUCCEEDED(rc))        icalcomponent_add_property(mComponent, prop);    else        icalproperty_free(prop);    return rc;}
开发者ID:Shaif95,项目名称:releases-comm-central,代码行数:17,


示例8: NS_ENSURE_ARG_POINTER

NS_IMETHODIMPcalIcalComponent::GetReferencedTimezones(uint32_t * aCount, calITimezone *** aTimezones){    NS_ENSURE_ARG_POINTER(aCount);    NS_ENSURE_ARG_POINTER(aTimezones);    uint32_t const count = mReferencedTimezones.Count();    if (count == 0) {        *aCount = 0;        *aTimezones = nullptr;        return NS_OK;    }    calITimezone ** const timezones = static_cast<calITimezone **>(        nsMemory::Alloc(sizeof(calITimezone *) * count));    CAL_ENSURE_MEMORY(timezones);    // tzptr will get used as an iterator by the enumerator function    calITimezone ** tzptr = timezones;    mReferencedTimezones.EnumerateRead(TimezoneHashToTimezoneArray, &tzptr);    *aTimezones = timezones;    *aCount = count;    return NS_OK;}
开发者ID:ewongbb,项目名称:releases-comm-central,代码行数:24,


示例9: icalproperty_get_value

nsresult calIcalProperty::getDatetime_(calIcalComponent * parent,                                       icalproperty * prop,                                       calIDateTime ** dtp){    icalvalue * const val = icalproperty_get_value(prop);    icalvalue_kind const valkind = icalvalue_isa(val);    if (valkind != ICAL_DATETIME_VALUE && valkind != ICAL_DATE_VALUE) {        return NS_ERROR_UNEXPECTED;    }    icaltimetype itt = icalvalue_get_datetime(val);    char const* tzid_ = nullptr;    if (!itt.is_utc) {        if (itt.zone) {            tzid_ = icaltimezone_get_tzid(const_cast<icaltimezone *>(itt.zone));        } else {            // Need to get the tzid param. Unfortunatly, libical tends to return raw            // ics strings, with quotes and everything. That's not what we want. Need            // to work around.            icalparameter * const tzparam = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER);            if (tzparam) {                tzid_ = icalparameter_get_xvalue(tzparam);            }        }    }    nsCOMPtr<calITimezone> tz;    if (tzid_) {        nsDependentCString const tzid(tzid_);        calIcalComponent * comp = nullptr;        if (parent) {            comp = parent->getParentVCalendarOrThis();        }        // look up parent if timezone is already referenced:        if (comp) {            comp->mReferencedTimezones.Get(tzid, getter_AddRefs(tz));        }        if (!tz) {            if (parent) {                // passed tz provider has precedence over timezone service:                calITimezoneProvider * const tzProvider = parent->getTzProvider();                if (tzProvider) {                    tzProvider->GetTimezone(tzid, getter_AddRefs(tz));                    NS_ASSERTION(tz, tzid_);                }            }            if (!tz) {                // look up tz in tz service.                // this hides errors from incorrect ics files, which could state                // a TZID that is not present in the ics file.                // The other way round, it makes this product more error tolerant.                nsresult rv = cal::getTimezoneService()->GetTimezone(tzid, getter_AddRefs(tz));                if (NS_FAILED(rv) || !tz) {                    icaltimezone const* zone = itt.zone;                    if (!zone && comp) {                        // look up parent VCALENDAR for VTIMEZONE:                        zone = icalcomponent_get_timezone(comp->mComponent, tzid_);                        NS_ASSERTION(zone, tzid_);                    }                    if (zone) {                        // We need to decouple this (inner) VTIMEZONE from the parent VCALENDAR to avoid                        // running into circular references (referenced timezones):                        icaltimezone * const clonedZone = icaltimezone_new();                        CAL_ENSURE_MEMORY(clonedZone);                        icalcomponent * const clonedZoneComp =                            icalcomponent_new_clone(icaltimezone_get_component(const_cast<icaltimezone *>(zone)));                        if (!clonedZoneComp) {                            icaltimezone_free(clonedZone, 1 /* free struct */);                            CAL_ENSURE_MEMORY(clonedZoneComp);                        }                        if (!icaltimezone_set_component(clonedZone, clonedZoneComp)) {                            icaltimezone_free(clonedZone, 1 /* free struct */);                            return NS_ERROR_INVALID_ARG;                        }                        nsCOMPtr<calIIcalComponent> const tzComp(new calIcalComponent(clonedZone, clonedZoneComp));                        CAL_ENSURE_MEMORY(tzComp);                        tz = new calTimezone(tzid, tzComp);                        CAL_ENSURE_MEMORY(tz);                    } else { // install phantom timezone, so the data could be repaired:                        tz = new calTimezone(tzid, nullptr);                        CAL_ENSURE_MEMORY(tz);                    }                }            }            if (comp && tz) {                // assure timezone is known:                comp->AddTimezoneReference(tz);            }        }        if (tz) {            // correct itt which would else appear floating:            itt.zone = cal::getIcalTimezone(tz);            itt.is_utc = 0;        } else {            cal::logMissingTimezone(tzid_);        }    }    *dtp = new calDateTime(&itt, tz);    CAL_ENSURE_MEMORY(*dtp);//.........这里部分代码省略.........
开发者ID:Shaif95,项目名称:releases-comm-central,代码行数:101,



注:本文中的CAL_ENSURE_MEMORY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CAMLlocal1函数代码示例
C++ CALL_SUBTEST_6函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。