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

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

51自学网 2021-06-03 11:54:48
  C++
这篇教程C++ yexception函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Format

    static inline size_t Format(T t, char* buf, size_t len) {        STATIC_ASSERT(1 < base && base < 17);        if (!len) {            ythrow yexception() << "zero length";        }        char* tmp = buf;        do {            *tmp++ = IntToChar[(ui32)SafeMod<base>(t)];            SafeShift<base>(t);        } while (t && --len);        if (t) {            ythrow yexception() << "not enough room in buffer";        }        const size_t ret = tmp - buf;        --tmp;        while (buf < tmp) {            const char c = *buf;            *buf = *tmp;            *tmp = c;            ++buf; --tmp;        }        return ret;    }
开发者ID:Mirocow,项目名称:balancer,代码行数:31,


示例2: ReadDict

        inline void ReadDict() {            if (Blob_.Size() < sizeof(ui64)) {                ythrow yexception() << "too small blob";            }            const char* end = (const char*)Blob_.End();            const char* ptr = end - sizeof(ui64);            ui64 dictlen = 0;            memcpy(&dictlen, ptr, sizeof(ui64));            dictlen = LittleToHost(dictlen);            if (dictlen > Blob_.Size() - sizeof(ui64)) {                ythrow yexception() << "bad blob";            }            const char* beg = ptr - dictlen;            TMemoryInput mi(beg, dictlen);            TZLibDecompress d((IZeroCopyInput*)&mi);            const ui32 count = Load<ui32>(&d);            for (size_t i = 0; i < count; ++i) {                TArchiveRecordDescriptorRef descr(new TArchiveRecordDescriptor(&d));                Recs_.push_back(descr);                Dict_[descr->Name()] = descr;            }        }
开发者ID:Mirocow,项目名称:balancer,代码行数:27,


示例3: GetExecPathImpl

static Stroka GetExecPathImpl() {#if defined(_solaris_)    return execname();#elif defined(_darwin_)    TTempBuf execNameBuf;    for (size_t i = 0; i < 2; ++i) {        uint32_t bufsize = (uint32_t)execNameBuf.Size();        int r = _NSGetExecutablePath(execNameBuf.Data(), &bufsize);        if (r == 0) {            return execNameBuf.Data();        } else if (r == -1) {            execNameBuf = TTempBuf(bufsize);        }    }    ythrow yexception() << "GetExecPathImpl() failed";#elif defined(_win_)    TTempBuf execNameBuf;    for (;;) {        DWORD r = GetModuleFileName(NULL, execNameBuf.Data(), execNameBuf.Size());        if (r == execNameBuf.Size()) {            execNameBuf = TTempBuf(execNameBuf.Size() * 2);        } else if (r == 0) {            ythrow yexception() << "GetExecPathImpl() failed: " << LastSystemErrorText();        } else {            return execNameBuf.Data();        }    }#elif defined(_linux_)    return ReadLink("/proc/" + ToString(getpid()) + "/exe");    // TODO(yoda): check if the filename ends with " (deleted)"#elif defined(_freebsd_)    Stroka execPath = FreeBSDGetExecPath();    if (GoodPath(execPath)) {        return execPath;    }    if (FreeBSDGuessExecPath(FreeBSDGetArgv0(), execPath)) {        return execPath;    }    if (FreeBSDGuessExecPath(getenv("_"), execPath)) {        return execPath;    }    if (FreeBSDGuessExecBasePath(getenv("PWD"), execPath)) {        return execPath;    }    if (FreeBSDGuessExecBasePath(GetCwd(), execPath)) {        return execPath;    }    ythrow yexception() << "can not resolve exec path";#else#       error dont know how to implement GetExecPath on this platform#endif}
开发者ID:Mirocow,项目名称:balancer,代码行数:53,


示例4: T

                inline T() {                    int result;                    result = pthread_mutexattr_init(&Attr);                    if (result != 0) {                        ythrow yexception() << "mutexattr init failed(" << LastSystemErrorText(result) << ")";                    }                    result = pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);                    if (result != 0) {                        ythrow yexception() << "mutexattr set type failed(" << LastSystemErrorText(result) << ")";                    }                }
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:13,


示例5: yexception

TParsedHttpRequest::TParsedHttpRequest(const TStringBuf& str) {    TStringBuf tmp;    if (!StripLeft(str).SplitImpl(' ', Method, tmp)) {        ythrow yexception() << "bad request(" << ToString(str).Quote() << ")";    }    if (!StripLeft(tmp).SplitImpl(' ', Request, Proto)) {        ythrow yexception() << "bad request(" << ToString(str).Quote() << ")";    }    Proto = StripLeft(Proto);}
开发者ID:Mirocow,项目名称:balancer,代码行数:13,


示例6: TMappedBlobBase

    inline TMappedBlobBase(const TMemoryMap& map, ui64 offset, size_t len)        : Map_(map)    {        if (!Map_.IsOpen()) {            ythrow yexception() << "memory map not open";        }        Map_.Map(offset, len);        if (len && !Map_.Ptr()) { // Ptr is 0 for blob of size 0            ythrow yexception() << "can not map(" << offset << ", " <<  len << ")";        }    }
开发者ID:Mirocow,项目名称:balancer,代码行数:13,


示例7: TImpl

 TImpl(const Stroka& style, const Stroka& base = "") {     InitError();     TxmlDocHolder sheetDoc(xmlParseMemory(~style, +style));     if (!!base) {         xmlNodeSetBase(sheetDoc->children, (xmlChar*)base.c_str());     }     if (!sheetDoc)         ythrow yexception() << "cannot parse xml of xslt: " << ErrorMessage;     Stylesheet.Reset(xsltParseStylesheetDoc(sheetDoc.Get()));     if (!Stylesheet)         ythrow yexception() << "cannot parse xslt: " << ErrorMessage;     // sheetDoc - ownership transferred to Stylesheet     sheetDoc.Release(); }
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:14,


示例8: Map

        inline TMapResult Map(i64 offset, size_t size, const char *dbg_name) {            assert(File_.IsOpen());            if (offset > Length_) {                ythrow yexception() <<  dbg_name << ": can't map something at offset " <<  offset << "in a file with length " <<  Length_;            }            if (offset + (i64)size > Length_) {                ythrow yexception() <<  dbg_name << ": can't map " <<  (unsigned long)size << " bytes at offset " <<  offset << ": " << LastSystemErrorText();            }            TMapResult result;            i64 base = DownToGranularity(offset);            result.Head = (i32)(offset - base);            size += result.Head;#if defined (_win_)            result.Ptr = MapViewOfFile(Mapping_, (Mode_ & oAccessMask) == oRdOnly                ? FILE_MAP_READ : FILE_MAP_WRITE, HI_32(base), LO_32(base), size);#else# if defined(_unix_mmap_64_)            if (Mode_ & oNotGreedy) {# endif                result.Ptr = mmap((caddr_t)NULL, size, (Mode_ & oAccessMask) == oRdOnly                    ? PROT_READ : PROT_READ | PROT_WRITE, MAP_SHARED | MAP_NOCORE,                    File_.GetHandle(), base);                if (result.Ptr == (char *)(-1)) {                    result.Ptr = 0;                }# if defined(_unix_mmap_64_)            } else {                result.Ptr = PtrStart_ ? static_cast<caddr_t>(PtrStart_) + base : NULL;            }# endif#endif            if (result.Ptr != 0 || size == 0) { // allow map of size 0                result.Size = size;            } else {                ythrow yexception() <<  dbg_name << ": can't map " <<  (unsigned long)size << " bytes at offset " <<  offset << ": " << LastSystemErrorText();            }            if (Mode_ & oPrecharge) {                int p = PrechargeImpl(File_, result.Ptr, result.Size, 0, result.Size);                UNUSED(p);            }            return result;        }
开发者ID:Mirocow,项目名称:balancer,代码行数:50,


示例9: SetFunction

    void SetFunction(const Stroka& name, const Stroka& uri, TxmlXPathFunction fn) {        InitError();        if (xsltRegisterExtModuleFunction(BAD_CAST ~name, BAD_CAST ~uri, (xmlXPathFunction)fn) < 0) {            ythrow yexception() << "cannot register xsl function " << uri << ':' << name << ": " << ErrorMessage;        }    }
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,


示例10: ToString

void CDocListRetrieverFromDisc::FillDocInfo(SDocumentAttribtes& attrs){    Stroka strFilePath = m_SmartFileFind.GetFoundFilePath(m_iCurPath);    Stroka strURL;    if (strFilePath == m_strSearchDir) {        TStringBuf left, right;        PathHelper::Split(strFilePath, left, right);        strURL = ToString(right);    } else        strURL = strFilePath.substr(m_strSearchDir.size());    if (strURL.empty())        ythrow yexception() << "Can't build url for file /"" << strFilePath                              << "/" with searchdir /"" << m_strSearchDir << "/".";    TransformBackSlash(strURL);    attrs.m_strUrl = strURL;    Stroka strTime;    if (stroka(m_strLTM) == "file") {        CTime lw_time = m_SmartFileFind.GetFoundFileInfo(m_iCurPath).m_LastWriteTime;        strTime = lw_time.Format("%d.%m.%Y %H:%M:%S");    }    if (strTime.empty())        strTime = m_strStartTime;    attrs.m_strTitle = CharToWide(strTime);    attrs.m_strSource = strURL;    attrs.m_strTitle = CharToWide(attrs.m_strSource);     // ??? rewriting}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:33,


示例11: FreeData

bool CDocBase::ProceedInternal(const TWtringBuf& src, const SDocumentAttribtes& docAttrs, const CParserOptions* parserOptions, bool bAnalyze){    // if caller forgot this...        FreeData();    // this really allocate memory only on first call        //лениво создаем m_pText        CreateTextClass(parserOptions);        GetText()->PutAttributes(docAttrs);        GetText()->SetParserOptions(parserOptions);        const size_t MAX_SRC_SIZE = 2*1024*1024;        m_Source = Wtroka(~src, (src.size() < MAX_SRC_SIZE) ? src.size() : MAX_SRC_SIZE);        switch (m_dtyp) {            case DocumentHtml:                proceedHtml();                break;            default:                proceedText();        }        if (bAnalyze) {            if( parserOptions )                m_pText->analyzeSentences();            else                ythrow yexception() << "ParserOptions are not initialized.";        }    return true;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:31,


示例12: MigrateCtr

ui32 NCatboostCuda::UpdateFeatureId(TBinarizedFeaturesManager& featuresManager,                                    const TModelFeaturesMap& map,                                    const ui32 featureId) {    if (map.Ctrs.has(featureId)) {        const auto& info = map.Ctrs.at(featureId);        TCtr remapedCtr = MigrateCtr(featuresManager, map, info.Ctr);        if (featuresManager.IsKnown(remapedCtr)) {            ui32 remappedId = featuresManager.GetId(remapedCtr);            CB_ENSURE(info.Borders == featuresManager.GetBorders(remappedId),                      " tensor : " << remapedCtr.FeatureTensor << "  (ctr type "                                   << remapedCtr.Configuration.Type << "). Error: progress borders should be consistent: " << remappedId << " / " << featureId << " " << Print(info.Borders) << " vs " << Print(featuresManager.GetBorders(remappedId)));            return remappedId;        } else {            return featuresManager.AddCtr(remapedCtr,                                          TVector<float>(info.Borders));        }    } else if (map.FloatFeatures.has(featureId)) {        auto& floatInfo = map.FloatFeatures.at(featureId);        const ui32 featureManagerId = featuresManager.GetFeatureManagerIdForFloatFeature(floatInfo.DataProviderId);        CB_ENSURE(floatInfo.Borders == featuresManager.GetBorders(featureManagerId),                  "Error: progress borders should be consistent");        return featureManagerId;    } else if (map.CatFeaturesMap.has(featureId)) {        const ui32 dataProviderId = map.CatFeaturesMap.at(featureId);        return featuresManager.GetFeatureManagerIdForCatFeature(dataProviderId);    } else {        ythrow yexception() << "Error: can't remap featureId #" << featureId;    }}
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:31,


示例13: GetInternal

// Options with parameters that can be specified several timesconst TVector<const char*> &Opt2::MArg(char opt, const char *help) {    Opt2Param &p = GetInternal(opt, nullptr, help, false);    p.MultipleUse = true;    if (!p.HasArg)        ythrow yexception() << "Opt2::Arg called for '" <<  opt << "' which is an option without argument";    return p.ActualValue;}
开发者ID:iamnik13,项目名称:catboost,代码行数:8,


示例14: ConstructFromFileContent

static inline TBlob ConstructFromFileContent(const TFile& file, ui64 offset, ui64 length) {    if (length > Max<size_t>()) {        ythrow yexception() << "can not read whole file(length = " << length << ")";    }    return ReadFromFile<TCounter>(file, offset, static_cast<size_t>(length));}
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例15: TImpl

        inline TImpl() {#if defined (_win_)            InitializeCriticalSection(&Obj);#else            struct T {                pthread_mutexattr_t Attr;                inline T() {                    int result;                    result = pthread_mutexattr_init(&Attr);                    if (result != 0) {                        ythrow yexception() << "mutexattr init failed(" << LastSystemErrorText(result) << ")";                    }                    result = pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);                    if (result != 0) {                        ythrow yexception() << "mutexattr set type failed(" << LastSystemErrorText(result) << ")";                    }                }                inline ~T() throw () {                    int result = pthread_mutexattr_destroy(&Attr);                    VERIFY(result == 0, "mutexattr destroy(%s)", LastSystemErrorText(result));                }            } pma;            int result = pthread_mutex_init(&Obj, &pma.Attr);            if (result != 0) {                ythrow yexception() << "mutex init failed(" << LastSystemErrorText(result) << ")";            }#endif        }
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:33,


示例16: guard

void TKWTypePool::Load(TInputStream* buffer){    yvector<Stroka> names;    ::Load(buffer, names);    static TAtomic lock;    TGuard<TAtomic> guard(lock);    // rebuild mLoadIndex    mLoadIndex.clear();    for (size_t i = 0; i < names.size(); ++i) {        if (names[i].empty()) {            static const TDescriptor* null_descriptor = NULL;            mLoadIndex.push_back(null_descriptor);            continue;        }        // all loaded names should be among registred descriptors        yhash<Stroka, const TDescriptor*>::const_iterator descr = mRegisteredTypes.find(names[i]);        if (descr != mRegisteredTypes.end())            mLoadIndex.push_back(descr->second);        else            ythrow yexception() << "Unknown kw-type " << names[i] << " is found. "                                << "You should re-compile your grammar files.";    }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:26,


示例17: FindMessageTypeByName

const TKWTypePool::TDescriptor* TKWTypePool::RequireMessageType(const Stroka& name) const{    const TDescriptor* res = FindMessageTypeByName(name);    if (res == NULL)        ythrow yexception() << "KW-type /"" << name << "/" is not registered.";    return res;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,


示例18: factFields

bool CQuotesFinder::AddQuoteDBFact(SWordHomonymNum Subj, CSentenceRusProcessor* pSent, const Wtroka& QuoteStr,                                   SLeadInfo LeadInfo, bool bSubject){    CFactFields factFields("Quote");    factFields.m_LeadInfo = LeadInfo;    if (!CreateQuoteSubjectAsFio(Subj, pSent, factFields))        return false;    if (!CreateQuoteValue(QuoteStr, factFields)) return false;    CBoolWS bWs(bSubject);    bWs.SetPair(0,0);    factFields.AddValue(CFactFields::IsSubject, bWs);    CFactsWS* factWS = new CFactsWS();    if (!pSent->m_Words[Subj].GetSourceWordSequence())        ythrow yexception() << "CQuotesFinder::AddQuoteDBFact: no pSent->m_Words[Subj].GetSourceWordSequence() ";    factWS->SetPair(*pSent->m_Words[Subj].GetSourceWordSequence());    factWS->PutArticle(m_MainArticle);    factWS->AddFact(factFields);    factWS->SetMainWord(Subj);    pSent->GetMultiWordCreator().TakeMultiWord(factWS);    return true;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:25,


示例19: yexception

void TBufferedOutput::DoWrite(const void* data, size_t len) {    if (Impl_.Get()) {        Impl_->Write(data, len);    } else {        ythrow yexception() << "can not write to finished stream";    }}
开发者ID:noscripter,项目名称:tomita-parser,代码行数:7,


示例20: CharsetByName

ECharset CCommonParm::ParseEncoding(const Stroka& encodingName) const {    ECharset enc = CharsetByName(encodingName.c_str());    if (enc == CODES_UNKNOWN)        ythrow yexception() << "Unknown encoding: /"" << encodingName << "/"";    return enc;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,


示例21: yexception

TBlob TBlob::SubBlob(size_t begin, size_t end) const {    if (begin > Length() || end > Length() || begin > end) {        ythrow yexception() << "incorrect subblob (" << begin << ", " << end << ", outer length = " << Length() << ")";    }    return TBlob(Begin() + begin, end - begin, S_.Base);}
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例22: yexception

size_t ToStringImpl<bool>(bool t, char* buf, size_t len) {    if (!len) {        ythrow yexception() << "zero length";    }    *buf = t ? '1' : '0';    return 1;}
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例23: Version

TChunkedDataReader::TChunkedDataReader(const TBlob& blob)    : Version(0)    , Size(0){    const char* cdata = blob.AsCharPtr();    const size_t size = blob.Size();    if (size < 4)        ythrow yexception() << "empty file with chunks";    ui32 last = ((ui32*)(cdata + size))[-1];    if (last != 0) { // old version file        ui32* aux = (ui32*)(cdata + size);        ui32 count = last;        Size = size - (count + 1) * sizeof(ui32);        aux -= (count + 1);        ReadAux<ui32>(cdata, aux, count, &Offsets);        return;    }    ui64* aux = (ui64*)(cdata + size);    Version = aux[-2];    VERIFY(Version > 0, "Invalid version");    ui64 count = aux[-3];    aux -= (count + 3);    ReadAux<ui64>(cdata, aux, count, &Offsets);    aux -= count;    Lengths.resize(count);    for (size_t i = 0; i < count; ++i) {        Lengths[i] = IntegerCast<size_t>(aux[i]);    }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:35,


示例24: yexception

void TLzmaCompress::DoWrite(const void* buf, size_t len) {    if (!Impl_) {        ythrow yexception() << "can not write to finished lzma stream";    }    Impl_->Write(buf, len);}
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例25: yexception

void TArchiveWriter::Add(const Stroka& key, TInputStream* src) {    if (!Impl_.Get()) {        ythrow yexception() << "archive already closed";    }    Impl_->Add(key, src);}
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例26: GeneratedDescriptor

TFile::TFile(const Stroka& name)    : GeneratedDescriptor(NULL){    if (!name)        ythrow yexception() << "NBuiltin::TFile's base name cannot be empty";    AddAlias(name);}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,


示例27: KeyByIndex

        inline Stroka KeyByIndex(size_t n) const {            if (n < Count()) {                return Recs_[n]->Name();            }            ythrow yexception() << "incorrect index";        }
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例28: FillConstFieldValue

void CSitFactInterpretation::FillFactField(const fact_field_reference_t& fact_field, const SWordHomonymNum& value, yvector<CFactFields>& newFacts){    if (fact_field.m_bHasValue &&        ((fact_field.m_Field_type == TextField) ||            (fact_field.m_Field_type == BoolField))) {        FillConstFieldValue(fact_field, newFacts, value);        return;    }    CWordSequence* pWS = m_Words[value].GetSourceWordSequence();    if (pWS == NULL)        ythrow yexception() << "Bad wordsequence in /"CSitFactInterpretation::FillFactField/"";    CFactsWS* factWS = dynamic_cast<CFactsWS*>(pWS);    if (factWS != NULL)        FillFactFieldFromFactWS(fact_field, factWS , newFacts);    else        switch (fact_field.m_Field_type) {            case FioField:  FillFioFactField(fact_field, pWS, newFacts, value); break;            case TextField: FillTextFactField(fact_field, pWS, newFacts); break;            case DateField: FillDateFactField(fact_field, pWS, newFacts); break;            default: break;        }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:25,


示例29: yexception

void* TDynamicLibrary::Sym(const char* name) {    if (!IsLoaded()) {        ythrow yexception() << "library not loaded";    }    return Impl_->Sym(name);}
开发者ID:Mirocow,项目名称:balancer,代码行数:7,


示例30: yexception

void CParserOptions::InitFromProtobuf(const Stroka& name) {    TTextMinerConfig c;    if (!NProtoConf::LoadFromFile(name, c))       ythrow yexception() << "Cannot read the config from /"" << name << "/".";    InitFromConfigObject(c);}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,



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


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